<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[188873] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/188873">188873</a></dd>
<dt>Author</dt> <dd>mmaxfield@apple.com</dd>
<dt>Date</dt> <dd>2015-08-24 11:48:51 -0700 (Mon, 24 Aug 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Use Optionals in RenderBox height computations
https://bugs.webkit.org/show_bug.cgi?id=147253
Reviewed by David Hyatt.
No new tests because there is no behavior change.
* rendering/RenderBox.cpp:
(WebCore::RenderBox::constrainLogicalHeightByMinMax):
(WebCore::RenderBox::constrainContentBoxLogicalHeightByMinMax):
(WebCore::RenderBox::overrideContainingBlockContentLogicalWidth):
(WebCore::RenderBox::overrideContainingBlockContentLogicalHeight):
(WebCore::RenderBox::setOverrideContainingBlockContentLogicalWidth):
(WebCore::RenderBox::setOverrideContainingBlockContentLogicalHeight):
(WebCore::RenderBox::adjustContentBoxLogicalHeightForBoxSizing):
(WebCore::RenderBox::containingBlockLogicalWidthForContent):
(WebCore::RenderBox::containingBlockLogicalHeightForContent):
(WebCore::RenderBox::perpendicularContainingBlockLogicalHeight):
(WebCore::RenderBox::computeLogicalHeight):
(WebCore::RenderBox::computeLogicalHeightUsing):
(WebCore::RenderBox::computeContentLogicalHeight):
(WebCore::RenderBox::computeIntrinsicLogicalContentHeightUsing):
(WebCore::RenderBox::computeContentAndScrollbarLogicalHeightUsing):
(WebCore::RenderBox::computePercentageLogicalHeight):
(WebCore::RenderBox::computeReplacedLogicalHeightUsing):
(WebCore::RenderBox::availableLogicalHeight):
(WebCore::RenderBox::availableLogicalHeightUsing):
(WebCore::RenderBox::computePositionedLogicalHeightUsing):
(WebCore::logicalWidthIsResolvable):
(WebCore::RenderBox::percentageLogicalHeightIsResolvableFromBlock):
(WebCore::RenderBox::hasDefiniteLogicalHeight):
* rendering/RenderBox.h:
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::computeMainAxisExtentForChild):
(WebCore::RenderFlexibleBox::preferredMainAxisContentExtentForChild):
(WebCore::RenderFlexibleBox::adjustChildSizeForMinAndMax):
* rendering/RenderFlexibleBox.h:
* rendering/RenderFlowThread.cpp:
(WebCore::RenderFlowThread::addForcedRegionBreak):
* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::computeUsedBreadthOfSpecifiedLength):
(WebCore::RenderGrid::logicalContentHeightForChild):
(WebCore::RenderGrid::minContentForChild):
(WebCore::RenderGrid::maxContentForChild):
(WebCore::RenderGrid::layoutGridItems):
(WebCore::RenderGrid::applyStretchAlignmentToChildIfNeeded):
* rendering/RenderMultiColumnSet.cpp:
(WebCore::RenderMultiColumnSet::calculateMaxColumnHeight):
* rendering/RenderTable.cpp:
(WebCore::RenderTable::convertStyleLogicalHeightToComputedHeight):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBoxcpp">trunk/Source/WebCore/rendering/RenderBox.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBoxh">trunk/Source/WebCore/rendering/RenderBox.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderFlexibleBoxcpp">trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderFlexibleBoxh">trunk/Source/WebCore/rendering/RenderFlexibleBox.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderFlowThreadcpp">trunk/Source/WebCore/rendering/RenderFlowThread.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderGridcpp">trunk/Source/WebCore/rendering/RenderGrid.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderMultiColumnSetcpp">trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderTablecpp">trunk/Source/WebCore/rendering/RenderTable.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (188872 => 188873)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-08-24 18:46:44 UTC (rev 188872)
+++ trunk/Source/WebCore/ChangeLog        2015-08-24 18:48:51 UTC (rev 188873)
</span><span class="lines">@@ -1,3 +1,56 @@
</span><ins>+2015-08-24 Myles C. Maxfield <mmaxfield@apple.com>
+
+ Use Optionals in RenderBox height computations
+ https://bugs.webkit.org/show_bug.cgi?id=147253
+
+ Reviewed by David Hyatt.
+
+ No new tests because there is no behavior change.
+
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::constrainLogicalHeightByMinMax):
+ (WebCore::RenderBox::constrainContentBoxLogicalHeightByMinMax):
+ (WebCore::RenderBox::overrideContainingBlockContentLogicalWidth):
+ (WebCore::RenderBox::overrideContainingBlockContentLogicalHeight):
+ (WebCore::RenderBox::setOverrideContainingBlockContentLogicalWidth):
+ (WebCore::RenderBox::setOverrideContainingBlockContentLogicalHeight):
+ (WebCore::RenderBox::adjustContentBoxLogicalHeightForBoxSizing):
+ (WebCore::RenderBox::containingBlockLogicalWidthForContent):
+ (WebCore::RenderBox::containingBlockLogicalHeightForContent):
+ (WebCore::RenderBox::perpendicularContainingBlockLogicalHeight):
+ (WebCore::RenderBox::computeLogicalHeight):
+ (WebCore::RenderBox::computeLogicalHeightUsing):
+ (WebCore::RenderBox::computeContentLogicalHeight):
+ (WebCore::RenderBox::computeIntrinsicLogicalContentHeightUsing):
+ (WebCore::RenderBox::computeContentAndScrollbarLogicalHeightUsing):
+ (WebCore::RenderBox::computePercentageLogicalHeight):
+ (WebCore::RenderBox::computeReplacedLogicalHeightUsing):
+ (WebCore::RenderBox::availableLogicalHeight):
+ (WebCore::RenderBox::availableLogicalHeightUsing):
+ (WebCore::RenderBox::computePositionedLogicalHeightUsing):
+ (WebCore::logicalWidthIsResolvable):
+ (WebCore::RenderBox::percentageLogicalHeightIsResolvableFromBlock):
+ (WebCore::RenderBox::hasDefiniteLogicalHeight):
+ * rendering/RenderBox.h:
+ * rendering/RenderFlexibleBox.cpp:
+ (WebCore::RenderFlexibleBox::computeMainAxisExtentForChild):
+ (WebCore::RenderFlexibleBox::preferredMainAxisContentExtentForChild):
+ (WebCore::RenderFlexibleBox::adjustChildSizeForMinAndMax):
+ * rendering/RenderFlexibleBox.h:
+ * rendering/RenderFlowThread.cpp:
+ (WebCore::RenderFlowThread::addForcedRegionBreak):
+ * rendering/RenderGrid.cpp:
+ (WebCore::RenderGrid::computeUsedBreadthOfSpecifiedLength):
+ (WebCore::RenderGrid::logicalContentHeightForChild):
+ (WebCore::RenderGrid::minContentForChild):
+ (WebCore::RenderGrid::maxContentForChild):
+ (WebCore::RenderGrid::layoutGridItems):
+ (WebCore::RenderGrid::applyStretchAlignmentToChildIfNeeded):
+ * rendering/RenderMultiColumnSet.cpp:
+ (WebCore::RenderMultiColumnSet::calculateMaxColumnHeight):
+ * rendering/RenderTable.cpp:
+ (WebCore::RenderTable::convertStyleLogicalHeightToComputedHeight):
+
</ins><span class="cx"> 2015-08-24 Anders Carlsson <andersca@apple.com>
</span><span class="cx">
</span><span class="cx"> Fix failing tests.
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (188872 => 188873)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBox.cpp        2015-08-24 18:46:44 UTC (rev 188872)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp        2015-08-24 18:48:51 UTC (rev 188873)
</span><span class="lines">@@ -92,8 +92,9 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(CSS_GRID_LAYOUT)
</span><span class="cx"> // Used by grid elements to properly size their grid items.
</span><del>-static OverrideSizeMap* gOverrideContainingBlockLogicalHeightMap = nullptr;
-static OverrideSizeMap* gOverrideContainingBlockLogicalWidthMap = nullptr;
</del><ins>+typedef WTF::HashMap<const RenderBox*, Optional<LayoutUnit>> OverrideOptionalSizeMap;
+static OverrideOptionalSizeMap* gOverrideContainingBlockLogicalHeightMap = nullptr;
+static OverrideOptionalSizeMap* gOverrideContainingBlockLogicalWidthMap = nullptr;
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> // Size of border belt for autoscroll. When mouse pointer in border belt,
</span><span class="lines">@@ -663,26 +664,28 @@
</span><span class="cx"> return std::max(logicalWidth, computeLogicalWidthInRegionUsing(MinSize, styleToUse.logicalMinWidth(), availableWidth, cb, region));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-LayoutUnit RenderBox::constrainLogicalHeightByMinMax(LayoutUnit logicalHeight, LayoutUnit intrinsicContentHeight) const
</del><ins>+LayoutUnit RenderBox::constrainLogicalHeightByMinMax(LayoutUnit logicalHeight, Optional<LayoutUnit> intrinsicContentHeight) const
</ins><span class="cx"> {
</span><span class="cx"> const RenderStyle& styleToUse = style();
</span><span class="cx"> if (!styleToUse.logicalMaxHeight().isUndefined()) {
</span><del>- LayoutUnit maxH = computeLogicalHeightUsing(styleToUse.logicalMaxHeight(), intrinsicContentHeight);
- if (maxH != -1)
- logicalHeight = std::min(logicalHeight, maxH);
</del><ins>+ if (Optional<LayoutUnit> maxH = computeLogicalHeightUsing(styleToUse.logicalMaxHeight(), intrinsicContentHeight))
+ logicalHeight = std::min(logicalHeight, maxH.value());
</ins><span class="cx"> }
</span><del>- return std::max(logicalHeight, computeLogicalHeightUsing(styleToUse.logicalMinHeight(), intrinsicContentHeight));
</del><ins>+ if (Optional<LayoutUnit> computedLogicalHeight = computeLogicalHeightUsing(styleToUse.logicalMinHeight(), intrinsicContentHeight))
+ return std::max(logicalHeight, computedLogicalHeight.value());
+ return logicalHeight;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-LayoutUnit RenderBox::constrainContentBoxLogicalHeightByMinMax(LayoutUnit logicalHeight, LayoutUnit intrinsicContentHeight) const
</del><ins>+LayoutUnit RenderBox::constrainContentBoxLogicalHeightByMinMax(LayoutUnit logicalHeight, Optional<LayoutUnit> intrinsicContentHeight) const
</ins><span class="cx"> {
</span><span class="cx"> const RenderStyle& styleToUse = style();
</span><span class="cx"> if (!styleToUse.logicalMaxHeight().isUndefined()) {
</span><del>- LayoutUnit maxH = computeContentLogicalHeight(styleToUse.logicalMaxHeight(), intrinsicContentHeight);
- if (maxH != -1)
- logicalHeight = std::min(logicalHeight, maxH);
</del><ins>+ if (Optional<LayoutUnit> maxH = computeContentLogicalHeight(styleToUse.logicalMaxHeight(), intrinsicContentHeight))
+ logicalHeight = std::min(logicalHeight, maxH.value());
</ins><span class="cx"> }
</span><del>- return std::max(logicalHeight, computeContentLogicalHeight(styleToUse.logicalMinHeight(), intrinsicContentHeight));
</del><ins>+ if (Optional<LayoutUnit> computedContentLogicalHeight = computeContentLogicalHeight(styleToUse.logicalMinHeight(), intrinsicContentHeight))
+ return std::max(logicalHeight, computedContentLogicalHeight.value());
+ return logicalHeight;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> RoundedRect::Radii RenderBox::borderRadii() const
</span><span class="lines">@@ -1108,13 +1111,13 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #if ENABLE(CSS_GRID_LAYOUT)
</span><del>-LayoutUnit RenderBox::overrideContainingBlockContentLogicalWidth() const
</del><ins>+Optional<LayoutUnit> RenderBox::overrideContainingBlockContentLogicalWidth() const
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(hasOverrideContainingBlockLogicalWidth());
</span><span class="cx"> return gOverrideContainingBlockLogicalWidthMap->get(this);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-LayoutUnit RenderBox::overrideContainingBlockContentLogicalHeight() const
</del><ins>+Optional<LayoutUnit> RenderBox::overrideContainingBlockContentLogicalHeight() const
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(hasOverrideContainingBlockLogicalHeight());
</span><span class="cx"> return gOverrideContainingBlockLogicalHeightMap->get(this);
</span><span class="lines">@@ -1130,17 +1133,17 @@
</span><span class="cx"> return gOverrideContainingBlockLogicalHeightMap && gOverrideContainingBlockLogicalHeightMap->contains(this);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void RenderBox::setOverrideContainingBlockContentLogicalWidth(LayoutUnit logicalWidth)
</del><ins>+void RenderBox::setOverrideContainingBlockContentLogicalWidth(Optional<LayoutUnit> logicalWidth)
</ins><span class="cx"> {
</span><span class="cx"> if (!gOverrideContainingBlockLogicalWidthMap)
</span><del>- gOverrideContainingBlockLogicalWidthMap = new OverrideSizeMap;
</del><ins>+ gOverrideContainingBlockLogicalWidthMap = new OverrideOptionalSizeMap;
</ins><span class="cx"> gOverrideContainingBlockLogicalWidthMap->set(this, logicalWidth);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void RenderBox::setOverrideContainingBlockContentLogicalHeight(LayoutUnit logicalHeight)
</del><ins>+void RenderBox::setOverrideContainingBlockContentLogicalHeight(Optional<LayoutUnit> logicalHeight)
</ins><span class="cx"> {
</span><span class="cx"> if (!gOverrideContainingBlockLogicalHeightMap)
</span><del>- gOverrideContainingBlockLogicalHeightMap = new OverrideSizeMap;
</del><ins>+ gOverrideContainingBlockLogicalHeightMap = new OverrideOptionalSizeMap;
</ins><span class="cx"> gOverrideContainingBlockLogicalHeightMap->set(this, logicalHeight);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1181,11 +1184,14 @@
</span><span class="cx"> return std::max<LayoutUnit>(0, width);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-LayoutUnit RenderBox::adjustContentBoxLogicalHeightForBoxSizing(LayoutUnit height) const
</del><ins>+LayoutUnit RenderBox::adjustContentBoxLogicalHeightForBoxSizing(Optional<LayoutUnit> height) const
</ins><span class="cx"> {
</span><ins>+ if (!height)
+ return 0;
+ LayoutUnit result = height.value();
</ins><span class="cx"> if (style().boxSizing() == BORDER_BOX)
</span><del>- height -= borderAndPaddingLogicalHeight();
- return std::max<LayoutUnit>(0, height);
</del><ins>+ result -= borderAndPaddingLogicalHeight();
+ return std::max(LayoutUnit(), result);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Hit Testing
</span><span class="lines">@@ -1874,26 +1880,24 @@
</span><span class="cx"> {
</span><span class="cx"> #if ENABLE(CSS_GRID_LAYOUT)
</span><span class="cx"> if (hasOverrideContainingBlockLogicalWidth())
</span><del>- return overrideContainingBlockContentLogicalWidth();
</del><ins>+ return overrideContainingBlockContentLogicalWidth().valueOr(-1);
</ins><span class="cx"> #endif
</span><span class="cx">
</span><del>- RenderBlock* cb = containingBlock();
- if (!cb)
- return LayoutUnit();
- return cb->availableLogicalWidth();
</del><ins>+ if (RenderBlock* cb = containingBlock())
+ return cb->availableLogicalWidth();
+ return LayoutUnit();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> LayoutUnit RenderBox::containingBlockLogicalHeightForContent(AvailableLogicalHeightType heightType) const
</span><span class="cx"> {
</span><span class="cx"> #if ENABLE(CSS_GRID_LAYOUT)
</span><span class="cx"> if (hasOverrideContainingBlockLogicalHeight())
</span><del>- return overrideContainingBlockContentLogicalHeight();
</del><ins>+ return overrideContainingBlockContentLogicalHeight().valueOr(-1);
</ins><span class="cx"> #endif
</span><span class="cx">
</span><del>- RenderBlock* cb = containingBlock();
- if (!cb)
- return LayoutUnit();
- return cb->availableLogicalHeight(heightType);
</del><ins>+ if (RenderBlock* cb = containingBlock())
+ return cb->availableLogicalHeight(heightType);
+ return LayoutUnit();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> LayoutUnit RenderBox::containingBlockLogicalWidthForContentInRegion(RenderRegion* region) const
</span><span class="lines">@@ -1929,7 +1933,7 @@
</span><span class="cx"> {
</span><span class="cx"> #if ENABLE(CSS_GRID_LAYOUT)
</span><span class="cx"> if (hasOverrideContainingBlockLogicalHeight())
</span><del>- return overrideContainingBlockContentLogicalHeight();
</del><ins>+ return overrideContainingBlockContentLogicalHeight().valueOr(-1);
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> RenderBlock* cb = containingBlock();
</span><span class="lines">@@ -1947,7 +1951,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Use the content box logical height as specified by the style.
</span><del>- return cb->adjustContentBoxLogicalHeightForBoxSizing(logicalHeightLength.value());
</del><ins>+ return cb->adjustContentBoxLogicalHeightForBoxSizing(LayoutUnit(logicalHeightLength.value()));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void RenderBox::mapLocalToContainer(const RenderLayerModelObject* repaintContainer, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed) const
</span><span class="lines">@@ -2767,9 +2771,7 @@
</span><span class="cx"> LayoutUnit heightResult;
</span><span class="cx"> if (checkMinMaxHeight) {
</span><span class="cx"> LayoutUnit intrinsicHeight = computedValues.m_extent - borderAndPaddingLogicalHeight();
</span><del>- heightResult = computeLogicalHeightUsing(style().logicalHeight(), intrinsicHeight);
- if (heightResult == -1)
- heightResult = computedValues.m_extent;
</del><ins>+ heightResult = computeLogicalHeightUsing(style().logicalHeight(), intrinsicHeight).valueOr(computedValues.m_extent);
</ins><span class="cx"> heightResult = constrainLogicalHeightByMinMax(heightResult, intrinsicHeight);
</span><span class="cx"> } else {
</span><span class="cx"> // The only times we don't check min/max height are when a fixed length has
</span><span class="lines">@@ -2808,23 +2810,21 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-LayoutUnit RenderBox::computeLogicalHeightUsing(const Length& height, LayoutUnit intrinsicContentHeight) const
</del><ins>+Optional<LayoutUnit> RenderBox::computeLogicalHeightUsing(const Length& height, Optional<LayoutUnit> intrinsicContentHeight) const
</ins><span class="cx"> {
</span><del>- LayoutUnit logicalHeight = computeContentAndScrollbarLogicalHeightUsing(height, intrinsicContentHeight);
- if (logicalHeight != -1)
- logicalHeight = adjustBorderBoxLogicalHeightForBoxSizing(logicalHeight);
- return logicalHeight;
</del><ins>+ if (Optional<LayoutUnit> logicalHeight = computeContentAndScrollbarLogicalHeightUsing(height, intrinsicContentHeight))
+ return adjustBorderBoxLogicalHeightForBoxSizing(logicalHeight.value());
+ return Nullopt;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-LayoutUnit RenderBox::computeContentLogicalHeight(const Length& height, LayoutUnit intrinsicContentHeight) const
</del><ins>+Optional<LayoutUnit> RenderBox::computeContentLogicalHeight(const Length& height, Optional<LayoutUnit> intrinsicContentHeight) const
</ins><span class="cx"> {
</span><del>- LayoutUnit heightIncludingScrollbar = computeContentAndScrollbarLogicalHeightUsing(height, intrinsicContentHeight);
- if (heightIncludingScrollbar == -1)
- return -1;
- return std::max<LayoutUnit>(0, adjustContentBoxLogicalHeightForBoxSizing(heightIncludingScrollbar) - scrollbarLogicalHeight());
</del><ins>+ if (Optional<LayoutUnit> heightIncludingScrollbar = computeContentAndScrollbarLogicalHeightUsing(height, intrinsicContentHeight))
+ return std::max<LayoutUnit>(0, adjustContentBoxLogicalHeightForBoxSizing(heightIncludingScrollbar) - scrollbarLogicalHeight());
+ return Nullopt;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-LayoutUnit RenderBox::computeIntrinsicLogicalContentHeightUsing(Length logicalHeightLength, LayoutUnit intrinsicContentHeight, LayoutUnit borderAndPadding) const
</del><ins>+Optional<LayoutUnit> RenderBox::computeIntrinsicLogicalContentHeightUsing(Length logicalHeightLength, Optional<LayoutUnit> intrinsicContentHeight, LayoutUnit borderAndPadding) const
</ins><span class="cx"> {
</span><span class="cx"> // FIXME: The CSS sizing spec is considering changing what min-content/max-content should resolve to.
</span><span class="cx"> // If that happens, this code will have to change.
</span><span class="lines">@@ -2833,20 +2833,20 @@
</span><span class="cx"> if (logicalHeightLength.isFillAvailable())
</span><span class="cx"> return containingBlock()->availableLogicalHeight(ExcludeMarginBorderPadding) - borderAndPadding;
</span><span class="cx"> ASSERT_NOT_REACHED();
</span><del>- return 0;
</del><ins>+ return LayoutUnit(0);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-LayoutUnit RenderBox::computeContentAndScrollbarLogicalHeightUsing(const Length& height, LayoutUnit intrinsicContentHeight) const
</del><ins>+Optional<LayoutUnit> RenderBox::computeContentAndScrollbarLogicalHeightUsing(const Length& height, Optional<LayoutUnit> intrinsicContentHeight) const
</ins><span class="cx"> {
</span><span class="cx"> // FIXME: The CSS sizing spec is considering changing what min-content/max-content should resolve to.
</span><span class="cx"> // If that happens, this code will have to change.
</span><span class="cx"> if (height.isIntrinsic())
</span><span class="cx"> return computeIntrinsicLogicalContentHeightUsing(height, intrinsicContentHeight, borderAndPaddingLogicalHeight());
</span><span class="cx"> if (height.isFixed())
</span><del>- return height.value();
</del><ins>+ return LayoutUnit(height.value());
</ins><span class="cx"> if (height.isPercentOrCalculated())
</span><span class="cx"> return computePercentageLogicalHeight(height);
</span><del>- return -1;
</del><ins>+ return Nullopt;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool RenderBox::skipContainingBlockForPercentHeightCalculation(const RenderBox* containingBlock, bool isPerpendicularWritingMode) const
</span><span class="lines">@@ -2863,9 +2863,9 @@
</span><span class="cx"> return !containingBlock->isTableCell() && !containingBlock->isOutOfFlowPositioned() && containingBlock->style().logicalHeight().isAuto() && isHorizontalWritingMode() == containingBlock->isHorizontalWritingMode();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-LayoutUnit RenderBox::computePercentageLogicalHeight(const Length& height) const
</del><ins>+Optional<LayoutUnit> RenderBox::computePercentageLogicalHeight(const Length& height) const
</ins><span class="cx"> {
</span><del>- LayoutUnit availableHeight = -1;
</del><ins>+ Optional<LayoutUnit> availableHeight;
</ins><span class="cx">
</span><span class="cx"> bool skippedAutoHeightContainingBlock = false;
</span><span class="cx"> RenderBlock* cb = containingBlock();
</span><span class="lines">@@ -2910,25 +2910,24 @@
</span><span class="cx"> // preferable to the alternative (sizing intrinsically and making the row end up too big).
</span><span class="cx"> RenderTableCell& cell = downcast<RenderTableCell>(*cb);
</span><span class="cx"> if (scrollsOverflowY() && (!cell.style().logicalHeight().isAuto() || !cell.table()->style().logicalHeight().isAuto()))
</span><del>- return 0;
- return -1;
</del><ins>+ return LayoutUnit(0);
+ return Nullopt;
</ins><span class="cx"> }
</span><span class="cx"> availableHeight = cb->overrideLogicalContentHeight();
</span><span class="cx"> includeBorderPadding = true;
</span><span class="cx"> }
</span><span class="cx"> } else if (cbstyle.logicalHeight().isFixed()) {
</span><del>- LayoutUnit contentBoxHeight = cb->adjustContentBoxLogicalHeightForBoxSizing(cbstyle.logicalHeight().value());
- availableHeight = std::max<LayoutUnit>(0, cb->constrainContentBoxLogicalHeightByMinMax(contentBoxHeight - cb->scrollbarLogicalHeight(), -1));
</del><ins>+ LayoutUnit contentBoxHeight = cb->adjustContentBoxLogicalHeightForBoxSizing(LayoutUnit(cbstyle.logicalHeight().value()));
+ availableHeight = std::max<LayoutUnit>(0, cb->constrainContentBoxLogicalHeightByMinMax(contentBoxHeight - cb->scrollbarLogicalHeight(), Nullopt));
</ins><span class="cx"> } else if (cbstyle.logicalHeight().isPercentOrCalculated() && !isOutOfFlowPositionedWithSpecifiedHeight) {
</span><span class="cx"> // We need to recur and compute the percentage height for our containing block.
</span><del>- LayoutUnit heightWithScrollbar = cb->computePercentageLogicalHeight(cbstyle.logicalHeight());
- if (heightWithScrollbar != -1) {
</del><ins>+ if (Optional<LayoutUnit> heightWithScrollbar = cb->computePercentageLogicalHeight(cbstyle.logicalHeight())) {
</ins><span class="cx"> LayoutUnit contentBoxHeightWithScrollbar = cb->adjustContentBoxLogicalHeightForBoxSizing(heightWithScrollbar);
</span><span class="cx"> // We need to adjust for min/max height because this method does not
</span><span class="cx"> // handle the min/max of the current block, its caller does. So the
</span><span class="cx"> // return value from the recursive call will not have been adjusted
</span><span class="cx"> // yet.
</span><del>- LayoutUnit contentBoxHeight = cb->constrainContentBoxLogicalHeightByMinMax(contentBoxHeightWithScrollbar - cb->scrollbarLogicalHeight(), -1);
</del><ins>+ LayoutUnit contentBoxHeight = cb->constrainContentBoxLogicalHeightByMinMax(contentBoxHeightWithScrollbar - cb->scrollbarLogicalHeight(), Nullopt);
</ins><span class="cx"> availableHeight = std::max<LayoutUnit>(0, contentBoxHeight);
</span><span class="cx"> }
</span><span class="cx"> } else if (isOutOfFlowPositionedWithSpecifiedHeight) {
</span><span class="lines">@@ -2940,12 +2939,10 @@
</span><span class="cx"> } else if (cb->isRenderView())
</span><span class="cx"> availableHeight = view().pageOrViewLogicalHeight();
</span><span class="cx">
</span><del>- if (availableHeight == -1)
</del><ins>+ if (!availableHeight)
</ins><span class="cx"> return availableHeight;
</span><span class="cx">
</span><del>- availableHeight -= rootMarginBorderPaddingHeight;
-
- LayoutUnit result = valueForLength(height, availableHeight);
</del><ins>+ LayoutUnit result = valueForLength(height, availableHeight.value() - rootMarginBorderPaddingHeight);
</ins><span class="cx"> if (includeBorderPadding) {
</span><span class="cx"> // FIXME: Table cells should default to box-sizing: border-box so we can avoid this hack.
</span><span class="cx"> // It is necessary to use the border-box to match WinIE's broken
</span><span class="lines">@@ -3025,7 +3022,7 @@
</span><span class="cx"> {
</span><span class="cx"> switch (logicalHeight.type()) {
</span><span class="cx"> case Fixed:
</span><del>- return adjustContentBoxLogicalHeightForBoxSizing(logicalHeight.value());
</del><ins>+ return adjustContentBoxLogicalHeightForBoxSizing(LayoutUnit(logicalHeight.value()));
</ins><span class="cx"> case Percent:
</span><span class="cx"> case Calculated:
</span><span class="cx"> {
</span><span class="lines">@@ -3085,7 +3082,7 @@
</span><span class="cx">
</span><span class="cx"> LayoutUnit RenderBox::availableLogicalHeight(AvailableLogicalHeightType heightType) const
</span><span class="cx"> {
</span><del>- return constrainLogicalHeightByMinMax(availableLogicalHeightUsing(style().logicalHeight(), heightType), -1);
</del><ins>+ return constrainLogicalHeightByMinMax(availableLogicalHeightUsing(style().logicalHeight(), heightType), Nullopt);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> LayoutUnit RenderBox::availableLogicalHeightUsing(const Length& h, AvailableLogicalHeightType heightType) const
</span><span class="lines">@@ -3105,8 +3102,7 @@
</span><span class="cx"> return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(h, availableHeight));
</span><span class="cx"> }
</span><span class="cx">
</span><del>- LayoutUnit heightIncludingScrollbar = computeContentAndScrollbarLogicalHeightUsing(h, -1);
- if (heightIncludingScrollbar != -1)
</del><ins>+ if (Optional<LayoutUnit> heightIncludingScrollbar = computeContentAndScrollbarLogicalHeightUsing(h, Nullopt))
</ins><span class="cx"> return std::max<LayoutUnit>(0, adjustContentBoxLogicalHeightForBoxSizing(heightIncludingScrollbar) - scrollbarLogicalHeight());
</span><span class="cx">
</span><span class="cx"> // FIXME: Check logicalTop/logicalBottom here to correctly handle vertical writing-mode.
</span><span class="lines">@@ -3808,7 +3804,7 @@
</span><span class="cx"> logicalHeightIsAuto = false;
</span><span class="cx"> } else {
</span><span class="cx"> if (logicalHeightLength.isIntrinsic())
</span><del>- resolvedLogicalHeight = computeIntrinsicLogicalContentHeightUsing(logicalHeightLength, contentLogicalHeight, bordersPlusPadding);
</del><ins>+ resolvedLogicalHeight = computeIntrinsicLogicalContentHeightUsing(logicalHeightLength, contentLogicalHeight, bordersPlusPadding).value();
</ins><span class="cx"> else
</span><span class="cx"> resolvedLogicalHeight = adjustContentBoxLogicalHeightForBoxSizing(valueForLength(logicalHeightLength, containerLogicalHeight));
</span><span class="cx"> }
</span><span class="lines">@@ -4533,7 +4529,7 @@
</span><span class="cx"> return true;
</span><span class="cx"> #if ENABLE(CSS_GRID_LAYOUT)
</span><span class="cx"> if (box->hasOverrideContainingBlockLogicalWidth())
</span><del>- return box->overrideContainingBlockContentLogicalWidth() != -1;
</del><ins>+ return static_cast<bool>(box->overrideContainingBlockContentLogicalWidth());
</ins><span class="cx"> #endif
</span><span class="cx"> if (box->style().logicalWidth().isPercentOrCalculated())
</span><span class="cx"> return logicalWidthIsResolvable(*box->containingBlock());
</span><span class="lines">@@ -4565,7 +4561,7 @@
</span><span class="cx"> break;
</span><span class="cx"> #if ENABLE(CSS_GRID_LAYOUT)
</span><span class="cx"> if (cb->hasOverrideContainingBlockLogicalHeight())
</span><del>- return cb->overrideContainingBlockContentLogicalHeight() != -1;
</del><ins>+ return static_cast<bool>(cb->overrideContainingBlockContentLogicalHeight());
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> cb = cb->containingBlock();
</span><span class="lines">@@ -4611,7 +4607,7 @@
</span><span class="cx"> return true;
</span><span class="cx"> #if ENABLE(CSS_GRID_LAYOUT)
</span><span class="cx"> if (hasOverrideContainingBlockLogicalHeight())
</span><del>- return overrideContainingBlockContentLogicalHeight() != -1;
</del><ins>+ return static_cast<bool>(overrideContainingBlockContentLogicalHeight());
</ins><span class="cx"> #endif
</span><span class="cx"> if (logicalHeight.isIntrinsicOrAuto())
</span><span class="cx"> return false;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBox.h (188872 => 188873)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBox.h        2015-08-24 18:46:44 UTC (rev 188872)
+++ trunk/Source/WebCore/rendering/RenderBox.h        2015-08-24 18:48:51 UTC (rev 188873)
</span><span class="lines">@@ -87,8 +87,8 @@
</span><span class="cx"> LayoutUnit logicalHeight() const { return style().isHorizontalWritingMode() ? height() : width(); }
</span><span class="cx">
</span><span class="cx"> LayoutUnit constrainLogicalWidthInRegionByMinMax(LayoutUnit, LayoutUnit, RenderBlock*, RenderRegion* = nullptr) const;
</span><del>- LayoutUnit constrainLogicalHeightByMinMax(LayoutUnit logicalHeight, LayoutUnit intrinsicContentHeight) const;
- LayoutUnit constrainContentBoxLogicalHeightByMinMax(LayoutUnit logicalHeight, LayoutUnit intrinsicContentHeight) const;
</del><ins>+ LayoutUnit constrainLogicalHeightByMinMax(LayoutUnit logicalHeight, Optional<LayoutUnit> intrinsicContentHeight) const;
+ LayoutUnit constrainContentBoxLogicalHeightByMinMax(LayoutUnit logicalHeight, Optional<LayoutUnit> intrinsicContentHeight) const;
</ins><span class="cx">
</span><span class="cx"> void setLogicalLeft(LayoutUnit left)
</span><span class="cx"> {
</span><span class="lines">@@ -318,12 +318,12 @@
</span><span class="cx"> void clearOverrideLogicalContentWidth();
</span><span class="cx">
</span><span class="cx"> #if ENABLE(CSS_GRID_LAYOUT)
</span><del>- LayoutUnit overrideContainingBlockContentLogicalWidth() const;
- LayoutUnit overrideContainingBlockContentLogicalHeight() const;
</del><ins>+ Optional<LayoutUnit> overrideContainingBlockContentLogicalWidth() const;
+ Optional<LayoutUnit> overrideContainingBlockContentLogicalHeight() const;
</ins><span class="cx"> bool hasOverrideContainingBlockLogicalWidth() const;
</span><span class="cx"> bool hasOverrideContainingBlockLogicalHeight() const;
</span><del>- void setOverrideContainingBlockContentLogicalWidth(LayoutUnit);
- void setOverrideContainingBlockContentLogicalHeight(LayoutUnit);
</del><ins>+ void setOverrideContainingBlockContentLogicalWidth(Optional<LayoutUnit>);
+ void setOverrideContainingBlockContentLogicalHeight(Optional<LayoutUnit>);
</ins><span class="cx"> void clearContainingBlockOverrideSize();
</span><span class="cx"> void clearOverrideContainingBlockContentLogicalHeight();
</span><span class="cx"> #endif
</span><span class="lines">@@ -333,7 +333,7 @@
</span><span class="cx"> LayoutUnit adjustBorderBoxLogicalWidthForBoxSizing(LayoutUnit width) const;
</span><span class="cx"> LayoutUnit adjustBorderBoxLogicalHeightForBoxSizing(LayoutUnit height) const;
</span><span class="cx"> LayoutUnit adjustContentBoxLogicalWidthForBoxSizing(LayoutUnit width) const;
</span><del>- LayoutUnit adjustContentBoxLogicalHeightForBoxSizing(LayoutUnit height) const;
</del><ins>+ LayoutUnit adjustContentBoxLogicalHeightForBoxSizing(Optional<LayoutUnit> height) const;
</ins><span class="cx">
</span><span class="cx"> struct ComputedMarginValues {
</span><span class="cx"> ComputedMarginValues()
</span><span class="lines">@@ -421,9 +421,9 @@
</span><span class="cx"> LayoutUnit shrinkLogicalWidthToAvoidFloats(LayoutUnit childMarginStart, LayoutUnit childMarginEnd, const RenderBlock* cb, RenderRegion*) const;
</span><span class="cx">
</span><span class="cx"> LayoutUnit computeLogicalWidthInRegionUsing(SizeType, Length logicalWidth, LayoutUnit availableLogicalWidth, const RenderBlock* containingBlock, RenderRegion*) const;
</span><del>- LayoutUnit computeLogicalHeightUsing(const Length& height, LayoutUnit intrinsicContentHeight) const;
- LayoutUnit computeContentLogicalHeight(const Length& height, LayoutUnit intrinsicContentHeight) const;
- LayoutUnit computeContentAndScrollbarLogicalHeightUsing(const Length& height, LayoutUnit intrinsicContentHeight) const;
</del><ins>+ 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;
</ins><span class="cx"> LayoutUnit computeReplacedLogicalWidthUsing(Length width) const;
</span><span class="cx"> LayoutUnit computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUnit logicalWidth, ShouldComputePreferred = ComputeActual) const;
</span><span class="cx"> LayoutUnit computeReplacedLogicalHeightUsing(Length height) const;
</span><span class="lines">@@ -435,7 +435,7 @@
</span><span class="cx"> bool hasDefiniteLogicalWidth() const;
</span><span class="cx"> static bool percentageLogicalHeightIsResolvableFromBlock(const RenderBlock* containingBlock, bool outOfFlowPositioned);
</span><span class="cx"> bool hasDefiniteLogicalHeight() const;
</span><del>- LayoutUnit computePercentageLogicalHeight(const Length& height) const;
</del><ins>+ Optional<LayoutUnit> computePercentageLogicalHeight(const Length& height) const;
</ins><span class="cx">
</span><span class="cx"> virtual LayoutUnit availableLogicalWidth() const { return contentLogicalWidth(); }
</span><span class="cx"> virtual LayoutUnit availableLogicalHeight(AvailableLogicalHeightType) const;
</span><span class="lines">@@ -646,7 +646,7 @@
</span><span class="cx"> void computePositionedLogicalWidth(LogicalExtentComputedValues&, RenderRegion* = nullptr) const;
</span><span class="cx">
</span><span class="cx"> LayoutUnit computeIntrinsicLogicalWidthUsing(Length logicalWidthLength, LayoutUnit availableLogicalWidth, LayoutUnit borderAndPadding) const;
</span><del>- LayoutUnit computeIntrinsicLogicalContentHeightUsing(Length logicalHeightLength, LayoutUnit intrinsicContentHeight, LayoutUnit borderAndPadding) const;
</del><ins>+ Optional<LayoutUnit> computeIntrinsicLogicalContentHeightUsing(Length logicalHeightLength, Optional<LayoutUnit> intrinsicContentHeight, LayoutUnit borderAndPadding) const;
</ins><span class="cx">
</span><span class="cx"> virtual bool shouldComputeSizeAsReplaced() const { return isReplaced() && !isInlineBlockOrInlineTable(); }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderFlexibleBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (188872 => 188873)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp        2015-08-24 18:46:44 UTC (rev 188872)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp        2015-08-24 18:48:51 UTC (rev 188873)
</span><span class="lines">@@ -447,12 +447,12 @@
</span><span class="cx"> return contentLogicalWidth();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-LayoutUnit RenderFlexibleBox::computeMainAxisExtentForChild(RenderBox& child, SizeType sizeType, const Length& size)
</del><ins>+Optional<LayoutUnit> RenderFlexibleBox::computeMainAxisExtentForChild(RenderBox& child, SizeType sizeType, const Length& size)
</ins><span class="cx"> {
</span><span class="cx"> // FIXME: This is wrong for orthogonal flows. It should use the flexbox's writing-mode, not the child's in order
</span><span class="cx"> // to figure out the logical height/width.
</span><span class="cx"> if (isColumnFlow()) {
</span><del>- // We don't have to check for "auto" here - computeContentLogicalHeight will just return -1 for that case anyway.
</del><ins>+ // We don't have to check for "auto" here - computeContentLogicalHeight will just return Nullopt for that case anyway.
</ins><span class="cx"> if (size.isIntrinsic())
</span><span class="cx"> child.layoutIfNeeded();
</span><span class="cx"> return child.computeContentLogicalHeight(size, child.logicalHeight() - child.borderAndPaddingLogicalHeight());
</span><span class="lines">@@ -668,7 +668,7 @@
</span><span class="cx"> ASSERT(mainAxisExtent - mainAxisBorderAndPaddingExtentForChild(child) >= 0);
</span><span class="cx"> return mainAxisExtent - mainAxisBorderAndPaddingExtentForChild(child);
</span><span class="cx"> }
</span><del>- return std::max(LayoutUnit::fromPixel(0), computeMainAxisExtentForChild(child, MainOrPreferredSize, flexBasis));
</del><ins>+ return computeMainAxisExtentForChild(child, MainOrPreferredSize, flexBasis).valueOr(0);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void RenderFlexibleBox::layoutFlexItems(bool relayoutChildren, Vector<LineContext>& lineContexts)
</span><span class="lines">@@ -845,17 +845,13 @@
</span><span class="cx"> LayoutUnit RenderFlexibleBox::adjustChildSizeForMinAndMax(RenderBox& child, LayoutUnit childSize)
</span><span class="cx"> {
</span><span class="cx"> Length max = isHorizontalFlow() ? child.style().maxWidth() : child.style().maxHeight();
</span><del>- if (max.isSpecifiedOrIntrinsic()) {
- LayoutUnit maxExtent = computeMainAxisExtentForChild(child, MaxSize, max);
- if (maxExtent != -1 && childSize > maxExtent)
- childSize = maxExtent;
- }
</del><ins>+ if (max.isSpecifiedOrIntrinsic())
+ childSize = std::min(childSize, computeMainAxisExtentForChild(child, MaxSize, max).valueOr(childSize));
</ins><span class="cx">
</span><span class="cx"> Length min = isHorizontalFlow() ? child.style().minWidth() : child.style().minHeight();
</span><del>- LayoutUnit minExtent = 0;
</del><span class="cx"> if (min.isSpecifiedOrIntrinsic())
</span><del>- minExtent = computeMainAxisExtentForChild(child, MinSize, min);
- return std::max(childSize, minExtent);
</del><ins>+ return std::max(childSize, computeMainAxisExtentForChild(child, MinSize, min).valueOr(childSize));
+ return childSize;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool RenderFlexibleBox::computeNextFlexLine(OrderedFlexItemList& orderedChildren, LayoutUnit& preferredMainAxisExtent, double& totalFlexGrow, double& totalWeightedFlexShrink, LayoutUnit& minMaxAppliedMainAxisExtent, bool& hasInfiniteLineLength)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderFlexibleBoxh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.h (188872 => 188873)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderFlexibleBox.h        2015-08-24 18:46:44 UTC (rev 188872)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.h        2015-08-24 18:48:51 UTC (rev 188873)
</span><span class="lines">@@ -98,7 +98,7 @@
</span><span class="cx"> LayoutUnit mainAxisExtent() const;
</span><span class="cx"> LayoutUnit crossAxisContentExtent() const;
</span><span class="cx"> LayoutUnit mainAxisContentExtent(LayoutUnit contentLogicalHeight);
</span><del>- LayoutUnit computeMainAxisExtentForChild(RenderBox& child, SizeType, const Length& size);
</del><ins>+ Optional<LayoutUnit> computeMainAxisExtentForChild(RenderBox& child, SizeType, const Length& size);
</ins><span class="cx"> WritingMode transformedWritingMode() const;
</span><span class="cx"> LayoutUnit flowAwareBorderStart() const;
</span><span class="cx"> LayoutUnit flowAwareBorderEnd() const;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderFlowThreadcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderFlowThread.cpp (188872 => 188873)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderFlowThread.cpp        2015-08-24 18:46:44 UTC (rev 188872)
+++ trunk/Source/WebCore/rendering/RenderFlowThread.cpp        2015-08-24 18:48:51 UTC (rev 188873)
</span><span class="lines">@@ -1094,7 +1094,7 @@
</span><span class="cx"> hasComputedAutoHeight = true;
</span><span class="cx">
</span><span class="cx"> // Compute the region height pretending that the offsetBreakInCurrentRegion is the logicalHeight for the auto-height region.
</span><del>- LayoutUnit regionComputedAutoHeight = namedFlowFragment.constrainContentBoxLogicalHeightByMinMax(offsetBreakInCurrentRegion, -1);
</del><ins>+ LayoutUnit regionComputedAutoHeight = namedFlowFragment.constrainContentBoxLogicalHeightByMinMax(offsetBreakInCurrentRegion, Nullopt);
</ins><span class="cx">
</span><span class="cx"> // The new height of this region needs to be smaller than the initial value, the max height. A forced break is the only way to change the initial
</span><span class="cx"> // height of an auto-height region besides content ending.
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderGridcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderGrid.cpp (188872 => 188873)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderGrid.cpp        2015-08-24 18:46:44 UTC (rev 188872)
+++ trunk/Source/WebCore/rendering/RenderGrid.cpp        2015-08-24 18:48:51 UTC (rev 188873)
</span><span class="lines">@@ -469,7 +469,9 @@
</span><span class="cx"> LayoutUnit RenderGrid::computeUsedBreadthOfSpecifiedLength(GridTrackSizingDirection direction, const Length& trackLength) const
</span><span class="cx"> {
</span><span class="cx"> ASSERT(trackLength.isSpecified());
</span><del>- return valueForLength(trackLength, direction == ForColumns ? logicalWidth() : std::max(LayoutUnit(), computeContentLogicalHeight(style().logicalHeight(), -1)));
</del><ins>+ if (direction == ForColumns)
+ return valueForLength(trackLength, logicalWidth());
+ return valueForLength(trackLength, computeContentLogicalHeight(style().logicalHeight(), Nullopt).valueOr(0));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> double RenderGrid::computeNormalizedFractionBreadth(Vector<GridTrack>& tracks, const GridSpan& tracksSpan, GridTrackSizingDirection direction, LayoutUnit spaceToFill) const
</span><span class="lines">@@ -548,9 +550,9 @@
</span><span class="cx">
</span><span class="cx"> LayoutUnit RenderGrid::logicalContentHeightForChild(RenderBox& child, Vector<GridTrack>& columnTracks)
</span><span class="cx"> {
</span><del>- LayoutUnit oldOverrideContainingBlockContentLogicalWidth = child.hasOverrideContainingBlockLogicalWidth() ? child.overrideContainingBlockContentLogicalWidth() : LayoutUnit();
</del><ins>+ Optional<LayoutUnit> oldOverrideContainingBlockContentLogicalWidth = child.hasOverrideContainingBlockLogicalWidth() ? child.overrideContainingBlockContentLogicalWidth() : LayoutUnit();
</ins><span class="cx"> LayoutUnit overrideContainingBlockContentLogicalWidth = gridAreaBreadthForChild(child, ForColumns, columnTracks);
</span><del>- if (child.hasRelativeLogicalHeight() || oldOverrideContainingBlockContentLogicalWidth != overrideContainingBlockContentLogicalWidth) {
</del><ins>+ if (child.hasRelativeLogicalHeight() || !oldOverrideContainingBlockContentLogicalWidth || oldOverrideContainingBlockContentLogicalWidth.value() != overrideContainingBlockContentLogicalWidth) {
</ins><span class="cx"> child.setNeedsLayout(MarkOnlyThis);
</span><span class="cx"> // We need to clear the stretched height to properly compute logical height during layout.
</span><span class="cx"> child.clearOverrideLogicalContentHeight();
</span><span class="lines">@@ -558,9 +560,9 @@
</span><span class="cx">
</span><span class="cx"> child.setOverrideContainingBlockContentLogicalWidth(overrideContainingBlockContentLogicalWidth);
</span><span class="cx"> // If |child| has a relative logical height, we shouldn't let it override its intrinsic height, which is
</span><del>- // what we are interested in here. Thus we need to set the override logical height to -1 (no possible resolution).
</del><ins>+ // what we are interested in here. Thus we need to set the override logical height to Nullopt (no possible resolution).
</ins><span class="cx"> if (child.hasRelativeLogicalHeight())
</span><del>- child.setOverrideContainingBlockContentLogicalHeight(-1);
</del><ins>+ child.setOverrideContainingBlockContentLogicalHeight(Nullopt);
</ins><span class="cx"> child.layoutIfNeeded();
</span><span class="cx"> return child.logicalHeight() + child.marginLogicalHeight();
</span><span class="cx"> }
</span><span class="lines">@@ -574,9 +576,9 @@
</span><span class="cx">
</span><span class="cx"> if (direction == ForColumns) {
</span><span class="cx"> // If |child| has a relative logical width, we shouldn't let it override its intrinsic width, which is
</span><del>- // what we are interested in here. Thus we need to set the override logical width to -1 (no possible resolution).
</del><ins>+ // what we are interested in here. Thus we need to set the override logical width to Nullopt (no possible resolution).
</ins><span class="cx"> if (child.hasRelativeLogicalWidth())
</span><del>- child.setOverrideContainingBlockContentLogicalWidth(-1);
</del><ins>+ child.setOverrideContainingBlockContentLogicalWidth(Nullopt);
</ins><span class="cx">
</span><span class="cx"> // FIXME: It's unclear if we should return the intrinsic width or the preferred width.
</span><span class="cx"> // See http://lists.w3.org/Archives/Public/www-style/2013Jan/0245.html
</span><span class="lines">@@ -595,9 +597,9 @@
</span><span class="cx">
</span><span class="cx"> if (direction == ForColumns) {
</span><span class="cx"> // If |child| has a relative logical width, we shouldn't let it override its intrinsic width, which is
</span><del>- // what we are interested in here. Thus we need to set the override logical width to -1 (no possible resolution).
</del><ins>+ // what we are interested in here. Thus we need to set the override logical width to Nullopt (no possible resolution).
</ins><span class="cx"> if (child.hasRelativeLogicalWidth())
</span><del>- child.setOverrideContainingBlockContentLogicalWidth(-1);
</del><ins>+ child.setOverrideContainingBlockContentLogicalWidth(Nullopt);
</ins><span class="cx">
</span><span class="cx"> // FIXME: It's unclear if we should return the intrinsic width or the preferred width.
</span><span class="cx"> // See http://lists.w3.org/Archives/Public/www-style/2013Jan/0245.html
</span><span class="lines">@@ -1174,12 +1176,14 @@
</span><span class="cx"> for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
</span><span class="cx"> // Because the grid area cannot be styled, we don't need to adjust
</span><span class="cx"> // the grid breadth to account for 'box-sizing'.
</span><del>- LayoutUnit oldOverrideContainingBlockContentLogicalWidth = child->hasOverrideContainingBlockLogicalWidth() ? child->overrideContainingBlockContentLogicalWidth() : LayoutUnit();
- LayoutUnit oldOverrideContainingBlockContentLogicalHeight = child->hasOverrideContainingBlockLogicalHeight() ? child->overrideContainingBlockContentLogicalHeight() : LayoutUnit();
</del><ins>+ Optional<LayoutUnit> oldOverrideContainingBlockContentLogicalWidth = child->hasOverrideContainingBlockLogicalWidth() ? child->overrideContainingBlockContentLogicalWidth() : LayoutUnit();
+ Optional<LayoutUnit> oldOverrideContainingBlockContentLogicalHeight = child->hasOverrideContainingBlockLogicalHeight() ? child->overrideContainingBlockContentLogicalHeight() : LayoutUnit();
</ins><span class="cx">
</span><span class="cx"> LayoutUnit overrideContainingBlockContentLogicalWidth = gridAreaBreadthForChild(*child, ForColumns, sizingData.columnTracks);
</span><span class="cx"> LayoutUnit overrideContainingBlockContentLogicalHeight = gridAreaBreadthForChild(*child, ForRows, sizingData.rowTracks);
</span><del>- if (oldOverrideContainingBlockContentLogicalWidth != overrideContainingBlockContentLogicalWidth || (oldOverrideContainingBlockContentLogicalHeight != overrideContainingBlockContentLogicalHeight && child->hasRelativeLogicalHeight()))
</del><ins>+ if (!oldOverrideContainingBlockContentLogicalWidth || oldOverrideContainingBlockContentLogicalWidth.value() != overrideContainingBlockContentLogicalWidth
+ || ((!oldOverrideContainingBlockContentLogicalHeight || oldOverrideContainingBlockContentLogicalHeight.value() != overrideContainingBlockContentLogicalHeight)
+ && child->hasRelativeLogicalHeight()))
</ins><span class="cx"> child->setNeedsLayout(MarkOnlyThis);
</span><span class="cx">
</span><span class="cx"> child->setOverrideContainingBlockContentLogicalWidth(overrideContainingBlockContentLogicalWidth);
</span><span class="lines">@@ -1306,12 +1310,12 @@
</span><span class="cx"> bool allowedToStretchChildAlongRowAxis = hasAutoSizeInRowAxis && !childStyle.marginStartUsing(&gridStyle).isAuto() && !childStyle.marginEndUsing(&gridStyle).isAuto();
</span><span class="cx"> if (!allowedToStretchChildAlongRowAxis || RenderStyle::resolveJustification(gridStyle, childStyle, ItemPositionStretch) != ItemPositionStretch) {
</span><span class="cx"> bool hasAutoMinSizeInRowAxis = isHorizontalMode ? childStyle.minWidth().isAuto() : childStyle.minHeight().isAuto();
</span><del>- bool canShrinkToFitInRowAxisForChild = !hasAutoMinSizeInRowAxis || child.minPreferredLogicalWidth() <= child.overrideContainingBlockContentLogicalWidth();
</del><ins>+ bool canShrinkToFitInRowAxisForChild = !hasAutoMinSizeInRowAxis || (child.overrideContainingBlockContentLogicalWidth() && child.minPreferredLogicalWidth() <= child.overrideContainingBlockContentLogicalWidth().value());
</ins><span class="cx"> // TODO(lajava): how to handle orthogonality in this case ?.
</span><span class="cx"> // TODO(lajava): grid track sizing and positioning do not support orthogonal modes yet.
</span><span class="cx"> if (hasAutoSizeInRowAxis && canShrinkToFitInRowAxisForChild) {
</span><del>- LayoutUnit childWidthToFitContent = std::max(std::min(child.maxPreferredLogicalWidth(), child.overrideContainingBlockContentLogicalWidth() - child.marginLogicalWidth()), child.minPreferredLogicalWidth());
- LayoutUnit desiredLogicalWidth = child.constrainLogicalHeightByMinMax(childWidthToFitContent, -1);
</del><ins>+ LayoutUnit childWidthToFitContent = std::max(std::min(child.maxPreferredLogicalWidth(), child.overrideContainingBlockContentLogicalWidth().valueOr(-1) - child.marginLogicalWidth()), child.minPreferredLogicalWidth());
+ LayoutUnit desiredLogicalWidth = child.constrainLogicalHeightByMinMax(childWidthToFitContent, Nullopt);
</ins><span class="cx"> child.setOverrideLogicalContentWidth(desiredLogicalWidth - child.borderAndPaddingLogicalWidth());
</span><span class="cx"> if (desiredLogicalWidth != child.logicalWidth())
</span><span class="cx"> child.setNeedsLayout();
</span><span class="lines">@@ -1324,8 +1328,8 @@
</span><span class="cx"> // TODO (lajava): If the child has orthogonal flow, then it already has an override height set, so use it.
</span><span class="cx"> // TODO (lajava): grid track sizing and positioning do not support orthogonal modes yet.
</span><span class="cx"> if (child.isHorizontalWritingMode() == isHorizontalMode) {
</span><del>- LayoutUnit stretchedLogicalHeight = availableAlignmentSpaceForChildBeforeStretching(child.overrideContainingBlockContentLogicalHeight(), child);
- LayoutUnit desiredLogicalHeight = child.constrainLogicalHeightByMinMax(stretchedLogicalHeight, -1);
</del><ins>+ LayoutUnit stretchedLogicalHeight = availableAlignmentSpaceForChildBeforeStretching(child.overrideContainingBlockContentLogicalHeight().valueOr(-1), child);
+ LayoutUnit desiredLogicalHeight = child.constrainLogicalHeightByMinMax(stretchedLogicalHeight, Nullopt);
</ins><span class="cx"> child.setOverrideLogicalContentHeight(desiredLogicalHeight - child.borderAndPaddingLogicalHeight());
</span><span class="cx"> if (desiredLogicalHeight != child.logicalHeight()) {
</span><span class="cx"> // TODO (lajava): Can avoid laying out here in some cases. See https://webkit.org/b/87905.
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderMultiColumnSetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp (188872 => 188873)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp        2015-08-24 18:46:44 UTC (rev 188872)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp        2015-08-24 18:48:51 UTC (rev 188873)
</span><span class="lines">@@ -414,11 +414,8 @@
</span><span class="cx"> const RenderStyle& multicolStyle = multicolBlock->style();
</span><span class="cx"> LayoutUnit availableHeight = multiColumnFlowThread()->columnHeightAvailable();
</span><span class="cx"> LayoutUnit maxColumnHeight = availableHeight ? availableHeight : RenderFlowThread::maxLogicalHeight();
</span><del>- if (!multicolStyle.logicalMaxHeight().isUndefined()) {
- LayoutUnit logicalMaxHeight = multicolBlock->computeContentLogicalHeight(multicolStyle.logicalMaxHeight(), -1);
- if (logicalMaxHeight != -1 && maxColumnHeight > logicalMaxHeight)
- maxColumnHeight = logicalMaxHeight;
- }
</del><ins>+ if (!multicolStyle.logicalMaxHeight().isUndefined())
+ maxColumnHeight = std::min(maxColumnHeight, multicolBlock->computeContentLogicalHeight(multicolStyle.logicalMaxHeight(), Nullopt).valueOr(maxColumnHeight));
</ins><span class="cx"> return heightAdjustedForSetOffset(maxColumnHeight);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderTablecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderTable.cpp (188872 => 188873)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderTable.cpp        2015-08-24 18:46:44 UTC (rev 188872)
+++ trunk/Source/WebCore/rendering/RenderTable.cpp        2015-08-24 18:48:51 UTC (rev 188873)
</span><span class="lines">@@ -360,7 +360,6 @@
</span><span class="cx"> LayoutUnit borderAndPaddingBefore = borderBefore() + (collapseBorders() ? LayoutUnit() : paddingBefore());
</span><span class="cx"> LayoutUnit borderAndPaddingAfter = borderAfter() + (collapseBorders() ? LayoutUnit() : paddingAfter());
</span><span class="cx"> LayoutUnit borderAndPadding = borderAndPaddingBefore + borderAndPaddingAfter;
</span><del>- LayoutUnit computedLogicalHeight = 0;
</del><span class="cx"> if (styleLogicalHeight.isFixed()) {
</span><span class="cx"> // HTML tables size as though CSS height includes border/padding, CSS tables do not.
</span><span class="cx"> LayoutUnit borders = LayoutUnit();
</span><span class="lines">@@ -368,14 +367,14 @@
</span><span class="cx"> if (is<HTMLTableElement>(element()) || style().boxSizing() == BORDER_BOX) {
</span><span class="cx"> borders = borderAndPadding;
</span><span class="cx"> }
</span><del>- computedLogicalHeight = styleLogicalHeight.value() - borders;
</del><ins>+ return styleLogicalHeight.value() - borders;
</ins><span class="cx"> } else if (styleLogicalHeight.isPercentOrCalculated())
</span><del>- computedLogicalHeight = computePercentageLogicalHeight(styleLogicalHeight);
</del><ins>+ return computePercentageLogicalHeight(styleLogicalHeight).valueOr(0);
</ins><span class="cx"> else if (styleLogicalHeight.isIntrinsic())
</span><del>- computedLogicalHeight = computeIntrinsicLogicalContentHeightUsing(styleLogicalHeight, logicalHeight() - borderAndPadding, borderAndPadding);
</del><ins>+ return computeIntrinsicLogicalContentHeightUsing(styleLogicalHeight, logicalHeight() - borderAndPadding, borderAndPadding).valueOr(0);
</ins><span class="cx"> else
</span><span class="cx"> ASSERT_NOT_REACHED();
</span><del>- return std::max<LayoutUnit>(0, computedLogicalHeight);
</del><ins>+ return LayoutUnit();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void RenderTable::layoutCaption(RenderTableCaption* caption)
</span></span></pre>
</div>
</div>
</body>
</html>