Set inflation container to null during ComputeSize calls for inflation containers, when we should not have inflation applied. (Bug 706609, patch 4.5) r=roc

This commit is contained in:
L. David Baron 2012-01-24 17:21:29 -08:00
parent 185e4fa106
commit a7425ba7e8
3 changed files with 28 additions and 17 deletions

View File

@ -62,6 +62,7 @@
#endif
using namespace mozilla;
using namespace mozilla::layout;
nsBlockReflowState::nsBlockReflowState(const nsHTMLReflowState& aReflowState,
nsPresContext* aPresContext,
@ -597,6 +598,7 @@ FloatMarginWidth(const nsHTMLReflowState& aCBReflowState,
nsIFrame *aFloat,
const nsCSSOffsetState& aFloatOffsetState)
{
AutoMaybeNullInflationContainer an(aFloat);
return aFloat->ComputeSize(
aCBReflowState.rendContext,
nsSize(aCBReflowState.ComputedWidth(),

View File

@ -67,6 +67,7 @@
#endif
using namespace mozilla;
using namespace mozilla::layout;
// Prefs-driven control for |text-decoration: blink|
static bool sPrefIsLoaded = false;
@ -1243,24 +1244,28 @@ nsHTMLReflowState::InitAbsoluteConstraints(nsPresContext* aPresContext,
bool heightIsAuto = eStyleUnit_Auto == mStylePosition->mHeight.GetUnit();
bool shrinkWrap = leftIsAuto || rightIsAuto;
nsSize size =
frame->ComputeSize(rendContext,
nsSize(containingBlockWidth,
containingBlockHeight),
containingBlockWidth, // XXX or availableWidth?
nsSize(mComputedMargin.LeftRight() +
mComputedOffsets.LeftRight(),
mComputedMargin.TopBottom() +
mComputedOffsets.TopBottom()),
nsSize(mComputedBorderPadding.LeftRight() -
mComputedPadding.LeftRight(),
mComputedBorderPadding.TopBottom() -
{
AutoMaybeNullInflationContainer an(frame);
nsSize size =
frame->ComputeSize(rendContext,
nsSize(containingBlockWidth,
containingBlockHeight),
containingBlockWidth, // XXX or availableWidth?
nsSize(mComputedMargin.LeftRight() +
mComputedOffsets.LeftRight(),
mComputedMargin.TopBottom() +
mComputedOffsets.TopBottom()),
nsSize(mComputedBorderPadding.LeftRight() -
mComputedPadding.LeftRight(),
mComputedBorderPadding.TopBottom() -
mComputedPadding.TopBottom()),
nsSize(mComputedPadding.LeftRight(),
mComputedPadding.TopBottom()),
nsSize(mComputedPadding.LeftRight(),
mComputedPadding.TopBottom()),
shrinkWrap);
mComputedWidth = size.width;
mComputedHeight = size.height;
shrinkWrap);
mComputedWidth = size.width;
mComputedHeight = size.height;
}
NS_ASSERTION(mComputedWidth >= 0, "Bogus width");
NS_ASSERTION(mComputedHeight == NS_UNCONSTRAINEDSIZE ||
mComputedHeight >= 0, "Bogus height");
@ -1862,6 +1867,8 @@ nsHTMLReflowState::InitConstraints(nsPresContext* aPresContext,
InitAbsoluteConstraints(aPresContext, cbrs, aContainingBlockWidth,
aContainingBlockHeight, aFrameType);
} else {
AutoMaybeNullInflationContainer an(frame);
bool isBlock =
NS_CSS_FRAME_TYPE_BLOCK == NS_FRAME_GET_TYPE(mFrameType);
// make sure legend frames with display:block and width:auto still

View File

@ -535,6 +535,8 @@ ChildShrinkWrapWidth(nsRenderingContext *aRenderingContext,
nsSize aCBSize, nscoord aAvailableWidth,
nscoord *aMarginResult = nsnull)
{
AutoMaybeNullInflationContainer an(aChildFrame);
nsCSSOffsetState offsets(aChildFrame, aRenderingContext, aCBSize.width);
nsSize size = aChildFrame->ComputeSize(aRenderingContext, aCBSize,
aAvailableWidth,