getBand: nscoord y = aState.y + aState.topMargin; PRBool  isLeftFloater = PR_FALSE; PRBool  isRightFloater = PR_FALSE;   aState.spaceManager->GetBandData(y, aState.availSize, *aState.currentBand);  if (aState.currentBand->count == 1) { if (aState.currentBand->rects[0].width != aState.availSize.width) {  if (aState.currentBand->rects[0].x > 0) { isLeftFloater = PR_TRUE; }  if (aState.currentBand->rects[0].XMost() < aState.availSize.width) { isRightFloater = PR_TRUE;
for (;;) { PRBool haveFloater = PR_FALSE;     NS_FRAME_LOG(NS_FRAME_TRACE_CHILD_REFLOW, ("nsBlockReflowState::ClearFloaters: mY=%d trapCount=%d", mY, mCurrentBand.count)); nscoord clearYMost = mY - mBorderPadding.top; nsRect tmp; PRInt32 i; for (i = 0; i < mCurrentBand.count; i++) { const nsStyleDisplay* display; nsBandTrapezoid* trapezoid = &mCurrentBand.data[i]; NS_FRAME_LOG(NS_FRAME_TRACE_CHILD_REFLOW, ("nsBlockReflowState::ClearFloaters: trap=%d state=%d", i, trapezoid->state)); if (nsBandTrapezoid::Available != trapezoid->state) { haveFloater = PR_TRUE; if (nsBandTrapezoid::OccupiedMultiple == trapezoid->state) { PRInt32 fn, numFrames = trapezoid->frames->Count(); NS_ASSERTION(numFrames > 0, "bad trapezoid frame list"); for (fn = 0; fn < numFrames; fn++) { nsIFrame* frame = (nsIFrame*) trapezoid->frames->ElementAt(fn); frame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display); NS_FRAME_LOG(NS_FRAME_TRACE_CHILD_REFLOW, ("nsBlockReflowState::ClearFloaters: frame[%d]=%p floats=%d", fn, frame, display->mFloats)); switch (display->mFloats) { case NS_STYLE_FLOAT_LEFT: if ((NS_STYLE_CLEAR_LEFT == aBreakType) || (NS_STYLE_CLEAR_LEFT_AND_RIGHT == aBreakType)) { trapezoid->GetRect(tmp); nscoord ym = tmp.YMost(); if (ym > clearYMost) { clearYMost = ym; NS_FRAME_LOG(NS_FRAME_TRACE_CHILD_REFLOW, ("nsBlockReflowState::ClearFloaters: left clearYMost=%d", clearYMost)); } } break; case NS_STYLE_FLOAT_RIGHT: if ((NS_STYLE_CLEAR_RIGHT == aBreakType) || (NS_STYLE_CLEAR_LEFT_AND_RIGHT == aBreakType)) { trapezoid->GetRect(tmp); nscoord ym = tmp.YMost(); if (ym > clearYMost) { clearYMost = ym; NS_FRAME_LOG(NS_FRAME_TRACE_CHILD_REFLOW, ("nsBlockReflowState::ClearFloaters: right clearYMost=%d", clearYMost)); } } break; } } } else { trapezoid->frame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display); NS_FRAME_LOG(NS_FRAME_TRACE_CHILD_REFLOW, ("nsBlockReflowState::ClearFloaters: frame=%p floats=%d", trapezoid->frame, display->mFloats)); switch (display->mFloats) { case NS_STYLE_FLOAT_LEFT: if ((NS_STYLE_CLEAR_LEFT == aBreakType) || (NS_STYLE_CLEAR_LEFT_AND_RIGHT == aBreakType)) { trapezoid->GetRect(tmp); nscoord ym = tmp.YMost(); if (ym > clearYMost) { clearYMost = ym; NS_FRAME_LOG(NS_FRAME_TRACE_CHILD_REFLOW, ("nsBlockReflowState::ClearFloaters: left clearYMost=%d", clearYMost)); } } break; case NS_STYLE_FLOAT_RIGHT: if ((NS_STYLE_CLEAR_RIGHT == aBreakType) || (NS_STYLE_CLEAR_LEFT_AND_RIGHT == aBreakType)) { trapezoid->GetRect(tmp); nscoord ym = tmp.YMost(); if (ym > clearYMost) { clearYMost = ym; NS_FRAME_LOG(NS_FRAME_TRACE_CHILD_REFLOW, ("nsBlockReflowState::ClearFloaters: right clearYMost=%d", clearYMost)); } } break; } }
void nsBlockFrame::ClearFloaters(nsBlockReflowState& aState, PRUint32 aClear){  // Translate the coordinate space  aState.spaceManager->Translate(aState.borderPadding.left, 0);getBand:  nscoord y = aState.y + aState.topMargin;  PRBool  isLeftFloater = PR_FALSE;  PRBool  isRightFloater = PR_FALSE;  // Get a band of available space  aState.spaceManager->GetBandData(y, aState.availSize, *aState.currentBand);  if (aState.currentBand->count == 1) {    if (aState.currentBand->rects[0].width != aState.availSize.width) {      // Some of the space is taken up by floaters      if (aState.currentBand->rects[0].x > 0) {        isLeftFloater = PR_TRUE;      }      if (aState.currentBand->rects[0].XMost() < aState.availSize.width) {        isRightFloater = PR_TRUE;      }    }  } else if (aState.currentBand->count == 2) {    if (aState.currentBand->rects[0].width > aState.currentBand->rects[1].width) {      isRightFloater = PR_TRUE;    } else {      isLeftFloater = PR_TRUE;      // There may also be a right floater      if (aState.currentBand->rects[1].XMost() < aState.availSize.width) {        isRightFloater = PR_TRUE;      }    }  } else {    // Must be both left and right floaters    isLeftFloater = PR_TRUE;    isRightFloater = PR_TRUE;  }  if (isLeftFloater) {    if ((aClear == NS_STYLE_CLEAR_LEFT) || (aClear == NS_STYLE_CLEAR_BOTH)) {      aState.y += aState.currentBand->rects[0].height;      goto getBand;    }  }  if (isRightFloater) {    if ((aClear == NS_STYLE_CLEAR_RIGHT) || (aClear == NS_STYLE_CLEAR_BOTH)) {      aState.y += aState.currentBand->rects[0].height;      goto getBand;    }  }  aState.spaceManager->Translate(-aState.borderPadding.left, 0);}