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