Bug 763689 patch 3: Support min-height:auto in computed style, and add special cases as necessary wherever it's read. r=dbaron

This commit is contained in:
Daniel Holbert 2012-09-04 16:26:11 -07:00
Родитель bb17bc6aff
Коммит c62fdc18d3
8 изменённых файлов: 39 добавлений и 19 удалений

Просмотреть файл

@ -45,7 +45,7 @@ asserts(6-12) load 265986-1.html # Bug 512405
load 265999-1.html
load 266222-1.html
asserts(3-7) load 266360-1.html # bug 575011 / bug 576358
asserts(3) load 266445-1.html # Bug 575011
asserts(4) load 266445-1.html # Bug 575011
load 268157-1.html
load 269566-1.html
load 272647-1.html

Просмотреть файл

@ -2389,7 +2389,8 @@ GetPercentHeight(const nsStyleCoord& aStyle,
if (minh > h)
h = minh;
} else {
NS_ASSERTION(pos->mMinHeight.HasPercent(),
NS_ASSERTION(pos->mMinHeight.HasPercent() ||
pos->mMinHeight.GetUnit() == eStyleUnit_Auto,
"unknown min-height unit");
}
@ -2540,12 +2541,18 @@ nsLayoutUtils::IntrinsicForContainer(nsRenderingContext *aRenderingContext,
// Handle elements with an intrinsic ratio (or size) and a specified
// 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 &styleMinHeight = stylePos->mMinHeight;
const nsStyleCoord &styleMaxHeight = stylePos->mMaxHeight;
if (styleHeight.GetUnit() != eStyleUnit_Auto ||
!(styleMinHeight.GetUnit() == eStyleUnit_Coord &&
styleMinHeight.GetCoordValue() == 0) ||
!(styleMinHeight.GetUnit() == eStyleUnit_Auto ||
(styleMinHeight.GetUnit() == eStyleUnit_Coord &&
styleMinHeight.GetCoordValue() == 0)) ||
styleMaxHeight.GetUnit() != eStyleUnit_None) {
nsSize ratio = aFrame->GetIntrinsicRatio();

Просмотреть файл

@ -14,7 +14,7 @@ load 310556-1.xhtml
load 322780-1.xul
load 323381-1.html
load 323381-2.html
asserts-if(gtk2Widget,13) load 323386-1.html # Bug 575011
asserts-if(gtk2Widget,12-13) load 323386-1.html # Bug 575011
load 323389-1.html
load 323389-2.html
load 323493-1.html
@ -293,7 +293,7 @@ load 495875-1.html
load 495875-2.html
load 499862-1.html
load 499857-1.html
asserts(10-90) asserts-if(winWidget,3-108) load 499885-1.xhtml # nscoord_MAX assertions (bug 575011), plus bug 570436 on some versions of windows
asserts(4-90) asserts-if(winWidget,3-108) load 499885-1.xhtml # nscoord_MAX assertions (bug 575011), plus bug 570436 on some versions of windows
load 501535-1.html
load 503961-1.xhtml
load 503961-2.html

Просмотреть файл

@ -2487,8 +2487,13 @@ nsHTMLReflowState::ComputeMinMaxValues(nscoord aContainingBlockWidth,
// depends on the content height. Treat them like 'auto'
// Likewise, check for calc() on internal table elements; calc() on
// such elements is unsupported.
// 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;
if ((NS_AUTOHEIGHT == aContainingBlockHeight &&
if (eStyleUnit_Auto == minHeight.GetUnit() ||
(NS_AUTOHEIGHT == aContainingBlockHeight &&
minHeight.HasPercent()) ||
(mFrameType == NS_CSS_FRAME_TYPE_INTERNAL_TABLE &&
minHeight.IsCalcUnit())) {

Просмотреть файл

@ -3352,7 +3352,17 @@ nsIDOMCSSValue*
nsComputedDOMStyle::DoGetMinHeight()
{
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
SetValueToCoord(val, GetStylePosition()->mMinHeight, true,
nsStyleCoord minHeight = GetStylePosition()->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);
return val;
}

Просмотреть файл

@ -6433,11 +6433,6 @@ nsRuleNode::ComputePositionData(void* aStartStruct,
SETCOORD_LPOH | SETCOORD_INITIAL_NONE | SETCOORD_STORE_CALC,
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
SetDiscrete(*aRuleData->ValueForBoxSizing(),
pos->mBoxSizing, canStoreInRuleTree,

Просмотреть файл

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

Просмотреть файл

@ -1142,7 +1142,13 @@ struct nsStylePosition {
// FIXME: We should probably change the assumption to be the other way
// around.
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
{ return HeightCoordDependsOnContainer(mMinHeight); }
bool MaxHeightDependsOnContainer() const
@ -1156,10 +1162,7 @@ struct nsStylePosition {
private:
static bool WidthCoordDependsOnContainer(const nsStyleCoord &aCoord);
static bool HeightCoordDependsOnContainer(const nsStyleCoord &aCoord)
{
return aCoord.GetUnit() == eStyleUnit_Auto || // CSS 2.1, 10.6.4, item (5)
aCoord.HasPercent();
}
{ return aCoord.HasPercent(); }
};
struct nsStyleTextOverflowSide {