mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 763689 patch 2: Support min-width:auto in computed style, and add special cases as necessary wherever it's read. r=dbaron
This commit is contained in:
parent
e735cf0a40
commit
cb09d97d7e
@ -45,7 +45,7 @@ asserts(6-12) load 265986-1.html # Bug 512405
|
|||||||
load 265999-1.html
|
load 265999-1.html
|
||||||
load 266222-1.html
|
load 266222-1.html
|
||||||
asserts(3-7) load 266360-1.html # bug 575011 / bug 576358
|
asserts(3-7) load 266360-1.html # bug 575011 / bug 576358
|
||||||
asserts(4) load 266445-1.html # Bug 575011
|
asserts(3) load 266445-1.html # Bug 575011
|
||||||
load 268157-1.html
|
load 268157-1.html
|
||||||
load 269566-1.html
|
load 269566-1.html
|
||||||
load 272647-1.html
|
load 272647-1.html
|
||||||
|
@ -2496,7 +2496,19 @@ nsLayoutUtils::IntrinsicForContainer(nsRenderingContext *aRenderingContext,
|
|||||||
nscoord maxw;
|
nscoord maxw;
|
||||||
bool haveFixedMaxWidth = GetAbsoluteCoord(styleMaxWidth, maxw);
|
bool haveFixedMaxWidth = GetAbsoluteCoord(styleMaxWidth, maxw);
|
||||||
nscoord minw;
|
nscoord minw;
|
||||||
bool haveFixedMinWidth = GetAbsoluteCoord(styleMinWidth, 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);
|
||||||
|
}
|
||||||
|
|
||||||
// If we have a specified width (or a specified 'min-width' greater
|
// If we have a specified width (or a specified 'min-width' greater
|
||||||
// than the specified 'max-width', which works out to the same thing),
|
// than the specified 'max-width', which works out to the same thing),
|
||||||
@ -2836,9 +2848,18 @@ nsLayoutUtils::ComputeSizeWithIntrinsicDimensions(
|
|||||||
maxWidth = nscoord_MAX;
|
maxWidth = nscoord_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
minWidth = nsLayoutUtils::ComputeWidthValue(aRenderingContext,
|
if (stylePos->mMinWidth.GetUnit() != eStyleUnit_Auto) {
|
||||||
aFrame, aCBSize.width, boxSizingAdjust.width,
|
minWidth = nsLayoutUtils::ComputeWidthValue(aRenderingContext,
|
||||||
boxSizingToMarginEdgeWidth, stylePos->mMinWidth);
|
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.
|
||||||
|
minWidth = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!isAutoHeight) {
|
if (!isAutoHeight) {
|
||||||
height = nsLayoutUtils::ComputeHeightValue(aCBSize.height,
|
height = nsLayoutUtils::ComputeHeightValue(aCBSize.height,
|
||||||
|
@ -3890,10 +3890,20 @@ nsFrame::ComputeSize(nsRenderingContext *aRenderingContext,
|
|||||||
result.width = NS_MIN(maxWidth, result.width);
|
result.width = NS_MIN(maxWidth, result.width);
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord minWidth =
|
nscoord minWidth;
|
||||||
nsLayoutUtils::ComputeWidthValue(aRenderingContext, this,
|
if (stylePos->mMinWidth.GetUnit() != eStyleUnit_Auto) {
|
||||||
aCBSize.width, boxSizingAdjust.width, boxSizingToMarginEdgeWidth,
|
minWidth =
|
||||||
stylePos->mMinWidth);
|
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 = NS_MAX(minWidth, result.width);
|
result.width = NS_MAX(minWidth, result.width);
|
||||||
|
|
||||||
// Compute height
|
// Compute height
|
||||||
|
@ -2458,9 +2458,15 @@ nsHTMLReflowState::ComputeMinMaxValues(nscoord aContainingBlockWidth,
|
|||||||
nscoord aContainingBlockHeight,
|
nscoord aContainingBlockHeight,
|
||||||
const nsHTMLReflowState* aContainingBlockRS)
|
const nsHTMLReflowState* aContainingBlockRS)
|
||||||
{
|
{
|
||||||
mComputedMinWidth = ComputeWidthValue(aContainingBlockWidth,
|
// Handle "min-width: auto"
|
||||||
mStylePosition->mBoxSizing,
|
if (eStyleUnit_Auto == mStylePosition->mMinWidth.GetUnit()) {
|
||||||
mStylePosition->mMinWidth);
|
// XXXdholbert For flex items, this needs to behave like -moz-min-content.
|
||||||
|
mComputedMinWidth = 0;
|
||||||
|
} else {
|
||||||
|
mComputedMinWidth = ComputeWidthValue(aContainingBlockWidth,
|
||||||
|
mStylePosition->mBoxSizing,
|
||||||
|
mStylePosition->mMinWidth);
|
||||||
|
}
|
||||||
|
|
||||||
if (eStyleUnit_None == mStylePosition->mMaxWidth.GetUnit()) {
|
if (eStyleUnit_None == mStylePosition->mMaxWidth.GetUnit()) {
|
||||||
// Specified value of 'none'
|
// Specified value of 'none'
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
== 10036-1.html 10036-1-ref.html
|
== 10036-1.html 10036-1-ref.html
|
||||||
skip-if(!cocoaWidget) HTTP(..) == 10209-1.html 10209-ref.html # Bug 667079
|
skip-if(!cocoaWidget) HTTP(..) == 10209-1.html 10209-ref.html # Bug 667079
|
||||||
HTTP(..) == 10209-2.html 10209-ref.html
|
HTTP(..) == 10209-2.html 10209-ref.html
|
||||||
asserts(4) skip-if(!cocoaWidget) HTTP(..) == 10209-3.html 10209-3-ref.html # Assertions: bug 666606, skip because of bug 667079
|
asserts(2) 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-1.html 18217-basic-1-ref.html
|
||||||
== 18217-basic-2a.html 18217-basic-2-ref.html
|
== 18217-basic-2a.html 18217-basic-2-ref.html
|
||||||
== 18217-basic-2b.html 18217-basic-2-ref.html
|
== 18217-basic-2b.html 18217-basic-2-ref.html
|
||||||
|
@ -3361,7 +3361,17 @@ nsIDOMCSSValue*
|
|||||||
nsComputedDOMStyle::DoGetMinWidth()
|
nsComputedDOMStyle::DoGetMinWidth()
|
||||||
{
|
{
|
||||||
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
||||||
SetValueToCoord(val, GetStylePosition()->mMinWidth, true,
|
|
||||||
|
nsStyleCoord minWidth = GetStylePosition()->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,
|
||||||
&nsComputedDOMStyle::GetCBContentWidth,
|
&nsComputedDOMStyle::GetCBContentWidth,
|
||||||
nsCSSProps::kWidthKTable);
|
nsCSSProps::kWidthKTable);
|
||||||
return val;
|
return val;
|
||||||
|
@ -6433,11 +6433,7 @@ nsRuleNode::ComputePositionData(void* aStartStruct,
|
|||||||
SETCOORD_LPOH | SETCOORD_INITIAL_NONE | SETCOORD_STORE_CALC,
|
SETCOORD_LPOH | SETCOORD_INITIAL_NONE | SETCOORD_STORE_CALC,
|
||||||
aContext, mPresContext, canStoreInRuleTree);
|
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) {
|
if (pos->mMinHeight.GetUnit() == eStyleUnit_Auto) {
|
||||||
pos->mMinHeight.SetCoordValue(0);
|
pos->mMinHeight.SetCoordValue(0);
|
||||||
}
|
}
|
||||||
|
@ -1130,7 +1130,7 @@ nsStylePosition::nsStylePosition(void)
|
|||||||
mOffset.SetRight(autoCoord);
|
mOffset.SetRight(autoCoord);
|
||||||
mOffset.SetBottom(autoCoord);
|
mOffset.SetBottom(autoCoord);
|
||||||
mWidth.SetAutoValue();
|
mWidth.SetAutoValue();
|
||||||
mMinWidth.SetCoordValue(0);
|
mMinWidth.SetAutoValue();
|
||||||
mMaxWidth.SetNoneValue();
|
mMaxWidth.SetNoneValue();
|
||||||
mHeight.SetAutoValue();
|
mHeight.SetAutoValue();
|
||||||
mMinHeight.SetCoordValue(0);
|
mMinHeight.SetCoordValue(0);
|
||||||
@ -1252,8 +1252,7 @@ nsChangeHint nsStylePosition::MaxDifference()
|
|||||||
/* static */ bool
|
/* static */ bool
|
||||||
nsStylePosition::WidthCoordDependsOnContainer(const nsStyleCoord &aCoord)
|
nsStylePosition::WidthCoordDependsOnContainer(const nsStyleCoord &aCoord)
|
||||||
{
|
{
|
||||||
return aCoord.GetUnit() == eStyleUnit_Auto ||
|
return aCoord.HasPercent() ||
|
||||||
aCoord.HasPercent() ||
|
|
||||||
(aCoord.GetUnit() == eStyleUnit_Enumerated &&
|
(aCoord.GetUnit() == eStyleUnit_Enumerated &&
|
||||||
(aCoord.GetIntValue() == NS_STYLE_WIDTH_FIT_CONTENT ||
|
(aCoord.GetIntValue() == NS_STYLE_WIDTH_FIT_CONTENT ||
|
||||||
aCoord.GetIntValue() == NS_STYLE_WIDTH_AVAILABLE));
|
aCoord.GetIntValue() == NS_STYLE_WIDTH_AVAILABLE));
|
||||||
|
@ -1117,7 +1117,19 @@ struct nsStylePosition {
|
|||||||
nsStyleCoord mZIndex; // [reset] integer, auto
|
nsStyleCoord mZIndex; // [reset] integer, auto
|
||||||
|
|
||||||
bool WidthDependsOnContainer() const
|
bool WidthDependsOnContainer() const
|
||||||
{ return WidthCoordDependsOnContainer(mWidth); }
|
{
|
||||||
|
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.
|
||||||
bool MinWidthDependsOnContainer() const
|
bool MinWidthDependsOnContainer() const
|
||||||
{ return WidthCoordDependsOnContainer(mMinWidth); }
|
{ return WidthCoordDependsOnContainer(mMinWidth); }
|
||||||
bool MaxWidthDependsOnContainer() const
|
bool MaxWidthDependsOnContainer() const
|
||||||
|
Loading…
Reference in New Issue
Block a user