Replace AutoMaybeNullInflationContainer with AutoMaybeDisableInflationForShrinkWrap since the concept of the pres context's current inflation container will be going away. (Bug 747720, patch 2) r=roc
This commit is contained in:
@@ -2349,7 +2349,7 @@ GetIntrinsicCoord(const nsStyleCoord& aStyle,
|
||||
|
||||
// If aFrame is a container for font size inflation, then shrink
|
||||
// wrapping inside of it should not apply font size inflation.
|
||||
AutoMaybeNullInflationContainer an(aFrame);
|
||||
AutoMaybeDisableFontInflation an(aFrame);
|
||||
|
||||
if (val == NS_STYLE_WIDTH_MAX_CONTENT)
|
||||
aResult = aFrame->GetPrefWidth(aRenderingContext);
|
||||
@@ -2381,7 +2381,7 @@ nsLayoutUtils::IntrinsicForContainer(nsRenderingContext *aRenderingContext,
|
||||
|
||||
// If aFrame is a container for font size inflation, then shrink
|
||||
// wrapping inside of it should not apply font size inflation.
|
||||
AutoMaybeNullInflationContainer an(aFrame);
|
||||
AutoMaybeDisableFontInflation an(aFrame);
|
||||
|
||||
nsIFrame::IntrinsicWidthOffsetData offsets =
|
||||
aFrame->IntrinsicWidthOffsets(aRenderingContext);
|
||||
@@ -2640,7 +2640,7 @@ nsLayoutUtils::ComputeWidthValue(
|
||||
} else if (eStyleUnit_Enumerated == aCoord.GetUnit()) {
|
||||
// If aFrame is a container for font size inflation, then shrink
|
||||
// wrapping inside of it should not apply font size inflation.
|
||||
AutoMaybeNullInflationContainer an(aFrame);
|
||||
AutoMaybeDisableFontInflation an(aFrame);
|
||||
|
||||
PRInt32 val = aCoord.GetIntValue();
|
||||
switch (val) {
|
||||
@@ -4815,12 +4815,13 @@ nsLayoutUtils::InflationMinFontSizeFor(const nsIFrame *aFrame,
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!FontSizeInflationEnabled(aFrame->PresContext())) {
|
||||
nsPresContext *presContext = aFrame->PresContext();
|
||||
if (!FontSizeInflationEnabled(presContext) ||
|
||||
presContext->mInflationDisabledForShrinkWrap) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (aWidthDetermination == eInReflow) {
|
||||
nsPresContext *presContext = aFrame->PresContext();
|
||||
nsIFrame *container = presContext->mCurrentInflationContainer;
|
||||
if (!container || !ShouldInflateFontsForContainer(container)) {
|
||||
return 0;
|
||||
|
||||
@@ -1695,29 +1695,33 @@ namespace mozilla {
|
||||
* set the current inflation container on the pres context to null
|
||||
* (and then, in its destructor, restore the old value).
|
||||
*/
|
||||
class AutoMaybeNullInflationContainer {
|
||||
class AutoMaybeDisableFontInflation {
|
||||
public:
|
||||
AutoMaybeNullInflationContainer(nsIFrame *aFrame)
|
||||
AutoMaybeDisableFontInflation(nsIFrame *aFrame)
|
||||
{
|
||||
// FIXME: Now that inflation calculations are based on the flow
|
||||
// root's NCA's (nearest common ancestor of its inflatable
|
||||
// descendants) width, we could probably disable inflation in
|
||||
// fewer cases than we currently do.
|
||||
if (nsLayoutUtils::IsContainerForFontSizeInflation(aFrame)) {
|
||||
mPresContext = aFrame->PresContext();
|
||||
mOldValue = mPresContext->mCurrentInflationContainer;
|
||||
mPresContext->mCurrentInflationContainer = nsnull;
|
||||
mOldValue = mPresContext->mInflationDisabledForShrinkWrap;
|
||||
mPresContext->mInflationDisabledForShrinkWrap = true;
|
||||
} else {
|
||||
// indicate we have nothing to restore
|
||||
mPresContext = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
~AutoMaybeNullInflationContainer()
|
||||
~AutoMaybeDisableFontInflation()
|
||||
{
|
||||
if (mPresContext) {
|
||||
mPresContext->mCurrentInflationContainer = mOldValue;
|
||||
mPresContext->mInflationDisabledForShrinkWrap = mOldValue;
|
||||
}
|
||||
}
|
||||
private:
|
||||
nsPresContext *mPresContext;
|
||||
nsIFrame *mOldValue;
|
||||
bool mOldValue;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1141,6 +1141,10 @@ public:
|
||||
// width, which is not yet set on its rect.
|
||||
nscoord mCurrentInflationContainerWidth;
|
||||
|
||||
// Should we disable font size inflation because we're inside of
|
||||
// shrink-wrapping calculations on an inflation container?
|
||||
bool mInflationDisabledForShrinkWrap;
|
||||
|
||||
protected:
|
||||
|
||||
nsRefPtrHashtable<nsPtrHashKey<nsIFrame>, nsImageLoader>
|
||||
|
||||
@@ -411,7 +411,7 @@ nsFieldSetFrame::ComputeSize(nsRenderingContext *aRenderingContext,
|
||||
|
||||
// If we're a container for font size inflation, then shrink
|
||||
// wrapping inside of us should not apply font size inflation.
|
||||
AutoMaybeNullInflationContainer an(this);
|
||||
AutoMaybeDisableFontInflation an(this);
|
||||
|
||||
nscoord minWidth = GetMinWidth(aRenderingContext);
|
||||
if (minWidth > result.width)
|
||||
|
||||
@@ -582,7 +582,7 @@ FloatMarginWidth(const nsHTMLReflowState& aCBReflowState,
|
||||
nsIFrame *aFloat,
|
||||
const nsCSSOffsetState& aFloatOffsetState)
|
||||
{
|
||||
AutoMaybeNullInflationContainer an(aFloat);
|
||||
AutoMaybeDisableFontInflation an(aFloat);
|
||||
return aFloat->ComputeSize(
|
||||
aCBReflowState.rendContext,
|
||||
nsSize(aCBReflowState.ComputedWidth(),
|
||||
|
||||
@@ -3953,7 +3953,7 @@ nsFrame::ShrinkWidthToFit(nsRenderingContext *aRenderingContext,
|
||||
{
|
||||
// If we're a container for font size inflation, then shrink
|
||||
// wrapping inside of us should not apply font size inflation.
|
||||
AutoMaybeNullInflationContainer an(this);
|
||||
AutoMaybeDisableFontInflation an(this);
|
||||
|
||||
nscoord result;
|
||||
nscoord minWidth = GetMinWidth(aRenderingContext);
|
||||
@@ -7412,7 +7412,7 @@ nsFrame::RefreshSizeCache(nsBoxLayoutState& aState)
|
||||
{
|
||||
// If we're a container for font size inflation, then shrink
|
||||
// wrapping inside of us should not apply font size inflation.
|
||||
AutoMaybeNullInflationContainer an(this);
|
||||
AutoMaybeDisableFontInflation an(this);
|
||||
|
||||
metrics->mBlockPrefSize.width =
|
||||
GetPrefWidth(rendContext) + bp.LeftRight();
|
||||
|
||||
@@ -1283,7 +1283,7 @@ nsHTMLReflowState::InitAbsoluteConstraints(nsPresContext* aPresContext,
|
||||
}
|
||||
|
||||
{
|
||||
AutoMaybeNullInflationContainer an(frame);
|
||||
AutoMaybeDisableFontInflation an(frame);
|
||||
|
||||
nsSize size =
|
||||
frame->ComputeSize(rendContext,
|
||||
@@ -1905,7 +1905,7 @@ nsHTMLReflowState::InitConstraints(nsPresContext* aPresContext,
|
||||
InitAbsoluteConstraints(aPresContext, cbrs, aContainingBlockWidth,
|
||||
aContainingBlockHeight, aFrameType);
|
||||
} else {
|
||||
AutoMaybeNullInflationContainer an(frame);
|
||||
AutoMaybeDisableFontInflation an(frame);
|
||||
|
||||
bool isBlock = NS_CSS_FRAME_TYPE_BLOCK == NS_FRAME_GET_TYPE(mFrameType);
|
||||
PRUint32 computeSizeFlags = isBlock ? 0 : nsIFrame::eShrinkWrap;
|
||||
|
||||
@@ -115,7 +115,7 @@ GetWidthInfo(nsRenderingContext *aRenderingContext,
|
||||
if (aIsCell) {
|
||||
// If aFrame is a container for font size inflation, then shrink
|
||||
// wrapping inside of it should not apply font size inflation.
|
||||
AutoMaybeNullInflationContainer an(aFrame);
|
||||
AutoMaybeDisableFontInflation an(aFrame);
|
||||
|
||||
minCoord = aFrame->GetMinWidth(aRenderingContext);
|
||||
prefCoord = aFrame->GetPrefWidth(aRenderingContext);
|
||||
|
||||
@@ -1514,7 +1514,7 @@ nsTableFrame::ComputeSize(nsRenderingContext *aRenderingContext,
|
||||
|
||||
// If we're a container for font size inflation, then shrink
|
||||
// wrapping inside of us should not apply font size inflation.
|
||||
AutoMaybeNullInflationContainer an(this);
|
||||
AutoMaybeDisableFontInflation an(this);
|
||||
|
||||
// Tables never shrink below their min width.
|
||||
nscoord minWidth = GetMinWidth(aRenderingContext);
|
||||
@@ -1530,7 +1530,7 @@ nsTableFrame::TableShrinkWidthToFit(nsRenderingContext *aRenderingContext,
|
||||
{
|
||||
// If we're a container for font size inflation, then shrink
|
||||
// wrapping inside of us should not apply font size inflation.
|
||||
AutoMaybeNullInflationContainer an(this);
|
||||
AutoMaybeDisableFontInflation an(this);
|
||||
|
||||
nscoord result;
|
||||
nscoord minWidth = GetMinWidth(aRenderingContext);
|
||||
|
||||
@@ -103,7 +103,7 @@ nsTableCaptionFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
|
||||
|
||||
// If we're a container for font size inflation, then shrink
|
||||
// wrapping inside of us should not apply font size inflation.
|
||||
AutoMaybeNullInflationContainer an(this);
|
||||
AutoMaybeDisableFontInflation an(this);
|
||||
|
||||
PRUint8 captionSide = GetStyleTableBorder()->mCaptionSide;
|
||||
if (captionSide == NS_STYLE_CAPTION_SIDE_LEFT ||
|
||||
@@ -533,7 +533,7 @@ ChildShrinkWrapWidth(nsRenderingContext *aRenderingContext,
|
||||
nsSize aCBSize, nscoord aAvailableWidth,
|
||||
nscoord *aMarginResult = nsnull)
|
||||
{
|
||||
AutoMaybeNullInflationContainer an(aChildFrame);
|
||||
AutoMaybeDisableFontInflation an(aChildFrame);
|
||||
|
||||
nsCSSOffsetState offsets(aChildFrame, aRenderingContext, aCBSize.width);
|
||||
nsSize size = aChildFrame->ComputeSize(aRenderingContext, aCBSize,
|
||||
|
||||
Reference in New Issue
Block a user