Bug 984711 part 4: Add back handling for nsStylePosition::mMinHeight having "eStyleUnit_Auto" in style system & general layout code. (no review; just an unbitrotted backout)

This reverts changeset 5db313632268 from bug 848539.
This commit is contained in:
Daniel Holbert 2014-07-22 08:24:35 -07:00
parent 7d742838e2
commit a4bd0b74e2
6 changed files with 36 additions and 16 deletions

View File

@ -3591,7 +3591,8 @@ GetPercentHeight(const nsStyleCoord& aStyle,
if (minh > h) if (minh > h)
h = minh; h = minh;
} else { } else {
NS_ASSERTION(pos->mMinHeight.HasPercent(), NS_ASSERTION(pos->mMinHeight.HasPercent() ||
pos->mMinHeight.GetUnit() == eStyleUnit_Auto,
"unknown min-height unit"); "unknown min-height unit");
} }
@ -3752,12 +3753,18 @@ nsLayoutUtils::IntrinsicForContainer(nsRenderingContext *aRenderingContext,
// Handle elements with an intrinsic ratio (or size) and a specified // Handle elements with an intrinsic ratio (or size) and a specified
// height, min-height, or max-height. // height, min-height, or max-height.
// NOTE: We treat "min-height:auto" as "0" for the purpose of this code,
// since that's what it means in all cases except for on flex items -- and
// even there, we're supposed to ignore it (i.e. treat it as 0) until the
// flex container explicitly considers it.
const nsStyleCoord &styleHeight = stylePos->mHeight; const nsStyleCoord &styleHeight = stylePos->mHeight;
const nsStyleCoord &styleMinHeight = stylePos->mMinHeight; const nsStyleCoord &styleMinHeight = stylePos->mMinHeight;
const nsStyleCoord &styleMaxHeight = stylePos->mMaxHeight; const nsStyleCoord &styleMaxHeight = stylePos->mMaxHeight;
if (styleHeight.GetUnit() != eStyleUnit_Auto || if (styleHeight.GetUnit() != eStyleUnit_Auto ||
!(styleMinHeight.GetUnit() == eStyleUnit_Coord && !(styleMinHeight.GetUnit() == eStyleUnit_Auto ||
styleMinHeight.GetCoordValue() == 0) || (styleMinHeight.GetUnit() == eStyleUnit_Coord &&
styleMinHeight.GetCoordValue() == 0)) ||
styleMaxHeight.GetUnit() != eStyleUnit_None) { styleMaxHeight.GetUnit() != eStyleUnit_None) {
nsSize ratio = aFrame->GetIntrinsicRatio(); nsSize ratio = aFrame->GetIntrinsicRatio();

View File

@ -2627,8 +2627,13 @@ nsHTMLReflowState::ComputeMinMaxValues(nscoord aContainingBlockWidth,
// Likewise, if we're a child of a flex container who's measuring our // Likewise, if we're a child of a flex container who's measuring our
// intrinsic height, then we want to disregard our min-height. // intrinsic height, then we want to disregard our min-height.
// NOTE: We treat "min-height:auto" as "0" for the purpose of this code,
// since that's what it means in all cases except for on flex items -- and
// even there, we're supposed to ignore it (i.e. treat it as 0) until the
// flex container explicitly considers it.
const nsStyleCoord &minHeight = mStylePosition->mMinHeight; const nsStyleCoord &minHeight = mStylePosition->mMinHeight;
if ((NS_AUTOHEIGHT == aContainingBlockHeight && if (eStyleUnit_Auto == minHeight.GetUnit() ||
(NS_AUTOHEIGHT == aContainingBlockHeight &&
minHeight.HasPercent()) || minHeight.HasPercent()) ||
(mFrameType == NS_CSS_FRAME_TYPE_INTERNAL_TABLE && (mFrameType == NS_CSS_FRAME_TYPE_INTERNAL_TABLE &&
minHeight.IsCalcUnit() && minHeight.CalcHasPercent()) || minHeight.IsCalcUnit() && minHeight.CalcHasPercent()) ||

View File

@ -4103,7 +4103,17 @@ CSSValue*
nsComputedDOMStyle::DoGetMinHeight() nsComputedDOMStyle::DoGetMinHeight()
{ {
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue; nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
SetValueToCoord(val, StylePosition()->mMinHeight, true, nsStyleCoord minHeight = StylePosition()->mMinHeight;
if (eStyleUnit_Auto == minHeight.GetUnit()) {
// In non-flexbox contexts, "min-height: auto" means "min-height: 0"
// XXXdholbert For flex items, we should set |minHeight| to the
// -moz-min-content keyword, instead of 0, once we support -moz-min-content
// as a height value.
minHeight.SetCoordValue(0);
}
SetValueToCoord(val, minHeight, true,
&nsComputedDOMStyle::GetCBContentHeight); &nsComputedDOMStyle::GetCBContentHeight);
return val; return val;
} }

View File

@ -7453,11 +7453,6 @@ nsRuleNode::ComputePositionData(void* aStartStruct,
SETCOORD_UNSET_INITIAL, SETCOORD_UNSET_INITIAL,
aContext, mPresContext, canStoreInRuleTree); aContext, mPresContext, canStoreInRuleTree);
// Make 'auto' values for min-height compute to 0
if (pos->mMinHeight.GetUnit() == eStyleUnit_Auto) {
pos->mMinHeight.SetCoordValue(0);
}
// box-sizing: enum, inherit, initial // box-sizing: enum, inherit, initial
SetDiscrete(*aRuleData->ValueForBoxSizing(), SetDiscrete(*aRuleData->ValueForBoxSizing(),
pos->mBoxSizing, canStoreInRuleTree, pos->mBoxSizing, canStoreInRuleTree,

View File

@ -1234,7 +1234,7 @@ nsStylePosition::nsStylePosition(void)
mMinWidth.SetAutoValue(); mMinWidth.SetAutoValue();
mMaxWidth.SetNoneValue(); mMaxWidth.SetNoneValue();
mHeight.SetAutoValue(); mHeight.SetAutoValue();
mMinHeight.SetCoordValue(0); mMinHeight.SetAutoValue();
mMaxHeight.SetNoneValue(); mMaxHeight.SetNoneValue();
mFlexBasis.SetAutoValue(); mFlexBasis.SetAutoValue();

View File

@ -1381,7 +1381,13 @@ struct nsStylePosition {
// FIXME: We should probably change the assumption to be the other way // FIXME: We should probably change the assumption to be the other way
// around. // around.
bool HeightDependsOnContainer() const bool HeightDependsOnContainer() const
{ return HeightCoordDependsOnContainer(mHeight); } {
return mHeight.GetUnit() == eStyleUnit_Auto || // CSS 2.1, 10.6.4, item (5)
HeightCoordDependsOnContainer(mHeight);
}
// NOTE: The comment above MinWidthDependsOnContainer about flex items
// applies here, too.
bool MinHeightDependsOnContainer() const bool MinHeightDependsOnContainer() const
{ return HeightCoordDependsOnContainer(mMinHeight); } { return HeightCoordDependsOnContainer(mMinHeight); }
bool MaxHeightDependsOnContainer() const bool MaxHeightDependsOnContainer() const
@ -1395,10 +1401,7 @@ struct nsStylePosition {
private: private:
static bool WidthCoordDependsOnContainer(const nsStyleCoord &aCoord); static bool WidthCoordDependsOnContainer(const nsStyleCoord &aCoord);
static bool HeightCoordDependsOnContainer(const nsStyleCoord &aCoord) static bool HeightCoordDependsOnContainer(const nsStyleCoord &aCoord)
{ { return aCoord.HasPercent(); }
return aCoord.GetUnit() == eStyleUnit_Auto || // CSS 2.1, 10.6.4, item (5)
aCoord.HasPercent();
}
}; };
struct nsStyleTextOverflowSide { struct nsStyleTextOverflowSide {