Switch nsLayoutUtils inflation methods to the new setup with state on the pres context. (Bug 706609, patch 5) r=roc

This is the third of three patches to rework the way we handle getting
the font inflation container and width data during reflow, which are
needed so that we can sometimes honor inflation during intrinsic width
calculation (which we need to do to make some form controls inflate
correctly).
This commit is contained in:
L. David Baron
2012-01-24 17:21:29 -08:00
parent eadb1db264
commit c6e45feee7
20 changed files with 96 additions and 233 deletions

View File

@@ -498,14 +498,8 @@ nsTextControlFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
nsSize aMargin, nsSize aBorder,
nsSize aPadding, bool aShrinkWrap)
{
float inflation;
if (nsLayoutUtils::IsContainerForFontSizeInflation(this)) {
// FIXME: This won't turn out so well for the height; maybe disable
// inflation entirely in this case?
inflation = 1.0f;
} else {
inflation = nsLayoutUtils::FontSizeInflationFor(this, aCBSize.width);
}
float inflation =
nsLayoutUtils::FontSizeInflationFor(this, nsLayoutUtils::eInReflow);
nsSize autoSize;
nsresult rv = CalcIntrinsicSize(aRenderingContext, autoSize, inflation);
if (NS_FAILED(rv)) {
@@ -612,24 +606,8 @@ nsTextControlFrame::GetBoxAscent(nsBoxLayoutState& aState)
// Return the baseline of the first (nominal) row, with centering for
// single-line controls.
float inflation;
if (nsLayoutUtils::IsContainerForFontSizeInflation(this)) {
inflation =
nsLayoutUtils::FontSizeInflationFor(this, GetContentRect().width);
} else {
const nsHTMLReflowState *outerReflowState = aState.OuterReflowState();
NS_ASSERTION(outerReflowState || !mParent || mParent->IsBoxFrame() ||
!(mParent->GetStateBits() & NS_FRAME_IN_REFLOW),
"when a text control is reflowed by one of its ancestors "
"and its parent is non-XUL, we should have the outer "
"reflow state in the box layout state");
if (outerReflowState && outerReflowState->frame == this) {
inflation = nsLayoutUtils::FontSizeInflationFor(*outerReflowState);
} else {
inflation = nsLayoutUtils::FontSizeInflationInner(this,
nsLayoutUtils::InflationMinFontSizeFor(mParent));
}
}
float inflation =
nsLayoutUtils::FontSizeInflationFor(this, nsLayoutUtils::eInReflow);
// First calculate the ascent wrt the client rect
nsRect clientRect;