bug 1031241 pt 4 - Rename the {MIN,PREF}_WIDTH constants used to identify the type of intrinsic inline-size. r=smontagu

This commit is contained in:
Jonathan Kew 2014-07-24 18:03:26 +01:00
parent 4491d88818
commit 89af1f05c5
21 changed files with 55 additions and 55 deletions

View File

@ -3572,7 +3572,7 @@ static nscoord AddPercents(nsLayoutUtils::IntrinsicISizeType aType,
nscoord aCurrent, float aPercent)
{
nscoord result = aCurrent;
if (aPercent > 0.0f && aType == nsLayoutUtils::PREF_WIDTH) {
if (aPercent > 0.0f && aType == nsLayoutUtils::PREF_ISIZE) {
// XXX Should we also consider percentages for min widths, up to a
// limit?
if (aPercent >= 1.0f)
@ -3759,13 +3759,13 @@ nsLayoutUtils::IntrinsicForContainer(nsRenderingContext *aRenderingContext,
uint32_t aFlags)
{
NS_PRECONDITION(aFrame, "null frame");
NS_PRECONDITION(aType == MIN_WIDTH || aType == PREF_WIDTH, "bad type");
NS_PRECONDITION(aType == MIN_ISIZE || aType == PREF_ISIZE, "bad type");
#ifdef DEBUG_INTRINSIC_WIDTH
nsFrame::IndentBy(stderr, gNoiseIndent);
static_cast<nsFrame*>(aFrame)->ListTag(stderr);
printf_stderr(" %s intrinsic width for container:\n",
aType == MIN_WIDTH ? "min" : "pref");
aType == MIN_ISIZE ? "min" : "pref");
#endif
// If aFrame is a container for font size inflation, then shrink
@ -3828,7 +3828,7 @@ nsLayoutUtils::IntrinsicForContainer(nsRenderingContext *aRenderingContext,
#ifdef DEBUG_INTRINSIC_WIDTH
++gNoiseIndent;
#endif
if (aType == MIN_WIDTH)
if (aType == MIN_ISIZE)
result = aFrame->GetMinISize(aRenderingContext);
else
result = aFrame->GetPrefISize(aRenderingContext);
@ -3837,7 +3837,7 @@ nsLayoutUtils::IntrinsicForContainer(nsRenderingContext *aRenderingContext,
nsFrame::IndentBy(stderr, gNoiseIndent);
static_cast<nsFrame*>(aFrame)->ListTag(stderr);
printf_stderr(" %s intrinsic width from frame is %d.\n",
aType == MIN_WIDTH ? "min" : "pref", result);
aType == MIN_ISIZE ? "min" : "pref", result);
#endif
// Handle elements with an intrinsic ratio (or size) and a specified
@ -3968,7 +3968,7 @@ nsLayoutUtils::IntrinsicForContainer(nsRenderingContext *aRenderingContext,
PROP_WIDTH, w)) {
result = AddPercents(aType, w + coordOutsideWidth, pctOutsideWidth);
}
else if (aType == MIN_WIDTH &&
else if (aType == MIN_ISIZE &&
// The only cases of coord-percent-calc() units that
// GetAbsoluteCoord didn't handle are percent and calc()s
// containing percent.
@ -4029,7 +4029,7 @@ nsLayoutUtils::IntrinsicForContainer(nsRenderingContext *aRenderingContext,
nsFrame::IndentBy(stderr, gNoiseIndent);
static_cast<nsFrame*>(aFrame)->ListTag(stderr);
printf_stderr(" %s intrinsic width for container is %d twips.\n",
aType == MIN_WIDTH ? "min" : "pref", result);
aType == MIN_ISIZE ? "min" : "pref", result);
#endif
return result;

View File

@ -1170,7 +1170,7 @@ public:
* 'min-width', and 'max-width' properties, and its padding, border,
* and margin.
*/
enum IntrinsicISizeType { MIN_WIDTH, PREF_WIDTH };
enum IntrinsicISizeType { MIN_ISIZE, PREF_ISIZE };
enum {
IGNORE_PADDING = 0x01
};

View File

@ -717,13 +717,13 @@ nsComboboxControlFrame::GetIntrinsicISize(nsRenderingContext* aRenderingContext,
nscoord dropdownContentWidth;
bool isUsingOverlayScrollbars =
LookAndFeel::GetInt(LookAndFeel::eIntID_UseOverlayScrollbars) != 0;
if (aType == nsLayoutUtils::MIN_WIDTH) {
if (aType == nsLayoutUtils::MIN_ISIZE) {
dropdownContentWidth = mDropdownFrame->GetMinISize(aRenderingContext);
if (isUsingOverlayScrollbars) {
dropdownContentWidth += scrollbarWidth;
}
} else {
NS_ASSERTION(aType == nsLayoutUtils::PREF_WIDTH, "Unexpected type");
NS_ASSERTION(aType == nsLayoutUtils::PREF_ISIZE, "Unexpected type");
dropdownContentWidth = mDropdownFrame->GetPrefISize(aRenderingContext);
if (isUsingOverlayScrollbars) {
dropdownContentWidth += scrollbarWidth;
@ -749,7 +749,7 @@ nsComboboxControlFrame::GetMinISize(nsRenderingContext *aRenderingContext)
{
nscoord minWidth;
DISPLAY_MIN_WIDTH(this, minWidth);
minWidth = GetIntrinsicISize(aRenderingContext, nsLayoutUtils::MIN_WIDTH);
minWidth = GetIntrinsicISize(aRenderingContext, nsLayoutUtils::MIN_ISIZE);
return minWidth;
}
@ -758,7 +758,7 @@ nsComboboxControlFrame::GetPrefISize(nsRenderingContext *aRenderingContext)
{
nscoord prefWidth;
DISPLAY_PREF_WIDTH(this, prefWidth);
prefWidth = GetIntrinsicISize(aRenderingContext, nsLayoutUtils::PREF_WIDTH);
prefWidth = GetIntrinsicISize(aRenderingContext, nsLayoutUtils::PREF_ISIZE);
return prefWidth;
}

View File

@ -291,7 +291,7 @@ nsFieldSetFrame::GetMinISize(nsRenderingContext* aRenderingContext)
nscoord result = 0;
DISPLAY_MIN_WIDTH(this, result);
result = GetIntrinsicISize(aRenderingContext, nsLayoutUtils::MIN_WIDTH);
result = GetIntrinsicISize(aRenderingContext, nsLayoutUtils::MIN_ISIZE);
return result;
}
@ -301,7 +301,7 @@ nsFieldSetFrame::GetPrefISize(nsRenderingContext* aRenderingContext)
nscoord result = 0;
DISPLAY_PREF_WIDTH(this, result);
result = GetIntrinsicISize(aRenderingContext, nsLayoutUtils::PREF_WIDTH);
result = GetIntrinsicISize(aRenderingContext, nsLayoutUtils::PREF_ISIZE);
return result;
}
@ -376,13 +376,13 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
NS_ASSERTION(!inner ||
nsLayoutUtils::IntrinsicForContainer(aReflowState.rendContext,
inner,
nsLayoutUtils::MIN_WIDTH) <=
nsLayoutUtils::MIN_ISIZE) <=
innerAvailSize.ISize(innerWM),
"Bogus availSize.ISize; should be bigger");
NS_ASSERTION(!legend ||
nsLayoutUtils::IntrinsicForContainer(aReflowState.rendContext,
legend,
nsLayoutUtils::MIN_WIDTH) <=
nsLayoutUtils::MIN_ISIZE) <=
legendAvailSize.ISize(legendWM),
"Bogus availSize.ISize; should be bigger");

View File

@ -140,7 +140,7 @@ nsHTMLButtonControlFrame::GetMinISize(nsRenderingContext* aRenderingContext)
nsIFrame* kid = mFrames.FirstChild();
result = nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
kid,
nsLayoutUtils::MIN_WIDTH);
nsLayoutUtils::MIN_ISIZE);
result += mRenderer.GetAddedButtonBorderAndPadding().LeftRight();
@ -156,7 +156,7 @@ nsHTMLButtonControlFrame::GetPrefISize(nsRenderingContext* aRenderingContext)
nsIFrame* kid = mFrames.FirstChild();
result = nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
kid,
nsLayoutUtils::PREF_WIDTH);
nsLayoutUtils::PREF_ISIZE);
result += mRenderer.GetAddedButtonBorderAndPadding().LeftRight();
return result;
}

