Bug 898797 - Use nsHTMLReflowState::ApplyRelativePositioning when placing floats. r=dbaron

This commit is contained in:
Corey Ford 2013-07-29 21:53:13 -07:00
parent 99ffeabe6b
commit c0b1bad70a
3 changed files with 11 additions and 6 deletions

View File

@ -5740,6 +5740,7 @@ nsBlockFrame::ReflowFloat(nsBlockReflowState& aState,
const nsRect& aAdjustedAvailableSpace,
nsIFrame* aFloat,
nsMargin& aFloatMargin,
nsMargin& aFloatOffsets,
bool aFloatPushedDown,
nsReflowStatus& aReflowStatus)
{
@ -5830,8 +5831,9 @@ nsBlockFrame::ReflowFloat(nsBlockReflowState& aState,
return rv;
}
// Capture the margin information for the caller
// Capture the margin and offsets information for the caller
aFloatMargin = floatRS.mComputedMargin; // float margins don't collapse
aFloatOffsets = floatRS.mComputedOffsets;
const nsHTMLReflowMetrics& metrics = brc.GetMetrics();

View File

@ -706,6 +706,7 @@ protected:
const nsRect& aAdjustedAvailableSpace,
nsIFrame* aFloat,
nsMargin& aFloatMargin,
nsMargin& aFloatOffsets,
// Whether the float's position
// (aAdjustedAvailableSpace) has been pushed down
// due to the presence of other floats.

View File

@ -633,6 +633,7 @@ nsBlockReflowState::FlowAndPlaceFloat(nsIFrame* aFloat)
aFloat, offsets);
nsMargin floatMargin; // computed margin
nsMargin floatOffsets;
nsReflowStatus reflowStatus;
// If it's a floating first-letter, we need to reflow it before we
@ -640,8 +641,8 @@ nsBlockReflowState::FlowAndPlaceFloat(nsIFrame* aFloat)
// of the first letter until reflow!).
bool isLetter = aFloat->GetType() == nsGkAtoms::letterFrame;
if (isLetter) {
mBlock->ReflowFloat(*this, adjustedAvailableSpace, aFloat,
floatMargin, false, reflowStatus);
mBlock->ReflowFloat(*this, adjustedAvailableSpace, aFloat, floatMargin,
floatOffsets, false, reflowStatus);
floatMarginWidth = aFloat->GetSize().width + floatMargin.LeftRight();
NS_ASSERTION(NS_FRAME_IS_COMPLETE(reflowStatus),
"letter frames shouldn't break, and if they do now, "
@ -770,8 +771,8 @@ nsBlockReflowState::FlowAndPlaceFloat(nsIFrame* aFloat)
// where to break.
if (!isLetter) {
bool pushedDown = mY != saveY;
mBlock->ReflowFloat(*this, adjustedAvailableSpace, aFloat,
floatMargin, pushedDown, reflowStatus);
mBlock->ReflowFloat(*this, adjustedAvailableSpace, aFloat, floatMargin,
floatOffsets, pushedDown, reflowStatus);
}
if (aFloat->GetPrevInFlow())
floatMargin.top = 0;
@ -817,7 +818,8 @@ nsBlockReflowState::FlowAndPlaceFloat(nsIFrame* aFloat)
floatMargin.top + floatY);
// If float is relatively positioned, factor that in as well
origin += aFloat->GetRelativeOffset(floatDisplay);
nsHTMLReflowState::ApplyRelativePositioning(floatDisplay, floatOffsets,
&origin);
// Position the float and make sure and views are properly
// positioned. We need to explicitly position its child views as