+2015-09-09 Commit Queue <commit-queue@webkit.org>
+
+ Unreviewed, rolling out r189536 and r189538.
+ https://bugs.webkit.org/show_bug.cgi?id=149002
+
+ broke tests on mac (Requested by alexchristensen on #webkit).
+
+ Reverted changesets:
+
+ "min-width/height should default to auto for flexbox items"
+ https://bugs.webkit.org/show_bug.cgi?id=146020
+ http://trac.webkit.org/changeset/189536
+
+ "[css-grid] Percentage columns shouldn't include border and
+ padding"
+ https://bugs.webkit.org/show_bug.cgi?id=148978
+ http://trac.webkit.org/changeset/189538
+
2015-09-09 David Hyatt <hyatt@apple.com>
REGRESSION: Inline-block baseline is wrong when zero-width replaced child is present
webkit.org/b/136754 css3/flexbox/csswg/flex-items-flexibility.html [ ImageOnlyFailure ]
webkit.org/b/136754 css3/flexbox/csswg/flex-lines/multi-line-wrap-reverse-column-reverse.html [ ImageOnlyFailure ]
webkit.org/b/136754 css3/flexbox/csswg/flex-lines/multi-line-wrap-with-column-reverse.html [ ImageOnlyFailure ]
+webkit.org/b/136754 css3/flexbox/csswg/flex-margin-no-collapse.html [ ImageOnlyFailure ]
webkit.org/b/136754 css3/flexbox/csswg/flexbox-flex-wrap-flexing.html [ ImageOnlyFailure ]
+webkit.org/b/136754 css3/flexbox/csswg/flexbox_flex-0-0-0.html [ ImageOnlyFailure ]
+webkit.org/b/136754 css3/flexbox/csswg/flexbox_flex-0-1-0.html [ ImageOnlyFailure ]
+webkit.org/b/136754 css3/flexbox/csswg/flexbox_flex-0-N-0.html [ ImageOnlyFailure ]
webkit.org/b/136754 css3/flexbox/csswg/flexbox_flex-natural-mixed-basis-auto.html [ ImageOnlyFailure ]
webkit.org/b/136754 css3/flexbox/csswg/flexbox_generated-container.html [ ImageOnlyFailure ]
webkit.org/b/136754 css3/flexbox/csswg/flexbox_justifycontent-center-overflow.html [ ImageOnlyFailure ]
background-color: green;
height: 50px;
}
- :not(#test) div {
- min-height: 0px;
- }
</style>
<body>
<p>Test passes if there is a filled green square and no red, the number within square is '1 2 3 4' from top to bottom.</p>
<div>
should align with the middle
<div class="inline-flexbox" style="width: 40px; height: 40px">
- <div style="-webkit-writing-mode: vertical-rl; height: 20px; width: 40px; border-bottom: 1px solid black; min-height: 0px;"></div>
+ <div style="-webkit-writing-mode: vertical-rl; height: 20px; width: 40px; border-bottom: 1px solid black"></div>
</div>
of the grey flexbox
</div>
<div>
should align with the middle
<div class="inline-flexbox column" style="width: 40px; height: 40px;">
- <div style="-webkit-writing-mode: vertical-rl; width: 40px; height: 20px; border-bottom: 1px solid black; min-height: 0px;"></div>
- <div style="-webkit-writing-mode: vertical-rl; width: 40px; height: 20px; min-height: 0px;"></div>
+ <div style="-webkit-writing-mode: vertical-rl; width: 40px; height: 20px; border-bottom: 1px solid black"></div>
+ <div style="-webkit-writing-mode: vertical-rl; width: 40px; height: 20px"></div>
</div>
of the grey flexbox
</div>
+++ /dev/null
-PASS successfullyParsed is true
-
-TEST COMPLETE
-PASS
-PASS
-PASS
-PASS
+++ /dev/null
-<!DOCTYPE html>
-<link href="resources/flexbox.css" rel="stylesheet">
-
-<script src="../../resources/js-test.js"></script>
-<script src="../../resources/check-layout.js"></script>
-
-<style>
-.flexbox {
- width: 10px;
- height: 10px;
- background-color: grey;
-}
-
-.item {
- background-color: red;
- margin: 5px;
-}
-
-.child {
- height: 100px;
- width: 100px;
- background-color: green;
-}
-
-.width-20 {
- width: 20px;
-}
-
-.flex-basis-20 {
- flex-basis: 20px;
-}
-
-</style>
-
-<body onload="checkLayout('.flexbox')">
-
-<div class="flexbox" data-expected-width="10">
- <div class="item" data-expected-width="100">
- <div class="child" data-expected-width="100"></div>
- </div>
-</div>
-
-<div class="flexbox column" data-expected-height="10">
- <div class="item" data-expected-height="100">
- <div class="child" data-expected-height="100"></div>
- </div>
-</div>
-
-<div class="flexbox" data-expected-width="10">
- <div class="item width-20" data-expected-width="20">
- <div class="child" data-expected-width="100"></div>
- </div>
-</div>
-
-<div class="flexbox" data-expected-width="10">
- <div class="item flex-basis-20" data-expected-width="100">
- <div class="child" data-expected-width="100"></div>
- </div>
-</div>
-
-</body>
<br class=clear>
<div class="flexbox vertical-lr" data-expected-height=115 data-expect-width=80>
- <div class="horizontal-tb nested" data-expected-height=80 data-expect-width=50 style="min-height: 0px;">
+ <div class="horizontal-tb nested" data-expected-height=80 data-expect-width=50>
<div class="vertical-lr nested" data-expected-height=80 data-expect-width=30>
<div></div>
<div></div>
<br class=clear>
<div class="flexbox vertical-lr" data-expected-height=65 data-expect-width=70>
- <div class="nested horizontal-tb" data-expected-height=30 data-expect-width=40 style="min-height: 0px;">
+ <div class="nested horizontal-tb" data-expected-height=30 data-expect-width=40>
<div></div>
<div></div>
</div>
+++ /dev/null
-This test checks that percentage tracks ignore grid container's margin, border and padding in order to calculate their breadths.
-
-PASS
-PASS
-PASS
-PASS
-PASS
-PASS
-PASS
-PASS
+++ /dev/null
-<!DOCTYPE html>
-<html>
-<head>
-<link href="resources/grid.css" rel="stylesheet">
-<style>
-.grid {
- width: 100px;
- height: 100px;
- -webkit-grid-template-columns: 20% 50% 30%;
- -webkit-grid-template-rows: 40% 60%;
-}
-
-.margin {
- margin: 10px;
-}
-
-.border {
- border: 5px solid black;
-}
-
-.padding {
- padding: 20px;
-}
-</style>
-<script src="../../resources/check-layout.js"></script>
-</head>
-<body onload="checkLayout('.grid');">
- <p>This test checks that percentage tracks ignore grid container's margin, border and padding in order to calculate their breadths.</p>
-
- <div class="grid">
- <div data-expected-width="20" data-expected-height="40"></div>
- <div data-expected-width="50" data-expected-height="40"></div>
- <div data-expected-width="30" data-expected-height="40"></div>
- <div data-expected-width="20" data-expected-height="60"></div>
- <div data-expected-width="50" data-expected-height="60"></div>
- <div data-expected-width="30" data-expected-height="60"></div>
- </div>
-
- <div class="grid margin">
- <div data-expected-width="20" data-expected-height="40"></div>
- <div data-expected-width="50" data-expected-height="40"></div>
- <div data-expected-width="30" data-expected-height="40"></div>
- <div data-expected-width="20" data-expected-height="60"></div>
- <div data-expected-width="50" data-expected-height="60"></div>
- <div data-expected-width="30" data-expected-height="60"></div>
- </div>
-
- <div class="grid border">
- <div data-expected-width="20" data-expected-height="40"></div>
- <div data-expected-width="50" data-expected-height="40"></div>
- <div data-expected-width="30" data-expected-height="40"></div>
- <div data-expected-width="20" data-expected-height="60"></div>
- <div data-expected-width="50" data-expected-height="60"></div>
- <div data-expected-width="30" data-expected-height="60"></div>
- </div>
-
- <div class="grid padding">
- <div data-expected-width="20" data-expected-height="40"></div>
- <div data-expected-width="50" data-expected-height="40"></div>
- <div data-expected-width="30" data-expected-height="40"></div>
- <div data-expected-width="20" data-expected-height="60"></div>
- <div data-expected-width="50" data-expected-height="60"></div>
- <div data-expected-width="30" data-expected-height="60"></div>
- </div>
-
- <div class="grid margin border">
- <div data-expected-width="20" data-expected-height="40"></div>
- <div data-expected-width="50" data-expected-height="40"></div>
- <div data-expected-width="30" data-expected-height="40"></div>
- <div data-expected-width="20" data-expected-height="60"></div>
- <div data-expected-width="50" data-expected-height="60"></div>
- <div data-expected-width="30" data-expected-height="60"></div>
- </div>
-
- <div class="grid margin padding">
- <div data-expected-width="20" data-expected-height="40"></div>
- <div data-expected-width="50" data-expected-height="40"></div>
- <div data-expected-width="30" data-expected-height="40"></div>
- <div data-expected-width="20" data-expected-height="60"></div>
- <div data-expected-width="50" data-expected-height="60"></div>
- <div data-expected-width="30" data-expected-height="60"></div>
- </div>
-
- <div class="grid border padding">
- <div data-expected-width="20" data-expected-height="40"></div>
- <div data-expected-width="50" data-expected-height="40"></div>
- <div data-expected-width="30" data-expected-height="40"></div>
- <div data-expected-width="20" data-expected-height="60"></div>
- <div data-expected-width="50" data-expected-height="60"></div>
- <div data-expected-width="30" data-expected-height="60"></div>
- </div>
-
- <div class="grid margin border padding">
- <div data-expected-width="20" data-expected-height="40"></div>
- <div data-expected-width="50" data-expected-height="40"></div>
- <div data-expected-width="30" data-expected-height="40"></div>
- <div data-expected-width="20" data-expected-height="60"></div>
- <div data-expected-width="50" data-expected-height="60"></div>
- <div data-expected-width="30" data-expected-height="60"></div>
- </div>
-</body>
-</html>
PASS div.style.minWidth is ""
PASS getComputedStyle(div)["min-width"] is "0px"
-PASS div.style.minWidth is "auto"
+PASS div.style.minWidth is ""
PASS div.style.maxWidth is ""
PASS getComputedStyle(div).minWidth is "0px"
PASS div.style.minWidth is "0px"
PASS getComputedStyle(div)["min-width"] is "0px"
PASS div.style.minHeight is ""
PASS getComputedStyle(div)["min-height"] is "0px"
-PASS div.style.minHeight is "auto"
+PASS div.style.minHeight is ""
PASS div.style.maxHeight is ""
PASS getComputedStyle(div).minHeight is "0px"
PASS div.style.minHeight is "0px"
PASS getComputedStyle(div)["min-height"] is "0px"
-PASS flexitem.style.minWidth is ""
-PASS getComputedStyle(flexitem)["min-width"] is "auto"
-PASS flexitem.style.minWidth is "auto"
-PASS flexitem.style.maxWidth is ""
-PASS getComputedStyle(flexitem).minWidth is "auto"
-PASS flexitem.style.minWidth is "0px"
-PASS getComputedStyle(flexitem)["min-width"] is "0px"
-PASS flexitem.style.minHeight is ""
-PASS getComputedStyle(flexitem)["min-height"] is "auto"
-PASS flexitem.style.minHeight is "auto"
-PASS flexitem.style.maxHeight is ""
-PASS getComputedStyle(flexitem).minHeight is "auto"
-PASS flexitem.style.minHeight is "0px"
-PASS getComputedStyle(flexitem)["min-height"] is "0px"
-PASS button.style.minWidth is ""
-PASS getComputedStyle(button)["min-width"] is "0px"
-PASS button.style.minHeight is ""
-PASS getComputedStyle(button)["min-height"] is "0px"
-PASS button.style.minHeight is "auto"
-PASS getComputedStyle(button).minHeight is "0px"
-PASS button.style.minWidth is "auto"
-PASS getComputedStyle(button).minWidth is "0px"
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE html>
<script src='../../resources/js-test-pre.js'></script>
<div id=foo></div>
-<div id="flexbox" style="display: flex;"><div id="flexitem"></div></div>
-<button id="button"></button>
<script>
div = document.getElementById('foo');
shouldBe('div.style.minWidth', '""');
div.style.minWidth = 'auto';
div.style.maxWidth = 'auto';
-shouldBe('div.style.minWidth', '"auto"');
+shouldBe('div.style.minWidth', '""');
shouldBe('div.style.maxWidth', '""');
shouldBe('getComputedStyle(div).minWidth', '"0px"');
div.style.minHeight = 'auto';
div.style.maxHeight = 'auto';
-shouldBe('div.style.minHeight', '"auto"');
+shouldBe('div.style.minHeight', '""');
shouldBe('div.style.maxHeight', '""');
shouldBe('getComputedStyle(div).minHeight', '"0px"');
shouldBe('div.style.minHeight', '"0px"');
shouldBe('getComputedStyle(div)["min-height"]', '"0px"');
-var flexitem = document.getElementById("flexitem");
-shouldBe('flexitem.style.minWidth', '""');
-shouldBe('getComputedStyle(flexitem)["min-width"]', '"auto"');
-
-flexitem.style.minWidth = 'auto';
-flexitem.style.maxWidth = 'auto';
-shouldBe('flexitem.style.minWidth', '"auto"');
-shouldBe('flexitem.style.maxWidth', '""');
-shouldBe('getComputedStyle(flexitem).minWidth', '"auto"');
-
-flexitem.style.minWidth = 0;
-shouldBe('flexitem.style.minWidth', '"0px"');
-shouldBe('getComputedStyle(flexitem)["min-width"]', '"0px"');
-
-shouldBe('flexitem.style.minHeight', '""');
-shouldBe('getComputedStyle(flexitem)["min-height"]', '"auto"');
-
-flexitem.style.minHeight = 'auto';
-flexitem.style.maxHeight = 'auto';
-shouldBe('flexitem.style.minHeight', '"auto"');
-shouldBe('flexitem.style.maxHeight', '""');
-shouldBe('getComputedStyle(flexitem).minHeight', '"auto"');
-
-flexitem.style.minHeight = 0;
-shouldBe('flexitem.style.minHeight', '"0px"');
-shouldBe('getComputedStyle(flexitem)["min-height"]', '"0px"');
-
-var button = document.getElementById("button");
-shouldBe('button.style.minWidth', '""');
-shouldBe('getComputedStyle(button)["min-width"]', '"0px"');
-shouldBe('button.style.minHeight', '""');
-shouldBe('getComputedStyle(button)["min-height"]', '"0px"');
-
-button.style.minHeight = 'auto';
-button.style.minWidth = 'auto';
-shouldBe('button.style.minHeight', '"auto"');
-shouldBe('getComputedStyle(button).minHeight', '"0px"');
-shouldBe('button.style.minWidth', '"auto"');
-shouldBe('getComputedStyle(button).minWidth', '"0px"');
-
</script>
<script src='../../resources/js-test-post.js'></script>
+2015-09-09 Commit Queue <commit-queue@webkit.org>
+
+ Unreviewed, rolling out r189536 and r189538.
+ https://bugs.webkit.org/show_bug.cgi?id=149002
+
+ broke tests on mac (Requested by alexchristensen on #webkit).
+
+ Reverted changesets:
+
+ "min-width/height should default to auto for flexbox items"
+ https://bugs.webkit.org/show_bug.cgi?id=146020
+ http://trac.webkit.org/changeset/189536
+
+ "[css-grid] Percentage columns shouldn't include border and
+ padding"
+ https://bugs.webkit.org/show_bug.cgi?id=148978
+ http://trac.webkit.org/changeset/189538
+
2015-09-08 David Hyatt <hyatt@apple.com>
REGRESSION: Inline-block baseline is wrong when zero-width replaced child is present
return result;
}
-inline static bool isFlexOrGrid(ContainerNode* element)
-{
- return element && element->computedStyle() && element->computedStyle()->isDisplayFlexibleOrGridBox();
-}
-
RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID, EUpdateLayout updateLayout) const
{
Node* styledNode = this->styledNode();
return zoomAdjustedPixelValueForLength(maxWidth, *style);
}
case CSSPropertyMinHeight:
- if (style->minHeight().isAuto()) {
- if (isFlexOrGrid(styledNode->parentNode()))
- return cssValuePool.createIdentifierValue(CSSValueAuto);
+ // FIXME: For flex-items, min-height:auto should compute to min-content.
+ if (style->minHeight().isAuto())
return zoomAdjustedPixelValue(0, *style);
- }
return zoomAdjustedPixelValueForLength(style->minHeight(), *style);
case CSSPropertyMinWidth:
- if (style->minWidth().isAuto()) {
- if (isFlexOrGrid(styledNode->parentNode()))
- return cssValuePool.createIdentifierValue(CSSValueAuto);
+ // FIXME: For flex-items, min-width:auto should compute to min-content.
+ if (style->minWidth().isAuto())
return zoomAdjustedPixelValue(0, *style);
- }
return zoomAdjustedPixelValueForLength(style->minWidth(), *style);
case CSSPropertyObjectFit:
return cssValuePool.createValue(style->objectFit());
case CSSPropertyWebkitMinLogicalWidth:
case CSSPropertyMinHeight:
case CSSPropertyWebkitMinLogicalHeight:
- validPrimitive = id == CSSValueAuto || isValidSize(valueWithCalculation);
+ validPrimitive = isValidSize(valueWithCalculation);
break;
case CSSPropertyWidth:
private:
virtual void layout() override;
- bool isFlexibleBoxImpl() const override { return true; }
};
void RenderSliderContainer::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const
{
const RenderStyle& styleToUse = style();
if (!styleToUse.logicalMaxHeight().isUndefined()) {
- if (Optional<LayoutUnit> maxH = computeLogicalHeightUsing(MaxSize, styleToUse.logicalMaxHeight(), intrinsicContentHeight))
+ if (Optional<LayoutUnit> maxH = computeLogicalHeightUsing(styleToUse.logicalMaxHeight(), intrinsicContentHeight))
logicalHeight = std::min(logicalHeight, maxH.value());
}
- if (Optional<LayoutUnit> computedLogicalHeight = computeLogicalHeightUsing(MinSize, styleToUse.logicalMinHeight(), intrinsicContentHeight))
+ if (Optional<LayoutUnit> computedLogicalHeight = computeLogicalHeightUsing(styleToUse.logicalMinHeight(), intrinsicContentHeight))
return std::max(logicalHeight, computedLogicalHeight.value());
return logicalHeight;
}
{
const RenderStyle& styleToUse = style();
if (!styleToUse.logicalMaxHeight().isUndefined()) {
- if (Optional<LayoutUnit> maxH = computeContentLogicalHeight(MaxSize, styleToUse.logicalMaxHeight(), intrinsicContentHeight))
+ if (Optional<LayoutUnit> maxH = computeContentLogicalHeight(styleToUse.logicalMaxHeight(), intrinsicContentHeight))
logicalHeight = std::min(logicalHeight, maxH.value());
}
- if (Optional<LayoutUnit> computedContentLogicalHeight = computeContentLogicalHeight(MinSize, styleToUse.logicalMinHeight(), intrinsicContentHeight))
+ if (Optional<LayoutUnit> computedContentLogicalHeight = computeContentLogicalHeight(styleToUse.logicalMinHeight(), intrinsicContentHeight))
return std::max(logicalHeight, computedContentLogicalHeight.value());
return logicalHeight;
}
LayoutUnit RenderBox::computeLogicalWidthInRegionUsing(SizeType widthType, Length logicalWidth, LayoutUnit availableLogicalWidth,
const RenderBlock* cb, RenderRegion* region) const
{
- ASSERT(widthType == MinSize || widthType == MainOrPreferredSize || !logicalWidth.isAuto());
- if (widthType == MinSize && logicalWidth.isAuto())
- return adjustBorderBoxLogicalWidthForBoxSizing(0);
-
if (!logicalWidth.isIntrinsicOrAuto()) {
// FIXME: If the containing block flow is perpendicular to our direction we need to use the available logical height instead.
return adjustBorderBoxLogicalWidthForBoxSizing(valueForLength(logicalWidth, availableLogicalWidth));
LayoutUnit heightResult;
if (checkMinMaxHeight) {
LayoutUnit intrinsicHeight = computedValues.m_extent - borderAndPaddingLogicalHeight();
- heightResult = computeLogicalHeightUsing(MainOrPreferredSize, style().logicalHeight(), intrinsicHeight).valueOr(computedValues.m_extent);
+ heightResult = computeLogicalHeightUsing(style().logicalHeight(), intrinsicHeight).valueOr(computedValues.m_extent);
heightResult = constrainLogicalHeightByMinMax(heightResult, intrinsicHeight);
} else {
// The only times we don't check min/max height are when a fixed length has
}
}
-Optional<LayoutUnit> RenderBox::computeLogicalHeightUsing(SizeType heightType, const Length& height, Optional<LayoutUnit> intrinsicContentHeight) const
+Optional<LayoutUnit> RenderBox::computeLogicalHeightUsing(const Length& height, Optional<LayoutUnit> intrinsicContentHeight) const
{
- if (Optional<LayoutUnit> logicalHeight = computeContentAndScrollbarLogicalHeightUsing(heightType, height, intrinsicContentHeight))
+ if (Optional<LayoutUnit> logicalHeight = computeContentAndScrollbarLogicalHeightUsing(height, intrinsicContentHeight))
return adjustBorderBoxLogicalHeightForBoxSizing(logicalHeight.value());
return Nullopt;
}
-Optional<LayoutUnit> RenderBox::computeContentLogicalHeight(SizeType heightType, const Length& height, Optional<LayoutUnit> intrinsicContentHeight) const
+Optional<LayoutUnit> RenderBox::computeContentLogicalHeight(const Length& height, Optional<LayoutUnit> intrinsicContentHeight) const
{
- if (Optional<LayoutUnit> heightIncludingScrollbar = computeContentAndScrollbarLogicalHeightUsing(heightType, height, intrinsicContentHeight))
+ if (Optional<LayoutUnit> heightIncludingScrollbar = computeContentAndScrollbarLogicalHeightUsing(height, intrinsicContentHeight))
return std::max<LayoutUnit>(0, adjustContentBoxLogicalHeightForBoxSizing(heightIncludingScrollbar) - scrollbarLogicalHeight());
return Nullopt;
}
return LayoutUnit(0);
}
-Optional<LayoutUnit> RenderBox::computeContentAndScrollbarLogicalHeightUsing(SizeType heightType, const Length& height, Optional<LayoutUnit> intrinsicContentHeight) const
+Optional<LayoutUnit> RenderBox::computeContentAndScrollbarLogicalHeightUsing(const Length& height, Optional<LayoutUnit> intrinsicContentHeight) const
{
- if (height.isAuto())
- return heightType == MinSize ? Optional<LayoutUnit>(0) : Nullopt;
// FIXME: The CSS sizing spec is considering changing what min-content/max-content should resolve to.
// If that happens, this code will have to change.
if (height.isIntrinsic())
LayoutUnit RenderBox::computeReplacedLogicalWidth(ShouldComputePreferred shouldComputePreferred) const
{
- return computeReplacedLogicalWidthRespectingMinMaxWidth(computeReplacedLogicalWidthUsing(MainOrPreferredSize, style().logicalWidth()), shouldComputePreferred);
+ return computeReplacedLogicalWidthRespectingMinMaxWidth(computeReplacedLogicalWidthUsing(style().logicalWidth()), shouldComputePreferred);
}
LayoutUnit RenderBox::computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUnit logicalWidth, ShouldComputePreferred shouldComputePreferred) const
{
- LayoutUnit minLogicalWidth = (shouldComputePreferred == ComputePreferred && style().logicalMinWidth().isPercentOrCalculated()) || style().logicalMinWidth().isUndefined() ? logicalWidth : computeReplacedLogicalWidthUsing(MinSize, style().logicalMinWidth());
- LayoutUnit maxLogicalWidth = (shouldComputePreferred == ComputePreferred && style().logicalMaxWidth().isPercentOrCalculated()) || style().logicalMaxWidth().isUndefined() ? logicalWidth : computeReplacedLogicalWidthUsing(MaxSize, style().logicalMaxWidth());
+ LayoutUnit minLogicalWidth = (shouldComputePreferred == ComputePreferred && style().logicalMinWidth().isPercentOrCalculated()) || style().logicalMinWidth().isUndefined() ? logicalWidth : computeReplacedLogicalWidthUsing(style().logicalMinWidth());
+ LayoutUnit maxLogicalWidth = (shouldComputePreferred == ComputePreferred && style().logicalMaxWidth().isPercentOrCalculated()) || style().logicalMaxWidth().isUndefined() ? logicalWidth : computeReplacedLogicalWidthUsing(style().logicalMaxWidth());
return std::max(minLogicalWidth, std::min(logicalWidth, maxLogicalWidth));
}
-LayoutUnit RenderBox::computeReplacedLogicalWidthUsing(SizeType widthType, Length logicalWidth) const
+LayoutUnit RenderBox::computeReplacedLogicalWidthUsing(Length logicalWidth) const
{
- ASSERT(widthType == MinSize || widthType == MainOrPreferredSize || !logicalWidth.isAuto());
- if (widthType == MinSize && logicalWidth.isAuto())
- return adjustContentBoxLogicalWidthForBoxSizing(0);
-
switch (logicalWidth.type()) {
case Fixed:
return adjustContentBoxLogicalWidthForBoxSizing(logicalWidth.value());
LayoutUnit RenderBox::computeReplacedLogicalHeight() const
{
- return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplacedLogicalHeightUsing(MainOrPreferredSize, style().logicalHeight()));
+ return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplacedLogicalHeightUsing(style().logicalHeight()));
}
LayoutUnit RenderBox::computeReplacedLogicalHeightRespectingMinMaxHeight(LayoutUnit logicalHeight) const
{
- LayoutUnit minLogicalHeight = computeReplacedLogicalHeightUsing(MinSize, style().logicalMinHeight());
- LayoutUnit maxLogicalHeight = style().logicalMaxHeight().isUndefined() ? logicalHeight : computeReplacedLogicalHeightUsing(MaxSize, style().logicalMaxHeight());
+ LayoutUnit minLogicalHeight = computeReplacedLogicalHeightUsing(style().logicalMinHeight());
+ LayoutUnit maxLogicalHeight = style().logicalMaxHeight().isUndefined() ? logicalHeight : computeReplacedLogicalHeightUsing(style().logicalMaxHeight());
return std::max(minLogicalHeight, std::min(logicalHeight, maxLogicalHeight));
}
-LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(SizeType heightType, Length logicalHeight) const
+LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(Length logicalHeight) const
{
- ASSERT(heightType == MinSize || heightType == MainOrPreferredSize || !logicalHeight.isAuto());
- if (heightType == MinSize && logicalHeight.isAuto())
- return adjustContentBoxLogicalHeightForBoxSizing(Optional<LayoutUnit>(0));
-
switch (logicalHeight.type()) {
case Fixed:
return adjustContentBoxLogicalHeightForBoxSizing(LayoutUnit(logicalHeight.value()));
return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(h, availableHeight));
}
- if (Optional<LayoutUnit> heightIncludingScrollbar = computeContentAndScrollbarLogicalHeightUsing(MainOrPreferredSize, h, Nullopt))
+ if (Optional<LayoutUnit> heightIncludingScrollbar = computeContentAndScrollbarLogicalHeightUsing(h, Nullopt))
return std::max<LayoutUnit>(0, adjustContentBoxLogicalHeightForBoxSizing(heightIncludingScrollbar) - scrollbarLogicalHeight());
// FIXME: Check logicalTop/logicalBottom here to correctly handle vertical writing-mode.
computeInlineStaticDistance(logicalLeftLength, logicalRightLength, this, containerBlock, containerLogicalWidth, region);
// Calculate constraint equation values for 'width' case.
- computePositionedLogicalWidthUsing(MainOrPreferredSize, style().logicalWidth(), containerBlock, containerDirection,
+ computePositionedLogicalWidthUsing(style().logicalWidth(), containerBlock, containerDirection,
containerLogicalWidth, bordersPlusPadding,
logicalLeftLength, logicalRightLength, marginLogicalLeft, marginLogicalRight,
computedValues);
if (!style().logicalMaxWidth().isUndefined()) {
LogicalExtentComputedValues maxValues;
- computePositionedLogicalWidthUsing(MaxSize, style().logicalMaxWidth(), containerBlock, containerDirection,
+ computePositionedLogicalWidthUsing(style().logicalMaxWidth(), containerBlock, containerDirection,
containerLogicalWidth, bordersPlusPadding,
logicalLeftLength, logicalRightLength, marginLogicalLeft, marginLogicalRight,
maxValues);
if (!style().logicalMinWidth().isZero() || style().logicalMinWidth().isIntrinsic()) {
LogicalExtentComputedValues minValues;
- computePositionedLogicalWidthUsing(MinSize, style().logicalMinWidth(), containerBlock, containerDirection,
+ computePositionedLogicalWidthUsing(style().logicalMinWidth(), containerBlock, containerDirection,
containerLogicalWidth, bordersPlusPadding,
logicalLeftLength, logicalRightLength, marginLogicalLeft, marginLogicalRight,
minValues);
logicalLeftPos += (child->isHorizontalWritingMode() ? containerBlock->borderLeft() : containerBlock->borderTop());
}
-void RenderBox::computePositionedLogicalWidthUsing(SizeType widthType, Length logicalWidth, const RenderBoxModelObject* containerBlock, TextDirection containerDirection,
+void RenderBox::computePositionedLogicalWidthUsing(Length logicalWidth, const RenderBoxModelObject* containerBlock, TextDirection containerDirection,
LayoutUnit containerLogicalWidth, LayoutUnit bordersPlusPadding,
Length logicalLeft, Length logicalRight, Length marginLogicalLeft, Length marginLogicalRight,
LogicalExtentComputedValues& computedValues) const
{
- ASSERT(widthType == MinSize || widthType == MainOrPreferredSize || !logicalWidth.isAuto());
- if (widthType == MinSize && logicalWidth.isAuto())
- logicalWidth = Length(0, Fixed);
- else if (logicalWidth.isIntrinsic())
+ if (logicalWidth.isIntrinsic())
logicalWidth = Length(computeIntrinsicLogicalWidthUsing(logicalWidth, containerLogicalWidth, bordersPlusPadding) - bordersPlusPadding, Fixed);
// 'left' and 'right' cannot both be 'auto' because one would of been
// Calculate constraint equation values for 'height' case.
LayoutUnit logicalHeight = computedValues.m_extent;
- computePositionedLogicalHeightUsing(MainOrPreferredSize, styleToUse.logicalHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding, logicalHeight,
+ computePositionedLogicalHeightUsing(styleToUse.logicalHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding, logicalHeight,
logicalTopLength, logicalBottomLength, marginBefore, marginAfter,
computedValues);
if (!styleToUse.logicalMaxHeight().isUndefined()) {
LogicalExtentComputedValues maxValues;
- computePositionedLogicalHeightUsing(MaxSize, styleToUse.logicalMaxHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding, logicalHeight,
+ computePositionedLogicalHeightUsing(styleToUse.logicalMaxHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding, logicalHeight,
logicalTopLength, logicalBottomLength, marginBefore, marginAfter,
maxValues);
if (!styleToUse.logicalMinHeight().isZero() || styleToUse.logicalMinHeight().isIntrinsic()) {
LogicalExtentComputedValues minValues;
- computePositionedLogicalHeightUsing(MinSize, styleToUse.logicalMinHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding, logicalHeight,
+ computePositionedLogicalHeightUsing(styleToUse.logicalMinHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding, logicalHeight,
logicalTopLength, logicalBottomLength, marginBefore, marginAfter,
minValues);
}
}
-void RenderBox::computePositionedLogicalHeightUsing(SizeType heightType, Length logicalHeightLength, const RenderBoxModelObject* containerBlock,
+void RenderBox::computePositionedLogicalHeightUsing(Length logicalHeightLength, const RenderBoxModelObject* containerBlock,
LayoutUnit containerLogicalHeight, LayoutUnit bordersPlusPadding, LayoutUnit logicalHeight,
Length logicalTop, Length logicalBottom, Length marginBefore, Length marginAfter,
LogicalExtentComputedValues& computedValues) const
{
- ASSERT(heightType == MinSize || heightType == MainOrPreferredSize || !logicalHeightLength.isAuto());
- if (heightType == MinSize && logicalHeightLength.isAuto())
- logicalHeightLength = Length(0, Fixed);
-
// 'top' and 'bottom' cannot both be 'auto' because 'top would of been
// converted to the static position in computePositionedLogicalHeight()
ASSERT(!(logicalTop.isAuto() && logicalBottom.isAuto()));
LayoutUnit shrinkLogicalWidthToAvoidFloats(LayoutUnit childMarginStart, LayoutUnit childMarginEnd, const RenderBlock* cb, RenderRegion*) const;
LayoutUnit computeLogicalWidthInRegionUsing(SizeType, Length logicalWidth, LayoutUnit availableLogicalWidth, const RenderBlock* containingBlock, RenderRegion*) const;
- Optional<LayoutUnit> computeLogicalHeightUsing(SizeType, const Length& height, Optional<LayoutUnit> intrinsicContentHeight) const;
- Optional<LayoutUnit> computeContentLogicalHeight(SizeType, const Length& height, Optional<LayoutUnit> intrinsicContentHeight) const;
- Optional<LayoutUnit> computeContentAndScrollbarLogicalHeightUsing(SizeType, const Length& height, Optional<LayoutUnit> intrinsicContentHeight) const;
- LayoutUnit computeReplacedLogicalWidthUsing(SizeType, Length width) const;
+ Optional<LayoutUnit> computeLogicalHeightUsing(const Length& height, Optional<LayoutUnit> intrinsicContentHeight) const;
+ Optional<LayoutUnit> computeContentLogicalHeight(const Length& height, Optional<LayoutUnit> intrinsicContentHeight) const;
+ Optional<LayoutUnit> computeContentAndScrollbarLogicalHeightUsing(const Length& height, Optional<LayoutUnit> intrinsicContentHeight) const;
+ LayoutUnit computeReplacedLogicalWidthUsing(Length width) const;
LayoutUnit computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUnit logicalWidth, ShouldComputePreferred = ComputeActual) const;
- LayoutUnit computeReplacedLogicalHeightUsing(SizeType, Length height) const;
+ LayoutUnit computeReplacedLogicalHeightUsing(Length height) const;
LayoutUnit computeReplacedLogicalHeightRespectingMinMaxHeight(LayoutUnit logicalHeight) const;
virtual LayoutUnit computeReplacedLogicalWidth(ShouldComputePreferred = ComputeActual) const;
LayoutUnit viewLogicalHeightForPercentages() const;
void computePositionedLogicalHeight(LogicalExtentComputedValues&) const;
- void computePositionedLogicalWidthUsing(SizeType, Length logicalWidth, const RenderBoxModelObject* containerBlock, TextDirection containerDirection,
+ void computePositionedLogicalWidthUsing(Length logicalWidth, const RenderBoxModelObject* containerBlock, TextDirection containerDirection,
LayoutUnit containerLogicalWidth, LayoutUnit bordersPlusPadding,
Length logicalLeft, Length logicalRight, Length marginLogicalLeft, Length marginLogicalRight,
LogicalExtentComputedValues&) const;
- void computePositionedLogicalHeightUsing(SizeType, Length logicalHeightLength, const RenderBoxModelObject* containerBlock,
+ void computePositionedLogicalHeightUsing(Length logicalHeightLength, const RenderBoxModelObject* containerBlock,
LayoutUnit containerLogicalHeight, LayoutUnit bordersPlusPadding, LayoutUnit logicalHeight,
Length logicalTop, Length logicalBottom, Length marginLogicalTop, Length marginLogicalBottom,
LogicalExtentComputedValues&) const;
void timerFired();
- bool isFlexibleBoxImpl() const override { return true; }
-
RenderTextFragment* m_buttonText;
RenderBlock* m_inner;
// We don't have to check for "auto" here - computeContentLogicalHeight will just return Nullopt for that case anyway.
if (size.isIntrinsic())
child.layoutIfNeeded();
- return child.computeContentLogicalHeight(sizeType, size, child.logicalHeight() - child.borderAndPaddingLogicalHeight());
+ return child.computeContentLogicalHeight(size, child.logicalHeight() - child.borderAndPaddingLogicalHeight());
}
// FIXME: Figure out how this should work for regions and pass in the appropriate values.
RenderRegion* region = nullptr;
return isHorizontalFlow() ? child.horizontalBorderAndPaddingExtent() : child.verticalBorderAndPaddingExtent();
}
-bool RenderFlexibleBox::mainAxisExtentIsDefinite() const
-{
- return isColumnFlow() ? hasDefiniteLogicalHeight() : hasDefiniteLogicalWidth();
-}
-
-bool RenderFlexibleBox::mainAxisLengthIsIndefinite(const Length& flexBasis) const
-{
- return flexBasis.isAuto() || (flexBasis.isPercentOrCalculated() && !mainAxisExtentIsDefinite());
-}
-
LayoutUnit RenderFlexibleBox::mainAxisScrollbarExtentForChild(RenderBox& child) const
{
return isHorizontalFlow() ? child.verticalScrollbarWidth() : child.horizontalScrollbarHeight();
LayoutUnit RenderFlexibleBox::adjustChildSizeForMinAndMax(RenderBox& child, LayoutUnit childSize)
{
Length max = isHorizontalFlow() ? child.style().maxWidth() : child.style().maxHeight();
- Optional<LayoutUnit> maxExtent = Nullopt;
- if (max.isSpecifiedOrIntrinsic()) {
- maxExtent = computeMainAxisExtentForChild(child, MaxSize, max);
- childSize = std::min(childSize, maxExtent.valueOr(childSize));
- }
+ if (max.isSpecifiedOrIntrinsic())
+ childSize = std::min(childSize, computeMainAxisExtentForChild(child, MaxSize, max).valueOr(childSize));
Length min = isHorizontalFlow() ? child.style().minWidth() : child.style().minHeight();
if (min.isSpecifiedOrIntrinsic())
return std::max(childSize, computeMainAxisExtentForChild(child, MinSize, min).valueOr(childSize));
-
- if (!isFlexibleBoxImpl() && min.isAuto() && mainAxisOverflowForChild(child) == OVISIBLE) {
- // This is the implementation of CSS flexbox section 4.5 which defines the minimum size of "pure" flex
- // items. For any other item the value should be 0, this also includes RenderFlexibleBox's derived clases
- // (RenderButton, RenderFullScreen...) because that's just an implementation detail.
- LayoutUnit contentSize = computeMainAxisExtentForChild(child, MinSize, Length(MinContent)).valueOr(0);
- ASSERT(computeMainAxisExtentForChild(child, MinSize, Length(MinContent)));
- contentSize = std::min(contentSize, maxExtent.valueOr(contentSize));
-
- Length mainSize = isHorizontalFlow() ? child.style().width() : child.style().height();
- if (!mainAxisLengthIsIndefinite(mainSize)) {
- LayoutUnit resolvedMainSize = computeMainAxisExtentForChild(child, MainOrPreferredSize, mainSize).valueOr(0);
- ASSERT(computeMainAxisExtentForChild(child, MainOrPreferredSize, mainSize));
- LayoutUnit specifiedSize = std::min(resolvedMainSize, maxExtent.valueOr(resolvedMainSize));
-
- return std::max(childSize, std::min(specifiedSize, contentSize));
- }
- return std::max(childSize, contentSize);
- }
return childSize;
}
child.updateLogicalHeight();
}
-EOverflow RenderFlexibleBox::mainAxisOverflowForChild(RenderBox& child) const
-{
- if (isHorizontalFlow())
- return child.style().overflowX();
- return child.style().overflowY();
-}
-
void RenderFlexibleBox::layoutAndPlaceChildren(LayoutUnit& crossAxisOffset, const OrderedFlexItemList& children, const Vector<LayoutUnit>& childSizes, LayoutUnit availableFreeSpace, bool relayoutChildren, Vector<LineContext>& lineContexts)
{
ASSERT(childSizes.size() == children.size());
LayoutUnit mainAxisBorderAndPaddingExtentForChild(RenderBox& child) const;
LayoutUnit mainAxisScrollbarExtentForChild(RenderBox& child) const;
LayoutUnit preferredMainAxisContentExtentForChild(RenderBox& child, bool hasInfiniteLineLength);
- EOverflow mainAxisOverflowForChild(RenderBox&) const;
void layoutFlexItems(bool relayoutChildren, Vector<LineContext>&);
LayoutUnit autoMarginOffsetInMainAxis(const OrderedFlexItemList&, LayoutUnit& availableFreeSpace);
void flipForRightToLeftColumn();
void flipForWrapReverse(const Vector<LineContext>&, LayoutUnit crossAxisStartEdge);
- bool mainAxisExtentIsDefinite() const;
- bool mainAxisLengthIsIndefinite(const Length& flexBasis) const;
-
- virtual bool isFlexibleBoxImpl() const { return false; };
-
mutable OrderIterator m_orderIterator;
int m_numberOfInFlowChildrenOnFirstLine;
};
private:
virtual bool isRenderFullScreen() const override { return true; }
virtual void willBeDestroyed() override;
- bool isFlexibleBoxImpl() const override { return true; }
protected:
RenderBlock* m_placeholder;
{
ASSERT(trackLength.isSpecified());
if (direction == ForColumns)
- return valueForLength(trackLength, logicalWidth() - borderAndPaddingLogicalWidth());
- return valueForLength(trackLength, computeContentLogicalHeight(MainOrPreferredSize, style().logicalHeight(), Nullopt).valueOr(0));
+ return valueForLength(trackLength, logicalWidth());
+ return valueForLength(trackLength, computeContentLogicalHeight(style().logicalHeight(), Nullopt).valueOr(0));
}
double RenderGrid::computeNormalizedFractionBreadth(Vector<GridTrack>& tracks, const GridSpan& tracksSpan, GridTrackSizingDirection direction, LayoutUnit spaceToFill) const
private:
virtual void layout() override;
- bool isFlexibleBoxImpl() const override { return true; }
};
// ----------------------------
RenderStyle& innerStyle = m_innerBlock->style();
innerStyle.setFlexGrow(1);
innerStyle.setFlexShrink(1);
+ // min-width: 0; is needed for correct shrinking.
+ // FIXME: Remove this line when https://bugs.webkit.org/show_bug.cgi?id=111790 is fixed.
+ innerStyle.setMinWidth(Length(0, Fixed));
// Use margin:auto instead of align-items:center to get safe centering, i.e.
// when the content overflows, treat it the same as align-items: flex-start.
// But we only do that for the cases where html.css would otherwise use center.
void didUpdateActiveOption(int optionIndex);
- bool isFlexibleBoxImpl() const override { return true; }
-
RenderText* m_buttonText;
RenderBlock* m_innerBlock;
LayoutUnit availableHeight = multiColumnFlowThread()->columnHeightAvailable();
LayoutUnit maxColumnHeight = availableHeight ? availableHeight : RenderFlowThread::maxLogicalHeight();
if (!multicolStyle.logicalMaxHeight().isUndefined())
- maxColumnHeight = std::min(maxColumnHeight, multicolBlock->computeContentLogicalHeight(MaxSize, multicolStyle.logicalMaxHeight(), Nullopt).valueOr(maxColumnHeight));
+ maxColumnHeight = std::min(maxColumnHeight, multicolBlock->computeContentLogicalHeight(multicolStyle.logicalMaxHeight(), Nullopt).valueOr(maxColumnHeight));
return heightAdjustedForSetOffset(maxColumnHeight);
}
ASSERT(parent());
const RenderStyle& styleToUse = parent()->style();
- return styleToUse.logicalMaxHeight().isUndefined() ? RenderFlowThread::maxLogicalHeight() : downcast<RenderBlock>(*parent()).computeReplacedLogicalHeightUsing(MaxSize, styleToUse.logicalMaxHeight());
+ return styleToUse.logicalMaxHeight().isUndefined() ? RenderFlowThread::maxLogicalHeight() : downcast<RenderBlock>(*parent()).computeReplacedLogicalHeightUsing(styleToUse.logicalMaxHeight());
}
LayoutRect RenderNamedFlowFragment::flowThreadPortionRectForClipping(bool isFirstRegionInRange, bool isLastRegionInRange) const
LayoutUnit RenderReplaced::computeReplacedLogicalWidth(ShouldComputePreferred shouldComputePreferred) const
{
if (style().logicalWidth().isSpecified() || style().logicalWidth().isIntrinsic())
- return computeReplacedLogicalWidthRespectingMinMaxWidth(computeReplacedLogicalWidthUsing(MainOrPreferredSize, style().logicalWidth()), shouldComputePreferred);
+ return computeReplacedLogicalWidthRespectingMinMaxWidth(computeReplacedLogicalWidthUsing(style().logicalWidth()), shouldComputePreferred);
RenderBox* contentRenderer = embeddedContentBox();
// 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' = width of containing block
LayoutUnit logicalWidth;
if (RenderBlock* blockWithWidth = firstContainingBlockWithLogicalWidth(this))
- logicalWidth = blockWithWidth->computeReplacedLogicalWidthRespectingMinMaxWidth(blockWithWidth->computeReplacedLogicalWidthUsing(MainOrPreferredSize, blockWithWidth->style().logicalWidth()), shouldComputePreferred);
+ logicalWidth = blockWithWidth->computeReplacedLogicalWidthRespectingMinMaxWidth(blockWithWidth->computeReplacedLogicalWidthUsing(blockWithWidth->style().logicalWidth()), shouldComputePreferred);
else
logicalWidth = containingBlock()->availableLogicalWidth();
{
// 10.5 Content height: the 'height' property: http://www.w3.org/TR/CSS21/visudet.html#propdef-height
if (hasReplacedLogicalHeight())
- return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplacedLogicalHeightUsing(MainOrPreferredSize, style().logicalHeight()));
+ return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplacedLogicalHeightUsing(style().logicalHeight()));
RenderBox* contentRenderer = embeddedContentBox();
virtual void computePreferredLogicalWidths() override;
virtual bool requiresForcedStyleRecalcPropagation() const override { return true; }
virtual void layout() override;
-
- bool isFlexibleBoxImpl() const override { return true; }
};
} // namespace WebCore
virtual Optional<int> firstLineBaseline() const override { return RenderBlock::firstLineBaseline(); }
virtual Optional<int> inlineBlockBaseline(LineDirectionMode direction) const override { return RenderBlock::inlineBlockBaseline(direction); }
-private:
- bool isFlexibleBoxImpl() const override { return true; }
};
} // namespace WebCore
innerBlockStyle.get().inheritFrom(startStyle);
innerBlockStyle.get().setFlexGrow(1);
+ // min-width: 0; is needed for correct shrinking.
+ // FIXME: Remove this line when https://bugs.webkit.org/show_bug.cgi?id=111790 is fixed.
+ innerBlockStyle.get().setMinWidth(Length(0, Fixed));
innerBlockStyle.get().setDisplay(BLOCK);
innerBlockStyle.get().setDirection(LTR);
private:
virtual bool isRenderMathMLBlock() const override final { return true; }
virtual const char* renderName() const override;
- bool isFlexibleBoxImpl() const override { return true; }
};
class RenderMathMLTable final : public RenderTable {
static float initialLetterSpacing() { return 0; }
static Length initialWordSpacing() { return Length(Fixed); }
static Length initialSize() { return Length(); }
- static Length initialMinSize() { return Length(); }
+ static Length initialMinSize() { return Length(Fixed); }
static Length initialMaxSize() { return Length(Undefined); }
static Length initialOffset() { return Length(); }
static Length initialMargin() { return Length(Fixed); }