View File

@ -72,7 +72,7 @@ nsNumberControlFrame::GetMinISize(nsRenderingContext* aRenderingContext)
if (kid) { // display:none?
result = nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
kid,
nsLayoutUtils::MIN_WIDTH);
nsLayoutUtils::MIN_ISIZE);
} else {
result = 0;
}
@ -90,7 +90,7 @@ nsNumberControlFrame::GetPrefISize(nsRenderingContext* aRenderingContext)
if (kid) { // display:none?
result = nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
kid,
nsLayoutUtils::PREF_WIDTH);
nsLayoutUtils::PREF_ISIZE);
} else {
result = 0;
}

View File

@ -711,7 +711,7 @@ nsBlockFrame::GetMinISize(nsRenderingContext *aRenderingContext)
if (line->IsBlock()) {
data.ForceBreak(aRenderingContext);
data.currentLine = nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
line->mFirstChild, nsLayoutUtils::MIN_WIDTH);
line->mFirstChild, nsLayoutUtils::MIN_ISIZE);
data.ForceBreak(aRenderingContext);
} else {
if (!curFrame->GetPrevContinuation() &&
@ -796,7 +796,7 @@ nsBlockFrame::GetPrefISize(nsRenderingContext *aRenderingContext)
if (line->IsBlock()) {
data.ForceBreak(aRenderingContext);
data.currentLine = nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
line->mFirstChild, nsLayoutUtils::PREF_WIDTH);
line->mFirstChild, nsLayoutUtils::PREF_ISIZE);
data.ForceBreak(aRenderingContext);
} else {
if (!curFrame->GetPrevContinuation() &&

View File

@ -221,8 +221,8 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame,
// If we did that, then for those frames where the condition below is
// true but nsBlockFrame::BlockCanIntersectFloats is false,
// nsBlockFrame::WidthToClearPastFloats would need to use the
// shrink-wrap formula, max(MIN_WIDTH, min(avail width, PREF_WIDTH))
// rather than just using MIN_WIDTH.
// shrink-wrap formula, max(MIN_ISIZE, min(avail width, PREF_ISIZE))
// rather than just using MIN_ISIZE.
NS_ASSERTION(nsBlockFrame::BlockCanIntersectFloats(aFrame) ==
!aBlockAvoidsFloats,
"unexpected replaced width");

View File

@ -791,8 +791,8 @@ nsContainerFrame::DoInlineIntrinsicISize(nsRenderingContext *aRenderingContext,
if (GetPrevInFlow())
return; // Already added.
NS_PRECONDITION(aType == nsLayoutUtils::MIN_WIDTH ||
aType == nsLayoutUtils::PREF_WIDTH, "bad type");
NS_PRECONDITION(aType == nsLayoutUtils::MIN_ISIZE ||
aType == nsLayoutUtils::PREF_ISIZE, "bad type");
mozilla::css::Side startSide, endSide;
if (StyleVisibility()->mDirection == NS_STYLE_DIRECTION_LTR) {
@ -852,7 +852,7 @@ nsContainerFrame::DoInlineIntrinsicISize(nsRenderingContext *aRenderingContext,
}
for (nsIFrame *kid = nif->mFrames.FirstChild(); kid;
kid = kid->GetNextSibling()) {
if (aType == nsLayoutUtils::MIN_WIDTH)
if (aType == nsLayoutUtils::MIN_ISIZE)
kid->AddInlineMinISize(aRenderingContext,
static_cast<InlineMinISizeData*>(aData));
else

View File

@ -112,7 +112,7 @@ nsFirstLetterFrame::GetChildFrameContainingOffset(int32_t inContentOffset,
nsFirstLetterFrame::AddInlineMinISize(nsRenderingContext *aRenderingContext,
nsIFrame::InlineMinISizeData *aData)
{
DoInlineIntrinsicISize(aRenderingContext, aData, nsLayoutUtils::MIN_WIDTH);
DoInlineIntrinsicISize(aRenderingContext, aData, nsLayoutUtils::MIN_ISIZE);
}
// Needed for non-floating first-letter frames and for the continuations
@ -121,7 +121,7 @@ nsFirstLetterFrame::AddInlineMinISize(nsRenderingContext *aRenderingContext,
nsFirstLetterFrame::AddInlinePrefISize(nsRenderingContext *aRenderingContext,
nsIFrame::InlinePrefISizeData *aData)
{
DoInlineIntrinsicISize(aRenderingContext, aData, nsLayoutUtils::PREF_WIDTH);
DoInlineIntrinsicISize(aRenderingContext, aData, nsLayoutUtils::PREF_ISIZE);
}
// Needed for floating first-letter frames.

View File

@ -3791,7 +3791,7 @@ nsFlexContainerFrame::GetMinISize(nsRenderingContext* aRenderingContext)
for (nsFrameList::Enumerator e(mFrames); !e.AtEnd(); e.Next()) {
nscoord childMinWidth =
nsLayoutUtils::IntrinsicForContainer(aRenderingContext, e.get(),
nsLayoutUtils::MIN_WIDTH);
nsLayoutUtils::MIN_ISIZE);
// For a horizontal single-line flex container, the intrinsic min width is
// the sum of its items' min widths.
// For a vertical flex container, or for a multi-line horizontal flex
@ -3822,7 +3822,7 @@ nsFlexContainerFrame::GetPrefISize(nsRenderingContext* aRenderingContext)
for (nsFrameList::Enumerator e(mFrames); !e.AtEnd(); e.Next()) {
nscoord childPrefWidth =
nsLayoutUtils::IntrinsicForContainer(aRenderingContext, e.get(),
nsLayoutUtils::PREF_WIDTH);
nsLayoutUtils::PREF_ISIZE);
if (IsAxisHorizontal(axisTracker.GetMainAxis())) {
prefWidth += childPrefWidth;
} else {

View File

@ -3828,7 +3828,7 @@ nsFrame::AddInlineMinISize(nsRenderingContext *aRenderingContext,
aData->skipWhitespace = false;
aData->trailingTextFrame = nullptr;
aData->currentLine += nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
this, nsLayoutUtils::MIN_WIDTH);
this, nsLayoutUtils::MIN_ISIZE);
aData->atStartOfLine = false;
if (canBreak)
aData->OptionallyBreak(aRenderingContext);
@ -3841,7 +3841,7 @@ nsFrame::AddInlinePrefISize(nsRenderingContext *aRenderingContext,
aData->trailingWhitespace = 0;
aData->skipWhitespace = false;
nscoord myPref = nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
this, nsLayoutUtils::PREF_WIDTH);
this, nsLayoutUtils::PREF_ISIZE);
aData->currentLine = NSCoordSaturatingAdd(aData->currentLine, myPref);
}

View File

@ -2108,7 +2108,7 @@ nsImageFrame::AddInlineMinISize(nsRenderingContext *aRenderingContext,
aData->skipWhitespace = false;
aData->trailingTextFrame = nullptr;
aData->currentLine += nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
this, nsLayoutUtils::MIN_WIDTH);
this, nsLayoutUtils::MIN_ISIZE);
aData->atStartOfLine = false;
if (canBreak)

View File

@ -213,14 +213,14 @@ nsInlineFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
nsInlineFrame::AddInlineMinISize(nsRenderingContext *aRenderingContext,
nsIFrame::InlineMinISizeData *aData)
{
DoInlineIntrinsicISize(aRenderingContext, aData, nsLayoutUtils::MIN_WIDTH);
DoInlineIntrinsicISize(aRenderingContext, aData, nsLayoutUtils::MIN_ISIZE);
}
/* virtual */ void
nsInlineFrame::AddInlinePrefISize(nsRenderingContext *aRenderingContext,
nsIFrame::InlinePrefISizeData *aData)
{
DoInlineIntrinsicISize(aRenderingContext, aData, nsLayoutUtils::PREF_WIDTH);
DoInlineIntrinsicISize(aRenderingContext, aData, nsLayoutUtils::PREF_ISIZE);
}
/* virtual */ nsSize

View File

@ -71,7 +71,7 @@ nsPlaceholderFrame::AddInlineMinISize(nsRenderingContext* aRenderingContext,
nscoord floatWidth =
nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
mOutOfFlowFrame,
nsLayoutUtils::MIN_WIDTH);
nsLayoutUtils::MIN_ISIZE);
aData->floats.AppendElement(
InlineIntrinsicISizeData::FloatInfo(mOutOfFlowFrame, floatWidth));
}
@ -92,7 +92,7 @@ nsPlaceholderFrame::AddInlinePrefISize(nsRenderingContext* aRenderingContext,
nscoord floatWidth =
nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
mOutOfFlowFrame,
nsLayoutUtils::PREF_WIDTH);
nsLayoutUtils::PREF_ISIZE);
aData->floats.AppendElement(
InlineIntrinsicISizeData::FloatInfo(mOutOfFlowFrame, floatWidth));
}

