mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
Bug 898797 - Use nsHTMLReflowState::ApplyRelativePositioning when placing floats. r=dbaron
This commit is contained in:
parent
6f4e72b203
commit
8a75e63592
@ -5740,6 +5740,7 @@ nsBlockFrame::ReflowFloat(nsBlockReflowState& aState,
|
|||||||
const nsRect& aAdjustedAvailableSpace,
|
const nsRect& aAdjustedAvailableSpace,
|
||||||
nsIFrame* aFloat,
|
nsIFrame* aFloat,
|
||||||
nsMargin& aFloatMargin,
|
nsMargin& aFloatMargin,
|
||||||
|
nsMargin& aFloatOffsets,
|
||||||
bool aFloatPushedDown,
|
bool aFloatPushedDown,
|
||||||
nsReflowStatus& aReflowStatus)
|
nsReflowStatus& aReflowStatus)
|
||||||
{
|
{
|
||||||
@ -5830,8 +5831,9 @@ nsBlockFrame::ReflowFloat(nsBlockReflowState& aState,
|
|||||||
return rv;
|
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
|
aFloatMargin = floatRS.mComputedMargin; // float margins don't collapse
|
||||||
|
aFloatOffsets = floatRS.mComputedOffsets;
|
||||||
|
|
||||||
const nsHTMLReflowMetrics& metrics = brc.GetMetrics();
|
const nsHTMLReflowMetrics& metrics = brc.GetMetrics();
|
||||||
|
|
||||||
|
@ -706,6 +706,7 @@ protected:
|
|||||||
const nsRect& aAdjustedAvailableSpace,
|
const nsRect& aAdjustedAvailableSpace,
|
||||||
nsIFrame* aFloat,
|
nsIFrame* aFloat,
|
||||||
nsMargin& aFloatMargin,
|
nsMargin& aFloatMargin,
|
||||||
|
nsMargin& aFloatOffsets,
|
||||||
// Whether the float's position
|
// Whether the float's position
|
||||||
// (aAdjustedAvailableSpace) has been pushed down
|
// (aAdjustedAvailableSpace) has been pushed down
|
||||||
// due to the presence of other floats.
|
// due to the presence of other floats.
|
||||||
|
@ -633,6 +633,7 @@ nsBlockReflowState::FlowAndPlaceFloat(nsIFrame* aFloat)
|
|||||||
aFloat, offsets);
|
aFloat, offsets);
|
||||||
|
|
||||||
nsMargin floatMargin; // computed margin
|
nsMargin floatMargin; // computed margin
|
||||||
|
nsMargin floatOffsets;
|
||||||
nsReflowStatus reflowStatus;
|
nsReflowStatus reflowStatus;
|
||||||
|
|
||||||
// If it's a floating first-letter, we need to reflow it before we
|
// 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!).
|
// of the first letter until reflow!).
|
||||||
bool isLetter = aFloat->GetType() == nsGkAtoms::letterFrame;
|
bool isLetter = aFloat->GetType() == nsGkAtoms::letterFrame;
|
||||||
if (isLetter) {
|
if (isLetter) {
|
||||||
mBlock->ReflowFloat(*this, adjustedAvailableSpace, aFloat,
|
mBlock->ReflowFloat(*this, adjustedAvailableSpace, aFloat, floatMargin,
|
||||||
floatMargin, false, reflowStatus);
|
floatOffsets, false, reflowStatus);
|
||||||
floatMarginWidth = aFloat->GetSize().width + floatMargin.LeftRight();
|
floatMarginWidth = aFloat->GetSize().width + floatMargin.LeftRight();
|
||||||
NS_ASSERTION(NS_FRAME_IS_COMPLETE(reflowStatus),
|
NS_ASSERTION(NS_FRAME_IS_COMPLETE(reflowStatus),
|
||||||
"letter frames shouldn't break, and if they do now, "
|
"letter frames shouldn't break, and if they do now, "
|
||||||
@ -770,8 +771,8 @@ nsBlockReflowState::FlowAndPlaceFloat(nsIFrame* aFloat)
|
|||||||
// where to break.
|
// where to break.
|
||||||
if (!isLetter) {
|
if (!isLetter) {
|
||||||
bool pushedDown = mY != saveY;
|
bool pushedDown = mY != saveY;
|
||||||
mBlock->ReflowFloat(*this, adjustedAvailableSpace, aFloat,
|
mBlock->ReflowFloat(*this, adjustedAvailableSpace, aFloat, floatMargin,
|
||||||
floatMargin, pushedDown, reflowStatus);
|
floatOffsets, pushedDown, reflowStatus);
|
||||||
}
|
}
|
||||||
if (aFloat->GetPrevInFlow())
|
if (aFloat->GetPrevInFlow())
|
||||||
floatMargin.top = 0;
|
floatMargin.top = 0;
|
||||||
@ -817,7 +818,8 @@ nsBlockReflowState::FlowAndPlaceFloat(nsIFrame* aFloat)
|
|||||||
floatMargin.top + floatY);
|
floatMargin.top + floatY);
|
||||||
|
|
||||||
// If float is relatively positioned, factor that in as well
|
// 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
|
// Position the float and make sure and views are properly
|
||||||
// positioned. We need to explicitly position its child views as
|
// positioned. We need to explicitly position its child views as
|
||||||
|
Loading…
Reference in New Issue
Block a user