https://bugs.webkit.org/show_bug.cgi?id=146020
Reviewed by David Hyatt.
Based on Blink's r193665, r194062, r194887 and r195930 by <cbiesinger@chromium.org>.
Source/WebCore:
As specified here
http://dev.w3.org/csswg/css-flexbox/#min-size-auto the default
value of min-{width|height} is auto for flex items.
In case this patch breaks any website (as it's changing the
default value of those properties) the fix is likely to add:
min-width: 0;
min-height: 0;
to any relevant flexitems.
Test: css3/flexbox/min-size-auto.html
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::isFlexOrGrid): New helper method to identify grids and flexs.
(WebCore::ComputedStyleExtractor::propertyValue): Return auto
for flex items if min-width/height is auto.
* css/CSSParser.cpp:
(WebCore::CSSParser::parseValue):
* html/shadow/SliderThumbElement.cpp:
* rendering/RenderBox.cpp:
(WebCore::RenderBox::constrainLogicalHeightByMinMax):
(WebCore::RenderBox::constrainContentBoxLogicalHeightByMinMax):
(WebCore::RenderBox::computeLogicalWidthInRegionUsing):
(WebCore::RenderBox::computeLogicalHeight):
(WebCore::RenderBox::computeLogicalHeightUsing):
(WebCore::RenderBox::computeContentLogicalHeight):
(WebCore::RenderBox::computeContentAndScrollbarLogicalHeightUsing):
(WebCore::RenderBox::computeReplacedLogicalWidth):
(WebCore::RenderBox::computeReplacedLogicalWidthRespectingMinMaxWidth):
(WebCore::RenderBox::computeReplacedLogicalWidthUsing):
(WebCore::RenderBox::computeReplacedLogicalHeight):
(WebCore::RenderBox::computeReplacedLogicalHeightRespectingMinMaxHeight):
(WebCore::RenderBox::computeReplacedLogicalHeightUsing):
(WebCore::RenderBox::availableLogicalHeightUsing):
(WebCore::RenderBox::computePositionedLogicalWidth):
(WebCore::RenderBox::computePositionedLogicalWidthUsing):
(WebCore::RenderBox::computePositionedLogicalHeight):
(WebCore::RenderBox::computePositionedLogicalHeightUsing):
* rendering/RenderBox.h:
* rendering/RenderButton.h:
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::computeMainAxisExtentForChild):
(WebCore::RenderFlexibleBox::mainAxisExtentIsDefinite):
(WebCore::RenderFlexibleBox::mainAxisLengthIsIndefinite):
(WebCore::RenderFlexibleBox::adjustChildSizeForMinAndMax):
(WebCore::RenderFlexibleBox::mainAxisOverflowForChild):
* rendering/RenderFlexibleBox.h:
(WebCore::RenderFlexibleBox::isFlexibleBoxImpl):
* rendering/RenderFullScreen.h:
* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::computeUsedBreadthOfSpecifiedLength):
* rendering/RenderMediaControlElements.h:
* rendering/RenderMenuList.cpp:
(WebCore::RenderMenuList::adjustInnerStyle): Do not longer set
the min-width explicitly.
* rendering/RenderMenuList.h:
* rendering/RenderMultiColumnSet.cpp:
(WebCore::RenderMultiColumnSet::calculateMaxColumnHeight):
* rendering/RenderNamedFlowFragment.cpp:
(WebCore::RenderNamedFlowFragment::maxPageLogicalHeight):
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::computeReplacedLogicalWidth):
(WebCore::RenderReplaced::computeReplacedLogicalHeight):
* rendering/RenderSlider.h:
* rendering/RenderTextControl.h:
* rendering/RenderTextControlSingleLine.cpp:
(WebCore::RenderTextControlSingleLine::createInnerBlockStyle): Do not longer set
the min-width explicitly.
* rendering/mathml/RenderMathMLBlock.h:
* rendering/style/RenderStyle.h:
LayoutTests:
* TestExpectations: Removed passing flexbox tests.
* css3/flexbox/csswg/flex-flow-007.html: Added min-height: 0px.
* css3/flexbox/flexbox-baseline.html: Ditto.
* css3/flexbox/min-size-auto-expected.txt: Added.
* css3/flexbox/min-size-auto.html: Added.
* css3/flexbox/preferred-widths-orthogonal.html: Added min-height: 0px.
* fast/css/auto-min-size-expected.txt: Check default computed
styles for min-width/height for flex items.
* fast/css/auto-min-size.html: Ditto.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@189567
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2015-09-10 Sergio Villar Senin <svillar@igalia.com>
+
+ min-width/height should default to auto for flexbox items
+ https://bugs.webkit.org/show_bug.cgi?id=146020
+
+ Reviewed by David Hyatt.
+
+ Based on Blink's r193665, r194062, r194887 and r195930 by <cbiesinger@chromium.org>.
+
+ * TestExpectations: Removed passing flexbox tests.
+ * css3/flexbox/csswg/flex-flow-007.html: Added min-height: 0px.
+ * css3/flexbox/flexbox-baseline.html: Ditto.
+ * css3/flexbox/min-size-auto-expected.txt: Added.
+ * css3/flexbox/min-size-auto.html: Added.
+ * css3/flexbox/preferred-widths-orthogonal.html: Added min-height: 0px.
+ * fast/css/auto-min-size-expected.txt: Check default computed
+ styles for min-width/height for flex items.
+ * fast/css/auto-min-size.html: Ditto.
+
2015-09-10 ChangSeok Oh <changseok.oh@collabora.com>
[GTK] Volume bar is broken
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"></div>
+ <div style="-webkit-writing-mode: vertical-rl; height: 20px; width: 40px; border-bottom: 1px solid black; min-height: 0px;"></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"></div>
- <div style="-webkit-writing-mode: vertical-rl; width: 40px; height: 20px"></div>
+ <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>
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>
+ <div class="horizontal-tb nested" data-expected-height=80 data-expect-width=50 style="min-height: 0px;">
<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>
+ <div class="nested horizontal-tb" data-expected-height=30 data-expect-width=40 style="min-height: 0px;">
<div></div>
<div></div>
</div>
PASS div.style.minWidth is ""
PASS getComputedStyle(div)["min-width"] is "0px"
-PASS div.style.minWidth is ""
+PASS div.style.minWidth is "auto"
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 ""
+PASS div.style.minHeight is "auto"
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 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>
<script>
div = document.getElementById('foo');
shouldBe('div.style.minWidth', '""');
div.style.minWidth = 'auto';
div.style.maxWidth = 'auto';
-shouldBe('div.style.minWidth', '""');
+shouldBe('div.style.minWidth', '"auto"');
shouldBe('div.style.maxWidth', '""');
shouldBe('getComputedStyle(div).minWidth', '"0px"');
div.style.minHeight = 'auto';
div.style.maxHeight = 'auto';
-shouldBe('div.style.minHeight', '""');
+shouldBe('div.style.minHeight', '"auto"');
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"');
</script>
<script src='../../resources/js-test-post.js'></script>
+2015-09-10 Sergio Villar Senin <svillar@igalia.com>
+
+ min-width/height should default to auto for flexbox items
+ https://bugs.webkit.org/show_bug.cgi?id=146020
+
+ Reviewed by David Hyatt.
+
+ Based on Blink's r193665, r194062, r194887 and r195930 by <cbiesinger@chromium.org>.
+
+ As specified here
+ http://dev.w3.org/csswg/css-flexbox/#min-size-auto the default
+ value of min-{width|height} is auto for flex items.
+
+ In case this patch breaks any website (as it's changing the
+ default value of those properties) the fix is likely to add:
+
+ min-width: 0;
+ min-height: 0;
+
+ to any relevant flexitems.
+
+ Test: css3/flexbox/min-size-auto.html
+
+ * css/CSSComputedStyleDeclaration.cpp:
+ (WebCore::isFlexOrGrid): New helper method to identify grids and flexs.
+ (WebCore::ComputedStyleExtractor::propertyValue): Return auto
+ for flex items if min-width/height is auto.
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::parseValue):
+ * html/shadow/SliderThumbElement.cpp:
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::constrainLogicalHeightByMinMax):
+ (WebCore::RenderBox::constrainContentBoxLogicalHeightByMinMax):
+ (WebCore::RenderBox::computeLogicalWidthInRegionUsing):
+ (WebCore::RenderBox::computeLogicalHeight):
+ (WebCore::RenderBox::computeLogicalHeightUsing):
+ (WebCore::RenderBox::computeContentLogicalHeight):
+ (WebCore::RenderBox::computeContentAndScrollbarLogicalHeightUsing):
+ (WebCore::RenderBox::computeReplacedLogicalWidth):
+ (WebCore::RenderBox::computeReplacedLogicalWidthRespectingMinMaxWidth):
+ (WebCore::RenderBox::computeReplacedLogicalWidthUsing):
+ (WebCore::RenderBox::computeReplacedLogicalHeight):
+ (WebCore::RenderBox::computeReplacedLogicalHeightRespectingMinMaxHeight):
+ (WebCore::RenderBox::computeReplacedLogicalHeightUsing):
+ (WebCore::RenderBox::availableLogicalHeightUsing):
+ (WebCore::RenderBox::computePositionedLogicalWidth):
+ (WebCore::RenderBox::computePositionedLogicalWidthUsing):
+ (WebCore::RenderBox::computePositionedLogicalHeight):
+ (WebCore::RenderBox::computePositionedLogicalHeightUsing):
+ * rendering/RenderBox.h:
+ * rendering/RenderButton.h:
+ * rendering/RenderFlexibleBox.cpp:
+ (WebCore::RenderFlexibleBox::computeMainAxisExtentForChild):
+ (WebCore::RenderFlexibleBox::mainAxisExtentIsDefinite):
+ (WebCore::RenderFlexibleBox::mainAxisLengthIsIndefinite):
+ (WebCore::RenderFlexibleBox::adjustChildSizeForMinAndMax):
+ (WebCore::RenderFlexibleBox::mainAxisOverflowForChild):
+ * rendering/RenderFlexibleBox.h:
+ (WebCore::RenderFlexibleBox::isFlexibleBoxImpl):
+ * rendering/RenderFullScreen.h:
+ * rendering/RenderGrid.cpp:
+ (WebCore::RenderGrid::computeUsedBreadthOfSpecifiedLength):
+ * rendering/RenderMediaControlElements.h:
+ * rendering/RenderMenuList.cpp:
+ (WebCore::RenderMenuList::adjustInnerStyle): Do not longer set
+ the min-width explicitly.
+ * rendering/RenderMenuList.h:
+ * rendering/RenderMultiColumnSet.cpp:
+ (WebCore::RenderMultiColumnSet::calculateMaxColumnHeight):
+ * rendering/RenderNamedFlowFragment.cpp:
+ (WebCore::RenderNamedFlowFragment::maxPageLogicalHeight):
+ * rendering/RenderReplaced.cpp:
+ (WebCore::RenderReplaced::computeReplacedLogicalWidth):
+ (WebCore::RenderReplaced::computeReplacedLogicalHeight):
+ * rendering/RenderSlider.h:
+ * rendering/RenderTextControl.h:
+ * rendering/RenderTextControlSingleLine.cpp:
+ (WebCore::RenderTextControlSingleLine::createInnerBlockStyle): Do not longer set
+ the min-width explicitly.
+ * rendering/mathml/RenderMathMLBlock.h:
+ * rendering/style/RenderStyle.h:
+
2015-09-10 ChangSeok Oh <changseok.oh@collabora.com>
[GTK] Volume bar is broken
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:
- // FIXME: For flex-items, min-height:auto should compute to min-content.
- if (style->minHeight().isAuto())
+ if (style->minHeight().isAuto()) {
+ if (isFlexOrGrid(styledNode->parentNode()))
+ return cssValuePool.createIdentifierValue(CSSValueAuto);
return zoomAdjustedPixelValue(0, *style);
+ }
return zoomAdjustedPixelValueForLength(style->minHeight(), *style);
case CSSPropertyMinWidth:
- // FIXME: For flex-items, min-width:auto should compute to min-content.
- if (style->minWidth().isAuto())
+ if (style->minWidth().isAuto()) {
+ if (isFlexOrGrid(styledNode->parentNode()))
+ return cssValuePool.createIdentifierValue(CSSValueAuto);
return zoomAdjustedPixelValue(0, *style);
+ }
return zoomAdjustedPixelValueForLength(style->minWidth(), *style);
case CSSPropertyObjectFit:
return cssValuePool.createValue(style->objectFit());
case CSSPropertyWebkitMinLogicalWidth:
case CSSPropertyMinHeight:
case CSSPropertyWebkitMinLogicalHeight:
- validPrimitive = isValidSize(valueWithCalculation);
+ validPrimitive = id == CSSValueAuto || 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(styleToUse.logicalMaxHeight(), intrinsicContentHeight))
+ if (Optional<LayoutUnit> maxH = computeLogicalHeightUsing(MaxSize, styleToUse.logicalMaxHeight(), intrinsicContentHeight))
logicalHeight = std::min(logicalHeight, maxH.value());
}
- if (Optional<LayoutUnit> computedLogicalHeight = computeLogicalHeightUsing(styleToUse.logicalMinHeight(), intrinsicContentHeight))
+ if (Optional<LayoutUnit> computedLogicalHeight = computeLogicalHeightUsing(MinSize, styleToUse.logicalMinHeight(), intrinsicContentHeight))
return std::max(logicalHeight, computedLogicalHeight.value());
return logicalHeight;
}
{
const RenderStyle& styleToUse = style();
if (!styleToUse.logicalMaxHeight().isUndefined()) {
- if (Optional<LayoutUnit> maxH = computeContentLogicalHeight(styleToUse.logicalMaxHeight(), intrinsicContentHeight))
+ if (Optional<LayoutUnit> maxH = computeContentLogicalHeight(MaxSize, styleToUse.logicalMaxHeight(), intrinsicContentHeight))
logicalHeight = std::min(logicalHeight, maxH.value());
}
- if (Optional<LayoutUnit> computedContentLogicalHeight = computeContentLogicalHeight(styleToUse.logicalMinHeight(), intrinsicContentHeight))
+ if (Optional<LayoutUnit> computedContentLogicalHeight = computeContentLogicalHeight(MinSize, 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(style().logicalHeight(), intrinsicHeight).valueOr(computedValues.m_extent);
+ heightResult = computeLogicalHeightUsing(MainOrPreferredSize, 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(const Length& height, Optional<LayoutUnit> intrinsicContentHeight) const
+Optional<LayoutUnit> RenderBox::computeLogicalHeightUsing(SizeType heightType, const Length& height, Optional<LayoutUnit> intrinsicContentHeight) const
{
- if (Optional<LayoutUnit> logicalHeight = computeContentAndScrollbarLogicalHeightUsing(height, intrinsicContentHeight))
+ if (Optional<LayoutUnit> logicalHeight = computeContentAndScrollbarLogicalHeightUsing(heightType, height, intrinsicContentHeight))
return adjustBorderBoxLogicalHeightForBoxSizing(logicalHeight.value());
return Nullopt;
}
-Optional<LayoutUnit> RenderBox::computeContentLogicalHeight(const Length& height, Optional<LayoutUnit> intrinsicContentHeight) const
+Optional<LayoutUnit> RenderBox::computeContentLogicalHeight(SizeType heightType, const Length& height, Optional<LayoutUnit> intrinsicContentHeight) const
{
- if (Optional<LayoutUnit> heightIncludingScrollbar = computeContentAndScrollbarLogicalHeightUsing(height, intrinsicContentHeight))
+ if (Optional<LayoutUnit> heightIncludingScrollbar = computeContentAndScrollbarLogicalHeightUsing(heightType, height, intrinsicContentHeight))
return std::max<LayoutUnit>(0, adjustContentBoxLogicalHeightForBoxSizing(heightIncludingScrollbar) - scrollbarLogicalHeight());
return Nullopt;
}
return LayoutUnit(0);
}
-Optional<LayoutUnit> RenderBox::computeContentAndScrollbarLogicalHeightUsing(const Length& height, Optional<LayoutUnit> intrinsicContentHeight) const
+Optional<LayoutUnit> RenderBox::computeContentAndScrollbarLogicalHeightUsing(SizeType heightType, 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(style().logicalWidth()), shouldComputePreferred);
+ return computeReplacedLogicalWidthRespectingMinMaxWidth(computeReplacedLogicalWidthUsing(MainOrPreferredSize, style().logicalWidth()), shouldComputePreferred);
}
LayoutUnit RenderBox::computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUnit logicalWidth, ShouldComputePreferred shouldComputePreferred) const
{
- 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());
+ 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());
return std::max(minLogicalWidth, std::min(logicalWidth, maxLogicalWidth));
}
-LayoutUnit RenderBox::computeReplacedLogicalWidthUsing(Length logicalWidth) const
+LayoutUnit RenderBox::computeReplacedLogicalWidthUsing(SizeType widthType, 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(style().logicalHeight()));
+ return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplacedLogicalHeightUsing(MainOrPreferredSize, style().logicalHeight()));
}
LayoutUnit RenderBox::computeReplacedLogicalHeightRespectingMinMaxHeight(LayoutUnit logicalHeight) const
{
- LayoutUnit minLogicalHeight = computeReplacedLogicalHeightUsing(style().logicalMinHeight());
- LayoutUnit maxLogicalHeight = style().logicalMaxHeight().isUndefined() ? logicalHeight : computeReplacedLogicalHeightUsing(style().logicalMaxHeight());
+ LayoutUnit minLogicalHeight = computeReplacedLogicalHeightUsing(MinSize, style().logicalMinHeight());
+ LayoutUnit maxLogicalHeight = style().logicalMaxHeight().isUndefined() ? logicalHeight : computeReplacedLogicalHeightUsing(MaxSize, style().logicalMaxHeight());
return std::max(minLogicalHeight, std::min(logicalHeight, maxLogicalHeight));
}
-LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(Length logicalHeight) const
+LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(SizeType heightType, 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(h, Nullopt))
+ if (Optional<LayoutUnit> heightIncludingScrollbar = computeContentAndScrollbarLogicalHeightUsing(MainOrPreferredSize, 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(style().logicalWidth(), containerBlock, containerDirection,
+ computePositionedLogicalWidthUsing(MainOrPreferredSize, style().logicalWidth(), containerBlock, containerDirection,
containerLogicalWidth, bordersPlusPadding,
logicalLeftLength, logicalRightLength, marginLogicalLeft, marginLogicalRight,
computedValues);
if (!style().logicalMaxWidth().isUndefined()) {
LogicalExtentComputedValues maxValues;
- computePositionedLogicalWidthUsing(style().logicalMaxWidth(), containerBlock, containerDirection,
+ computePositionedLogicalWidthUsing(MaxSize, style().logicalMaxWidth(), containerBlock, containerDirection,
containerLogicalWidth, bordersPlusPadding,
logicalLeftLength, logicalRightLength, marginLogicalLeft, marginLogicalRight,
maxValues);
if (!style().logicalMinWidth().isZero() || style().logicalMinWidth().isIntrinsic()) {
LogicalExtentComputedValues minValues;
- computePositionedLogicalWidthUsing(style().logicalMinWidth(), containerBlock, containerDirection,
+ computePositionedLogicalWidthUsing(MinSize, style().logicalMinWidth(), containerBlock, containerDirection,
containerLogicalWidth, bordersPlusPadding,
logicalLeftLength, logicalRightLength, marginLogicalLeft, marginLogicalRight,
minValues);
logicalLeftPos += (child->isHorizontalWritingMode() ? containerBlock->borderLeft() : containerBlock->borderTop());
}
-void RenderBox::computePositionedLogicalWidthUsing(Length logicalWidth, const RenderBoxModelObject* containerBlock, TextDirection containerDirection,
+void RenderBox::computePositionedLogicalWidthUsing(SizeType widthType, Length logicalWidth, const RenderBoxModelObject* containerBlock, TextDirection containerDirection,
LayoutUnit containerLogicalWidth, LayoutUnit bordersPlusPadding,
Length logicalLeft, Length logicalRight, Length marginLogicalLeft, Length marginLogicalRight,
LogicalExtentComputedValues& computedValues) const
{
- if (logicalWidth.isIntrinsic())
+ ASSERT(widthType == MinSize || widthType == MainOrPreferredSize || !logicalWidth.isAuto());
+ if (widthType == MinSize && logicalWidth.isAuto())
+ logicalWidth = Length(0, Fixed);
+ else 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(styleToUse.logicalHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding, logicalHeight,
+ computePositionedLogicalHeightUsing(MainOrPreferredSize, styleToUse.logicalHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding, logicalHeight,
logicalTopLength, logicalBottomLength, marginBefore, marginAfter,
computedValues);
if (!styleToUse.logicalMaxHeight().isUndefined()) {
LogicalExtentComputedValues maxValues;
- computePositionedLogicalHeightUsing(styleToUse.logicalMaxHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding, logicalHeight,
+ computePositionedLogicalHeightUsing(MaxSize, styleToUse.logicalMaxHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding, logicalHeight,
logicalTopLength, logicalBottomLength, marginBefore, marginAfter,
maxValues);
if (!styleToUse.logicalMinHeight().isZero() || styleToUse.logicalMinHeight().isIntrinsic()) {
LogicalExtentComputedValues minValues;
- computePositionedLogicalHeightUsing(styleToUse.logicalMinHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding, logicalHeight,
+ computePositionedLogicalHeightUsing(MinSize, styleToUse.logicalMinHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding, logicalHeight,
logicalTopLength, logicalBottomLength, marginBefore, marginAfter,
minValues);
}
}
-void RenderBox::computePositionedLogicalHeightUsing(Length logicalHeightLength, const RenderBoxModelObject* containerBlock,
+void RenderBox::computePositionedLogicalHeightUsing(SizeType heightType, 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(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;
+ 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;
LayoutUnit computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUnit logicalWidth, ShouldComputePreferred = ComputeActual) const;
- LayoutUnit computeReplacedLogicalHeightUsing(Length height) const;
+ LayoutUnit computeReplacedLogicalHeightUsing(SizeType, Length height) const;
LayoutUnit computeReplacedLogicalHeightRespectingMinMaxHeight(LayoutUnit logicalHeight) const;
virtual LayoutUnit computeReplacedLogicalWidth(ShouldComputePreferred = ComputeActual) const;
LayoutUnit viewLogicalHeightForPercentages() const;
void computePositionedLogicalHeight(LogicalExtentComputedValues&) const;
- void computePositionedLogicalWidthUsing(Length logicalWidth, const RenderBoxModelObject* containerBlock, TextDirection containerDirection,
+ void computePositionedLogicalWidthUsing(SizeType, Length logicalWidth, const RenderBoxModelObject* containerBlock, TextDirection containerDirection,
LayoutUnit containerLogicalWidth, LayoutUnit bordersPlusPadding,
Length logicalLeft, Length logicalRight, Length marginLogicalLeft, Length marginLogicalRight,
LogicalExtentComputedValues&) const;
- void computePositionedLogicalHeightUsing(Length logicalHeightLength, const RenderBoxModelObject* containerBlock,
+ void computePositionedLogicalHeightUsing(SizeType, 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(size, child.logicalHeight() - child.borderAndPaddingLogicalHeight());
+ return child.computeContentLogicalHeight(sizeType, 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();
- if (max.isSpecifiedOrIntrinsic())
- childSize = std::min(childSize, computeMainAxisExtentForChild(child, MaxSize, max).valueOr(childSize));
+ Optional<LayoutUnit> maxExtent = Nullopt;
+ if (max.isSpecifiedOrIntrinsic()) {
+ maxExtent = computeMainAxisExtentForChild(child, MaxSize, max);
+ childSize = std::min(childSize, maxExtent.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(style().logicalHeight(), Nullopt).valueOr(0));
+ return valueForLength(trackLength, computeContentLogicalHeight(MainOrPreferredSize, 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; }
};
// ----------------------------
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.
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(multicolStyle.logicalMaxHeight(), Nullopt).valueOr(maxColumnHeight));
+ maxColumnHeight = std::min(maxColumnHeight, multicolBlock->computeContentLogicalHeight(MaxSize, 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(styleToUse.logicalMaxHeight());
+ return styleToUse.logicalMaxHeight().isUndefined() ? RenderFlowThread::maxLogicalHeight() : downcast<RenderBlock>(*parent()).computeReplacedLogicalHeightUsing(MaxSize, 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(style().logicalWidth()), shouldComputePreferred);
+ return computeReplacedLogicalWidthRespectingMinMaxWidth(computeReplacedLogicalWidthUsing(MainOrPreferredSize, 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(blockWithWidth->style().logicalWidth()), shouldComputePreferred);
+ logicalWidth = blockWithWidth->computeReplacedLogicalWidthRespectingMinMaxWidth(blockWithWidth->computeReplacedLogicalWidthUsing(MainOrPreferredSize, 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(style().logicalHeight()));
+ return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplacedLogicalHeightUsing(MainOrPreferredSize, 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().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(Fixed); }
+ static Length initialMinSize() { return Length(); }
static Length initialMaxSize() { return Length(Undefined); }
static Length initialOffset() { return Length(); }
static Length initialMargin() { return Length(Fixed); }