View File

@ -1006,7 +1006,7 @@ nsMathMLContainerFrame::GetIntrinsicISizeMetrics(nsRenderingContext* aRenderingC
// characters, this is an approximation anyway.
nscoord width =
nsLayoutUtils::IntrinsicForContainer(aRenderingContext, childFrame,
nsLayoutUtils::PREF_WIDTH);
nsLayoutUtils::PREF_ISIZE);
childDesiredSize.Width() = width;
childDesiredSize.mBoundingMetrics.width = width;

View File

@ -578,7 +578,7 @@ nsMathMLmfencedFrame::GetIntrinsicISizeMetrics(nsRenderingContext* aRenderingCon
// margin, so we may end up with too much space, but, with stretchy
// characters, this is an approximation anyway.
width += nsLayoutUtils::IntrinsicForContainer(aRenderingContext, childFrame,
nsLayoutUtils::PREF_WIDTH);
nsLayoutUtils::PREF_ISIZE);
if (i < mSeparatorsCount) {
width +=

View File

@ -367,10 +367,10 @@ nsMathMLmrootFrame::GetIntrinsicISizeMetrics(nsRenderingContext* aRenderingConte
nscoord baseWidth =
nsLayoutUtils::IntrinsicForContainer(aRenderingContext, baseFrame,
nsLayoutUtils::PREF_WIDTH);
nsLayoutUtils::PREF_ISIZE);
nscoord indexWidth =
nsLayoutUtils::IntrinsicForContainer(aRenderingContext, indexFrame,
nsLayoutUtils::PREF_WIDTH);
nsLayoutUtils::PREF_ISIZE);
nscoord sqrWidth = mSqrChar.GetMaxWidth(PresContext(), *aRenderingContext);
nscoord dxSqr;

