Bug 848539 part 5: Back out 6bb37077d615, bug 763689 part 2 (style-system handling for min-width:auto). r=dbaron

This commit is contained in:
Daniel Holbert 2013-03-27 23:33:19 -07:00
parent 69a1c9d235
commit ad0dde7ba7
9 changed files with 24 additions and 68 deletions

View File

@ -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

View File

@ -2698,19 +2698,7 @@ nsLayoutUtils::IntrinsicForContainer(nsRenderingContext *aRenderingContext,
nscoord maxw;
bool haveFixedMaxWidth = GetAbsoluteCoord(styleMaxWidth, maxw);
nscoord minw;
// Treat "min-width: auto" as 0.
bool haveFixedMinWidth;
if (eStyleUnit_Auto == styleMinWidth.GetUnit()) {
// NOTE: Technically, "auto" is supposed to behave like "min-content" on
// flex items. However, we don't need to worry about that here, because
// flex items' min-sizes are intentionally ignored until the flex
// container explicitly considers them during space distribution.
minw = 0;
haveFixedMinWidth = true;
} else {
haveFixedMinWidth = GetAbsoluteCoord(styleMinWidth, minw);
}
bool haveFixedMinWidth = GetAbsoluteCoord(styleMinWidth, minw);
// If we have a specified width (or a specified 'min-width' greater
// than the specified 'max-width', which works out to the same thing),
@ -3123,23 +3111,20 @@ nsLayoutUtils::ComputeSizeWithIntrinsicDimensions(
aFrame, aCBSize.width, boxSizingAdjust.width,
boxSizingToMarginEdgeWidth, stylePos->mMaxWidth);
} else {
// NOTE: Flex items ignore their min & max sizing properties in their
// flex container's main-axis. (Those properties get applied later in
// the flexbox algorithm.)
maxWidth = nscoord_MAX;
}
// NOTE: Flex items ignore their min & max sizing properties in their
// flex container's main-axis. (Those properties get applied later in
// the flexbox algorithm.)
if (stylePos->mMinWidth.GetUnit() != eStyleUnit_Auto &&
!(isFlexItem && isHorizontalFlexItem)) {
if (!(isFlexItem && isHorizontalFlexItem)) {
minWidth = nsLayoutUtils::ComputeWidthValue(aRenderingContext,
aFrame, aCBSize.width, boxSizingAdjust.width,
boxSizingToMarginEdgeWidth, stylePos->mMinWidth);
} else {
// Treat "min-width: auto" as 0.
// NOTE: Technically, "auto" is supposed to behave like "min-content" on
// flex items. However, we don't need to worry about that here, because
// flex items' min-sizes are intentionally ignored until the flex
// container explicitly considers them during space distribution.
// NOTE: Flex items ignore their min & max sizing properties in their
// flex container's main-axis. (Those properties get applied later in
// the flexbox algorithm.)
minWidth = 0;
}

View File

@ -4010,18 +4010,12 @@ nsFrame::ComputeSize(nsRenderingContext *aRenderingContext,
}
nscoord minWidth;
if (stylePos->mMinWidth.GetUnit() != eStyleUnit_Auto &&
!(isFlexItem && isHorizontalFlexItem)) {
if (!(isFlexItem && isHorizontalFlexItem)) {
minWidth =
nsLayoutUtils::ComputeWidthValue(aRenderingContext, this,
aCBSize.width, boxSizingAdjust.width, boxSizingToMarginEdgeWidth,
stylePos->mMinWidth);
} else {
// Treat "min-width: auto" as 0.
// NOTE: Technically, "auto" is supposed to behave like "min-content" on
// flex items. However, we don't need to worry about that here, because
// flex items' min-sizes are intentionally ignored until the flex
// container explicitly considers them during space distribution.
minWidth = 0;
}
result.width = std::max(minWidth, result.width);

View File

@ -2505,15 +2505,9 @@ nsHTMLReflowState::ComputeMinMaxValues(nscoord aContainingBlockWidth,
nscoord aContainingBlockHeight,
const nsHTMLReflowState* aContainingBlockRS)
{
// Handle "min-width: auto"
if (eStyleUnit_Auto == mStylePosition->mMinWidth.GetUnit()) {
// XXXdholbert For flex items, this needs to behave like -moz-min-content.
mComputedMinWidth = 0;
} else {
mComputedMinWidth = ComputeWidthValue(aContainingBlockWidth,
mStylePosition->mBoxSizing,
mStylePosition->mMinWidth);
}
mComputedMinWidth = ComputeWidthValue(aContainingBlockWidth,
mStylePosition->mBoxSizing,
mStylePosition->mMinWidth);
if (eStyleUnit_None == mStylePosition->mMaxWidth.GetUnit()) {
// Specified value of 'none'

View File

@ -20,7 +20,7 @@
== 10036-1.html 10036-1-ref.html
skip-if(!cocoaWidget) HTTP(..) == 10209-1.html 10209-ref.html # Bug 667079
HTTP(..) == 10209-2.html 10209-ref.html
asserts(2) skip-if(!cocoaWidget) HTTP(..) == 10209-3.html 10209-3-ref.html # Assertions: bug 666606, skip because of bug 667079
asserts(4) skip-if(!cocoaWidget) HTTP(..) == 10209-3.html 10209-3-ref.html # Assertions: bug 666606, skip because of bug 667079
== 18217-basic-1.html 18217-basic-1-ref.html
== 18217-basic-2a.html 18217-basic-2-ref.html
== 18217-basic-2b.html 18217-basic-2-ref.html

View File

@ -3418,17 +3418,7 @@ CSSValue*
nsComputedDOMStyle::DoGetMinWidth()
{
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
nsStyleCoord minWidth = StylePosition()->mMinWidth;
if (eStyleUnit_Auto == minWidth.GetUnit()) {
// In non-flexbox contexts, "min-width: auto" means "min-width: 0".
// XXXdholbert For flex items, we should set |minWidth| to the
// -moz-min-content keyword, instead of 0.
minWidth.SetCoordValue(0);
}
SetValueToCoord(val, minWidth, true,
SetValueToCoord(val, StylePosition()->mMinWidth, true,
&nsComputedDOMStyle::GetCBContentWidth,
nsCSSProps::kWidthKTable);
return val;

View File

@ -6493,7 +6493,11 @@ nsRuleNode::ComputePositionData(void* aStartStruct,
SETCOORD_LPOH | SETCOORD_INITIAL_NONE | SETCOORD_STORE_CALC,
aContext, mPresContext, canStoreInRuleTree);
// Make 'auto' values for min-height compute to 0
// Handle 'auto' values for min-width / min-height
if (pos->mMinWidth.GetUnit() == eStyleUnit_Auto) {
pos->mMinWidth.SetCoordValue(0);
}
if (pos->mMinHeight.GetUnit() == eStyleUnit_Auto) {
pos->mMinHeight.SetCoordValue(0);
}

View File

@ -1077,7 +1077,7 @@ nsStylePosition::nsStylePosition(void)
mOffset.SetRight(autoCoord);
mOffset.SetBottom(autoCoord);
mWidth.SetAutoValue();
mMinWidth.SetAutoValue();
mMinWidth.SetCoordValue(0);
mMaxWidth.SetNoneValue();
mHeight.SetAutoValue();
mMinHeight.SetCoordValue(0);
@ -1189,7 +1189,8 @@ nsChangeHint nsStylePosition::CalcDifference(const nsStylePosition& aOther) cons
/* static */ bool
nsStylePosition::WidthCoordDependsOnContainer(const nsStyleCoord &aCoord)
{
return aCoord.HasPercent() ||
return aCoord.GetUnit() == eStyleUnit_Auto ||
aCoord.HasPercent() ||
(aCoord.GetUnit() == eStyleUnit_Enumerated &&
(aCoord.GetIntValue() == NS_STYLE_WIDTH_FIT_CONTENT ||
aCoord.GetIntValue() == NS_STYLE_WIDTH_AVAILABLE));

View File

@ -1107,19 +1107,7 @@ struct nsStylePosition {
nsStyleCoord mZIndex; // [reset] integer, auto
bool WidthDependsOnContainer() const
{
return mWidth.GetUnit() == eStyleUnit_Auto ||
WidthCoordDependsOnContainer(mWidth);
}
// NOTE: For a flex item, "min-width:auto" is supposed to behave like
// "min-content", which does depend on the container, so you might think we'd
// need a special case for "flex item && min-width:auto" here. However,
// we don't actually need that special-case code, because flex items are
// explicitly supposed to *ignore* their min-width (i.e. behave like it's 0)
// until the flex container explicitly considers it. So -- since the flex
// container doesn't rely on this method, we don't need to worry about
// special behavior for flex items' "min-width:auto" values here.
{ return WidthCoordDependsOnContainer(mWidth); }
bool MinWidthDependsOnContainer() const
{ return WidthCoordDependsOnContainer(mMinWidth); }
bool MaxWidthDependsOnContainer() const