View File

@ -91,7 +91,7 @@ FixedTableLayoutStrategy::GetMinISize(nsRenderingContext* aRenderingContext)
(styleWidth->GetIntValue() == NS_STYLE_WIDTH_MAX_CONTENT ||
styleWidth->GetIntValue() == NS_STYLE_WIDTH_MIN_CONTENT))) {
nscoord cellWidth = nsLayoutUtils::IntrinsicForContainer(
aRenderingContext, cellFrame, nsLayoutUtils::MIN_WIDTH);
aRenderingContext, cellFrame, nsLayoutUtils::MIN_ISIZE);
if (colSpan > 1) {
// If a column-spanning cell is in the first
// row, split up the space evenly. (XXX This
@ -237,14 +237,14 @@ FixedTableLayoutStrategy::ComputeColumnWidths(const nsHTMLReflowState& aReflowSt
(styleWidth->GetIntValue() == NS_STYLE_WIDTH_MAX_CONTENT ||
styleWidth->GetIntValue() == NS_STYLE_WIDTH_MIN_CONTENT))) {
// XXX This should use real percentage padding
// Note that the difference between MIN_WIDTH and
// PREF_WIDTH shouldn't matter for any of these
// values of styleWidth; use MIN_WIDTH for symmetry
// Note that the difference between MIN_ISIZE and
// PREF_ISIZE shouldn't matter for any of these
// values of styleWidth; use MIN_ISIZE for symmetry
// with GetMinISize above, just in case there is a
// difference.
colWidth = nsLayoutUtils::IntrinsicForContainer(
aReflowState.rendContext,
cellFrame, nsLayoutUtils::MIN_WIDTH);
cellFrame, nsLayoutUtils::MIN_ISIZE);
} else if (styleWidth->GetUnit() == eStyleUnit_Percent) {
// XXX This should use real percentage padding
nsIFrame::IntrinsicISizeOffsetData offsets =

View File

@ -762,7 +762,7 @@ nsTableCellFrame::GetMinISize(nsRenderingContext *aRenderingContext)
nsIFrame *inner = mFrames.FirstChild();
result = nsLayoutUtils::IntrinsicForContainer(aRenderingContext, inner,
nsLayoutUtils::MIN_WIDTH);
nsLayoutUtils::MIN_ISIZE);
return result;
}
@ -774,7 +774,7 @@ nsTableCellFrame::GetPrefISize(nsRenderingContext *aRenderingContext)
nsIFrame *inner = mFrames.FirstChild();
result = nsLayoutUtils::IntrinsicForContainer(aRenderingContext, inner,
nsLayoutUtils::PREF_WIDTH);
nsLayoutUtils::PREF_ISIZE);
return result;
}

View File

@ -397,13 +397,13 @@ GetContainingBlockSize(const nsHTMLReflowState& aOuterRS)
nsTableOuterFrame::GetMinISize(nsRenderingContext *aRenderingContext)
{
nscoord width = nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
InnerTableFrame(), nsLayoutUtils::MIN_WIDTH);
InnerTableFrame(), nsLayoutUtils::MIN_ISIZE);
DISPLAY_MIN_WIDTH(this, width);
if (mCaptionFrames.NotEmpty()) {
nscoord capWidth =
nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
mCaptionFrames.FirstChild(),
nsLayoutUtils::MIN_WIDTH);
nsLayoutUtils::MIN_ISIZE);
if (HasSideCaption()) {
width += capWidth;
} else {
@ -422,7 +422,7 @@ nsTableOuterFrame::GetPrefISize(nsRenderingContext *aRenderingContext)
DISPLAY_PREF_WIDTH(this, maxWidth);
maxWidth = nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
InnerTableFrame(), nsLayoutUtils::PREF_WIDTH);
InnerTableFrame(), nsLayoutUtils::PREF_ISIZE);
if (mCaptionFrames.NotEmpty()) {
uint8_t captionSide = GetCaptionSide();
switch(captionSide) {
@ -432,7 +432,7 @@ nsTableOuterFrame::GetPrefISize(nsRenderingContext *aRenderingContext)
nscoord capMin =
nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
mCaptionFrames.FirstChild(),
nsLayoutUtils::MIN_WIDTH);
nsLayoutUtils::MIN_ISIZE);
maxWidth += capMin;
}
break;
@ -443,12 +443,12 @@ nsTableOuterFrame::GetPrefISize(nsRenderingContext *aRenderingContext)
captionSide == NS_STYLE_CAPTION_SIDE_BOTTOM) {
// Don't let the caption's pref width expand the table's pref
// width.
iwt = nsLayoutUtils::MIN_WIDTH;
iwt = nsLayoutUtils::MIN_ISIZE;
} else {
NS_ASSERTION(captionSide == NS_STYLE_CAPTION_SIDE_TOP_OUTSIDE ||
captionSide == NS_STYLE_CAPTION_SIDE_BOTTOM_OUTSIDE,
"unexpected caption side");
iwt = nsLayoutUtils::PREF_WIDTH;
iwt = nsLayoutUtils::PREF_ISIZE;
}
nscoord capPref =
nsLayoutUtils::IntrinsicForContainer(aRenderingContext,