<!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>[181398] trunk</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/181398">181398</a></dd>
<dt>Author</dt> <dd>mmaxfield@apple.com</dd>
<dt>Date</dt> <dd>2015-03-11 11:22:06 -0700 (Wed, 11 Mar 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Use out-of-band messaging for RenderBox::firstLineBaseline() and RenderBox::inlineBlockBaseline()
https://bugs.webkit.org/show_bug.cgi?id=142569

Reviewed by David Hyatt.

Source/WebCore:

Currently, RenderBox::firstLineBaseline() and RenderBox::inlineBlockBaseline() return -1 to mean
that its baseline should be skipped. Instead of using this sentinel value, this patch changes the
return type from int to Optional&lt;int&gt;.

No new tests because there is no behavior change.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::baselinePosition):
(WebCore::RenderBlock::firstLineBaseline):
(WebCore::RenderBlock::inlineBlockBaseline):
* rendering/RenderBlock.h:
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::firstLineBaseline):
(WebCore::RenderBlockFlow::inlineBlockBaseline):
* rendering/RenderBlockFlow.h:
* rendering/RenderBox.h:
(WebCore::RenderBox::firstLineBaseline):
(WebCore::RenderBox::inlineBlockBaseline):
* rendering/RenderDeprecatedFlexibleBox.cpp:
(WebCore::RenderDeprecatedFlexibleBox::layoutHorizontalBox):
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::baselinePosition):
(WebCore::RenderFlexibleBox::firstLineBaseline):
(WebCore::RenderFlexibleBox::inlineBlockBaseline):
(WebCore::RenderFlexibleBox::marginBoxAscentForChild):
* rendering/RenderFlexibleBox.h:
* rendering/RenderMenuList.h:
* rendering/RenderTable.cpp:
(WebCore::RenderTable::cellAbove):
(WebCore::RenderTable::cellBelow):
(WebCore::RenderTable::cellBefore):
(WebCore::RenderTable::cellAfter):
(WebCore::RenderTable::firstLineBlock):
(WebCore::RenderTable::baselinePosition):
(WebCore::RenderTable::inlineBlockBaseline):
(WebCore::RenderTable::firstLineBaseline):
* rendering/RenderTable.h:
* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::cellBaselinePosition):
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::firstLineBaseline):
* rendering/RenderTableSection.h:
* rendering/RenderTextControl.h:
* rendering/mathml/RenderMathMLBlock.cpp:
(WebCore::RenderMathMLBlock::baselinePosition):
(WebCore::RenderMathMLTable::firstLineBaseline):
* rendering/mathml/RenderMathMLBlock.h:
* rendering/mathml/RenderMathMLFraction.cpp:
(WebCore::RenderMathMLFraction::firstLineBaseline):
* rendering/mathml/RenderMathMLFraction.h:
* rendering/mathml/RenderMathMLOperator.cpp:
(WebCore::RenderMathMLOperator::firstLineBaseline):
* rendering/mathml/RenderMathMLOperator.h:
* rendering/mathml/RenderMathMLRoot.cpp:
(WebCore::RenderMathMLRoot::firstLineBaseline):
(WebCore::RenderMathMLRoot::layout):
* rendering/mathml/RenderMathMLRoot.h:
* rendering/mathml/RenderMathMLRow.cpp:
(WebCore::RenderMathMLRow::layout):
* rendering/mathml/RenderMathMLScripts.cpp:
(WebCore::RenderMathMLScripts::layout):
(WebCore::RenderMathMLScripts::firstLineBaseline):
* rendering/mathml/RenderMathMLScripts.h:
* rendering/mathml/RenderMathMLSpace.cpp:
(WebCore::RenderMathMLSpace::firstLineBaseline):
* rendering/mathml/RenderMathMLSpace.h:
* rendering/mathml/RenderMathMLUnderOver.cpp:
(WebCore::RenderMathMLUnderOver::firstLineBaseline):
* rendering/mathml/RenderMathMLUnderOver.h:

Source/WTF:

Provide a callback to Optional::valueOrCompute() which is evaluated only if necessary.

* wtf/Optional.h:
(WTF::Optional::valueOrCompute):

Tools:

Test Optional::valueOrCompute().

* TestWebKitAPI/Tests/WTF/Optional.cpp:
(TestWebKitAPI::TEST):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfOptionalh">trunk/Source/WTF/wtf/Optional.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBlockcpp">trunk/Source/WebCore/rendering/RenderBlock.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBlockh">trunk/Source/WebCore/rendering/RenderBlock.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBlockFlowcpp">trunk/Source/WebCore/rendering/RenderBlockFlow.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBlockFlowh">trunk/Source/WebCore/rendering/RenderBlockFlow.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBoxh">trunk/Source/WebCore/rendering/RenderBox.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderDeprecatedFlexibleBoxcpp">trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp</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="#trunkSourceWebCorerenderingRenderMenuListh">trunk/Source/WebCore/rendering/RenderMenuList.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderTablecpp">trunk/Source/WebCore/rendering/RenderTable.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderTableh">trunk/Source/WebCore/rendering/RenderTable.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderTableCellcpp">trunk/Source/WebCore/rendering/RenderTableCell.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderTableSectioncpp">trunk/Source/WebCore/rendering/RenderTableSection.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderTableSectionh">trunk/Source/WebCore/rendering/RenderTableSection.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderTextControlh">trunk/Source/WebCore/rendering/RenderTextControl.h</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLBlockcpp">trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLBlockh">trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.h</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLFractioncpp">trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLFractionh">trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.h</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLOperatorcpp">trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLOperatorh">trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLRootcpp">trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLRooth">trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.h</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLRowcpp">trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLScriptscpp">trunk/Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLScriptsh">trunk/Source/WebCore/rendering/mathml/RenderMathMLScripts.h</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLSpacecpp">trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLSpaceh">trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.h</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLUnderOvercpp">trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLUnderOverh">trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.h</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWTFOptionalcpp">trunk/Tools/TestWebKitAPI/Tests/WTF/Optional.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (181397 => 181398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2015-03-11 18:21:05 UTC (rev 181397)
+++ trunk/Source/WTF/ChangeLog        2015-03-11 18:22:06 UTC (rev 181398)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2015-03-11  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
+
+        Use out-of-band messaging for RenderBox::firstLineBaseline() and RenderBox::inlineBlockBaseline()
+        https://bugs.webkit.org/show_bug.cgi?id=142569
+
+        Reviewed by David Hyatt.
+
+        Provide a callback to Optional::valueOrCompute() which is evaluated only if necessary.
+
+        * wtf/Optional.h:
+        (WTF::Optional::valueOrCompute):
+
</ins><span class="cx"> 2015-03-10  Brent Fulgham  &lt;bfulgham@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Win] 17 different JSC tests started to fail in DST
</span></span></pre></div>
<a id="trunkSourceWTFwtfOptionalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/Optional.h (181397 => 181398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/Optional.h        2015-03-11 18:21:05 UTC (rev 181397)
+++ trunk/Source/WTF/wtf/Optional.h        2015-03-11 18:22:06 UTC (rev 181398)
</span><span class="lines">@@ -154,6 +154,15 @@
</span><span class="cx">         return std::forward&lt;U&gt;(value);
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    template&lt;typename U&gt;
+    T valueOrCompute(U callback) const
+    {
+        if (m_isEngaged)
+            return *asPtr();
+
+        return callback();
+    }
+
</ins><span class="cx"> private:
</span><span class="cx">     const T* asPtr() const { return reinterpret_cast&lt;const T*&gt;(&amp;m_value); }
</span><span class="cx">     T* asPtr() { return reinterpret_cast&lt;T*&gt;(&amp;m_value); }
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (181397 => 181398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-03-11 18:21:05 UTC (rev 181397)
+++ trunk/Source/WebCore/ChangeLog        2015-03-11 18:22:06 UTC (rev 181398)
</span><span class="lines">@@ -1,3 +1,80 @@
</span><ins>+2015-03-11  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
+
+        Use out-of-band messaging for RenderBox::firstLineBaseline() and RenderBox::inlineBlockBaseline()
+        https://bugs.webkit.org/show_bug.cgi?id=142569
+
+        Reviewed by David Hyatt.
+
+        Currently, RenderBox::firstLineBaseline() and RenderBox::inlineBlockBaseline() return -1 to mean
+        that its baseline should be skipped. Instead of using this sentinel value, this patch changes the
+        return type from int to Optional&lt;int&gt;.
+
+        No new tests because there is no behavior change.
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::baselinePosition):
+        (WebCore::RenderBlock::firstLineBaseline):
+        (WebCore::RenderBlock::inlineBlockBaseline):
+        * rendering/RenderBlock.h:
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::firstLineBaseline):
+        (WebCore::RenderBlockFlow::inlineBlockBaseline):
+        * rendering/RenderBlockFlow.h:
+        * rendering/RenderBox.h:
+        (WebCore::RenderBox::firstLineBaseline):
+        (WebCore::RenderBox::inlineBlockBaseline):
+        * rendering/RenderDeprecatedFlexibleBox.cpp:
+        (WebCore::RenderDeprecatedFlexibleBox::layoutHorizontalBox):
+        * rendering/RenderFlexibleBox.cpp:
+        (WebCore::RenderFlexibleBox::baselinePosition):
+        (WebCore::RenderFlexibleBox::firstLineBaseline):
+        (WebCore::RenderFlexibleBox::inlineBlockBaseline):
+        (WebCore::RenderFlexibleBox::marginBoxAscentForChild):
+        * rendering/RenderFlexibleBox.h:
+        * rendering/RenderMenuList.h:
+        * rendering/RenderTable.cpp:
+        (WebCore::RenderTable::cellAbove):
+        (WebCore::RenderTable::cellBelow):
+        (WebCore::RenderTable::cellBefore):
+        (WebCore::RenderTable::cellAfter):
+        (WebCore::RenderTable::firstLineBlock):
+        (WebCore::RenderTable::baselinePosition):
+        (WebCore::RenderTable::inlineBlockBaseline):
+        (WebCore::RenderTable::firstLineBaseline):
+        * rendering/RenderTable.h:
+        * rendering/RenderTableCell.cpp:
+        (WebCore::RenderTableCell::cellBaselinePosition):
+        * rendering/RenderTableSection.cpp:
+        (WebCore::RenderTableSection::firstLineBaseline):
+        * rendering/RenderTableSection.h:
+        * rendering/RenderTextControl.h:
+        * rendering/mathml/RenderMathMLBlock.cpp:
+        (WebCore::RenderMathMLBlock::baselinePosition):
+        (WebCore::RenderMathMLTable::firstLineBaseline):
+        * rendering/mathml/RenderMathMLBlock.h:
+        * rendering/mathml/RenderMathMLFraction.cpp:
+        (WebCore::RenderMathMLFraction::firstLineBaseline):
+        * rendering/mathml/RenderMathMLFraction.h:
+        * rendering/mathml/RenderMathMLOperator.cpp:
+        (WebCore::RenderMathMLOperator::firstLineBaseline):
+        * rendering/mathml/RenderMathMLOperator.h:
+        * rendering/mathml/RenderMathMLRoot.cpp:
+        (WebCore::RenderMathMLRoot::firstLineBaseline):
+        (WebCore::RenderMathMLRoot::layout):
+        * rendering/mathml/RenderMathMLRoot.h:
+        * rendering/mathml/RenderMathMLRow.cpp:
+        (WebCore::RenderMathMLRow::layout):
+        * rendering/mathml/RenderMathMLScripts.cpp:
+        (WebCore::RenderMathMLScripts::layout):
+        (WebCore::RenderMathMLScripts::firstLineBaseline):
+        * rendering/mathml/RenderMathMLScripts.h:
+        * rendering/mathml/RenderMathMLSpace.cpp:
+        (WebCore::RenderMathMLSpace::firstLineBaseline):
+        * rendering/mathml/RenderMathMLSpace.h:
+        * rendering/mathml/RenderMathMLUnderOver.cpp:
+        (WebCore::RenderMathMLUnderOver::firstLineBaseline):
+        * rendering/mathml/RenderMathMLUnderOver.h:
+
</ins><span class="cx"> 2015-03-11  Timothy Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         &lt;attachment&gt;s should be created when dropping files onto contentEditable areas
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (181397 => 181398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlock.cpp        2015-03-11 18:21:05 UTC (rev 181397)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp        2015-03-11 18:22:06 UTC (rev 181398)
</span><span class="lines">@@ -2848,7 +2848,7 @@
</span><span class="cx">         bool ignoreBaseline = (layer() &amp;&amp; (layer()-&gt;marquee() || (direction == HorizontalLine ? (layer()-&gt;verticalScrollbar() || layer()-&gt;scrollYOffset() != 0)
</span><span class="cx">             : (layer()-&gt;horizontalScrollbar() || layer()-&gt;scrollXOffset() != 0)))) || (isWritingModeRoot() &amp;&amp; !isRubyRun());
</span><span class="cx">         
</span><del>-        int baselinePos = ignoreBaseline ? -1 : inlineBlockBaseline(direction);
</del><ins>+        Optional&lt;int&gt; baselinePos = ignoreBaseline ? Optional&lt;int&gt;() : inlineBlockBaseline(direction);
</ins><span class="cx">         
</span><span class="cx">         if (isDeprecatedFlexibleBox()) {
</span><span class="cx">             // Historically, we did this check for all baselines. But we can't
</span><span class="lines">@@ -2857,11 +2857,11 @@
</span><span class="cx">             // calculate the baseline as if -webkit-line-clamp wasn't used.
</span><span class="cx">             // For simplicity, we use this for all uses of deprecated flexbox.
</span><span class="cx">             LayoutUnit bottomOfContent = direction == HorizontalLine ? borderTop() + paddingTop() + contentHeight() : borderRight() + paddingRight() + contentWidth();
</span><del>-            if (baselinePos &gt; bottomOfContent)
-                baselinePos = -1;
</del><ins>+            if (baselinePos &amp;&amp; baselinePos.value() &gt; bottomOfContent)
+                baselinePos = Optional&lt;int&gt;();
</ins><span class="cx">         }
</span><del>-        if (baselinePos != -1)
-            return direction == HorizontalLine ? marginTop() + baselinePos : marginRight() + baselinePos;
</del><ins>+        if (baselinePos)
+            return direction == HorizontalLine ? marginTop() + baselinePos.value() : marginRight() + baselinePos.value();
</ins><span class="cx"> 
</span><span class="cx">         return RenderBox::baselinePosition(baselineType, firstLine, direction, linePositionMode);
</span><span class="cx">     }
</span><span class="lines">@@ -2883,45 +2883,43 @@
</span><span class="cx">     return std::max&lt;LayoutUnit&gt;(replacedHeight, lineHeight(isFirstLine, isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-int RenderBlock::firstLineBaseline() const
</del><ins>+Optional&lt;int&gt; RenderBlock::firstLineBaseline() const
</ins><span class="cx"> {
</span><span class="cx">     if (isWritingModeRoot() &amp;&amp; !isRubyRun())
</span><del>-        return -1;
</del><ins>+        return Optional&lt;int&gt;();
</ins><span class="cx"> 
</span><span class="cx">     for (RenderBox* curr = firstChildBox(); curr; curr = curr-&gt;nextSiblingBox()) {
</span><span class="cx">         if (!curr-&gt;isFloatingOrOutOfFlowPositioned()) {
</span><del>-            int result = curr-&gt;firstLineBaseline();
-            if (result != -1)
-                return curr-&gt;logicalTop() + result; // Translate to our coordinate space.
</del><ins>+            if (Optional&lt;int&gt; result = curr-&gt;firstLineBaseline())
+                return Optional&lt;int&gt;(curr-&gt;logicalTop() + result.value()); // Translate to our coordinate space.
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return -1;
</del><ins>+    return Optional&lt;int&gt;();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-int RenderBlock::inlineBlockBaseline(LineDirectionMode lineDirection) const
</del><ins>+Optional&lt;int&gt; RenderBlock::inlineBlockBaseline(LineDirectionMode lineDirection) const
</ins><span class="cx"> {
</span><span class="cx">     if (isWritingModeRoot() &amp;&amp; !isRubyRun())
</span><del>-        return -1;
</del><ins>+        return Optional&lt;int&gt;();
</ins><span class="cx"> 
</span><span class="cx">     bool haveNormalFlowChild = false;
</span><span class="cx">     for (auto box = lastChildBox(); box; box = box-&gt;previousSiblingBox()) {
</span><span class="cx">         if (box-&gt;isFloatingOrOutOfFlowPositioned())
</span><span class="cx">             continue;
</span><span class="cx">         haveNormalFlowChild = true;
</span><del>-        int result = box-&gt;inlineBlockBaseline(lineDirection);
-        if (result != -1)
-            return box-&gt;logicalTop() + result; // Translate to our coordinate space.
</del><ins>+        if (Optional&lt;int&gt; result = box-&gt;inlineBlockBaseline(lineDirection))
+            return Optional&lt;int&gt;(box-&gt;logicalTop() + result.value()); // Translate to our coordinate space.
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (!haveNormalFlowChild &amp;&amp; hasLineIfEmpty()) {
</span><span class="cx">         auto&amp; fontMetrics = firstLineStyle().fontMetrics();
</span><del>-        return fontMetrics.ascent()
-             + (lineHeight(true, lineDirection, PositionOfInteriorLineBoxes) - fontMetrics.height()) / 2
-             + (lineDirection == HorizontalLine ? borderTop() + paddingTop() : borderRight() + paddingRight());
</del><ins>+        return Optional&lt;int&gt;(fontMetrics.ascent()
+            + (lineHeight(true, lineDirection, PositionOfInteriorLineBoxes) - fontMetrics.height()) / 2
+            + (lineDirection == HorizontalLine ? borderTop() + paddingTop() : borderRight() + paddingRight()));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return -1;
</del><ins>+    return Optional&lt;int&gt;();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static inline bool isRenderBlockFlowOrRenderButton(RenderElement&amp; renderElement)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlock.h (181397 => 181398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlock.h        2015-03-11 18:21:05 UTC (rev 181397)
+++ trunk/Source/WebCore/rendering/RenderBlock.h        2015-03-11 18:22:06 UTC (rev 181398)
</span><span class="lines">@@ -346,8 +346,8 @@
</span><span class="cx">     virtual void computeIntrinsicLogicalWidths(LayoutUnit&amp; minLogicalWidth, LayoutUnit&amp; maxLogicalWidth) const override;
</span><span class="cx">     virtual void computePreferredLogicalWidths() override;
</span><span class="cx">     
</span><del>-    virtual int firstLineBaseline() const override;
-    virtual int inlineBlockBaseline(LineDirectionMode) const override;
</del><ins>+    virtual Optional&lt;int&gt; firstLineBaseline() const override;
+    virtual Optional&lt;int&gt; inlineBlockBaseline(LineDirectionMode) const override;
</ins><span class="cx"> 
</span><span class="cx">     // Delay updating scrollbars until endAndCommitUpdateScrollInfoAfterLayoutTransaction() is called. These functions are used
</span><span class="cx">     // when a flexbox is laying out its descendants. If multiple calls are made to beginUpdateScrollInfoAfterLayoutTransaction()
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockFlowcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (181397 => 181398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp        2015-03-11 18:21:05 UTC (rev 181397)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp        2015-03-11 18:22:06 UTC (rev 181398)
</span><span class="lines">@@ -2988,42 +2988,45 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-int RenderBlockFlow::firstLineBaseline() const
</del><ins>+Optional&lt;int&gt; RenderBlockFlow::firstLineBaseline() const
</ins><span class="cx"> {
</span><span class="cx">     if (isWritingModeRoot() &amp;&amp; !isRubyRun())
</span><del>-        return -1;
</del><ins>+        return Optional&lt;int&gt;();
</ins><span class="cx"> 
</span><span class="cx">     if (!childrenInline())
</span><span class="cx">         return RenderBlock::firstLineBaseline();
</span><span class="cx"> 
</span><span class="cx">     if (!hasLines())
</span><del>-        return -1;
</del><ins>+        return Optional&lt;int&gt;();
</ins><span class="cx"> 
</span><span class="cx">     if (auto simpleLineLayout = this-&gt;simpleLineLayout())
</span><del>-        return SimpleLineLayout::computeFlowFirstLineBaseline(*this, *simpleLineLayout);
</del><ins>+        return Optional&lt;int&gt;(SimpleLineLayout::computeFlowFirstLineBaseline(*this, *simpleLineLayout));
</ins><span class="cx"> 
</span><span class="cx">     ASSERT(firstRootBox());
</span><span class="cx">     return firstRootBox()-&gt;logicalTop() + firstLineStyle().fontMetrics().ascent(firstRootBox()-&gt;baselineType());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-int RenderBlockFlow::inlineBlockBaseline(LineDirectionMode lineDirection) const
</del><ins>+Optional&lt;int&gt; RenderBlockFlow::inlineBlockBaseline(LineDirectionMode lineDirection) const
</ins><span class="cx"> {
</span><span class="cx">     if (isWritingModeRoot() &amp;&amp; !isRubyRun())
</span><del>-        return -1;
</del><ins>+        return Optional&lt;int&gt;();
</ins><span class="cx"> 
</span><span class="cx">     // Note that here we only take the left and bottom into consideration. Our caller takes the right and top into consideration.
</span><span class="cx">     float boxHeight = lineDirection == HorizontalLine ? height() + m_marginBox.bottom() : width() + m_marginBox.left();
</span><span class="cx">     float lastBaseline;
</span><del>-    if (!childrenInline())
-        lastBaseline = RenderBlock::inlineBlockBaseline(lineDirection);
-    else {
</del><ins>+    if (!childrenInline()) {
+        Optional&lt;int&gt; inlineBlockBaseline = RenderBlock::inlineBlockBaseline(lineDirection);
+        if (!inlineBlockBaseline)
+            return inlineBlockBaseline;
+        lastBaseline = inlineBlockBaseline.value();
+    } else {
</ins><span class="cx">         if (!hasLines()) {
</span><span class="cx">             if (!hasLineIfEmpty())
</span><del>-                return -1;
</del><ins>+                return Optional&lt;int&gt;();
</ins><span class="cx">             const auto&amp; fontMetrics = firstLineStyle().fontMetrics();
</span><del>-            return fontMetrics.ascent()
</del><ins>+            return Optional&lt;int&gt;(fontMetrics.ascent()
</ins><span class="cx">                 + (lineHeight(true, lineDirection, PositionOfInteriorLineBoxes) - fontMetrics.height()) / 2
</span><del>-                + (lineDirection == HorizontalLine ? borderTop() + paddingTop() : borderRight() + paddingRight());
</del><ins>+                + (lineDirection == HorizontalLine ? borderTop() + paddingTop() : borderRight() + paddingRight()));
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if (auto simpleLineLayout = this-&gt;simpleLineLayout())
</span><span class="lines">@@ -3037,7 +3040,7 @@
</span><span class="cx">     // According to the CSS spec http://www.w3.org/TR/CSS21/visudet.html, we shouldn't be performing this min, but should
</span><span class="cx">     // instead be returning boxHeight directly. However, we feel that a min here is better behavior (and is consistent
</span><span class="cx">     // enough with the spec to not cause tons of breakages).
</span><del>-    return style().overflowY() == OVISIBLE ? lastBaseline : std::min(boxHeight, lastBaseline);
</del><ins>+    return Optional&lt;int&gt;(style().overflowY() == OVISIBLE ? lastBaseline : std::min(boxHeight, lastBaseline));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> GapRects RenderBlockFlow::inlineSelectionGaps(RenderBlock&amp; rootBlock, const LayoutPoint&amp; rootBlockPhysicalPosition, const LayoutSize&amp; offsetFromRootBlock,
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockFlowh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.h (181397 => 181398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlockFlow.h        2015-03-11 18:21:05 UTC (rev 181397)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.h        2015-03-11 18:22:06 UTC (rev 181398)
</span><span class="lines">@@ -444,8 +444,8 @@
</span><span class="cx"> 
</span><span class="cx">     void createFloatingObjects();
</span><span class="cx"> 
</span><del>-    virtual int firstLineBaseline() const override;
-    virtual int inlineBlockBaseline(LineDirectionMode) const override;
</del><ins>+    virtual Optional&lt;int&gt; firstLineBaseline() const override;
+    virtual Optional&lt;int&gt; inlineBlockBaseline(LineDirectionMode) const override;
</ins><span class="cx"> 
</span><span class="cx">     virtual bool isMultiColumnBlockFlow() const override { return multiColumnFlowThread(); }
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBox.h (181397 => 181398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBox.h        2015-03-11 18:21:05 UTC (rev 181397)
+++ trunk/Source/WebCore/rendering/RenderBox.h        2015-03-11 18:22:06 UTC (rev 181398)
</span><span class="lines">@@ -521,8 +521,8 @@
</span><span class="cx">     
</span><span class="cx">     RenderLayer* enclosingFloatPaintingLayer() const;
</span><span class="cx">     
</span><del>-    virtual int firstLineBaseline() const { return -1; }
-    virtual int inlineBlockBaseline(LineDirectionMode) const { return -1; } // Returns -1 if we should skip this box when computing the baseline of an inline-block.
</del><ins>+    virtual Optional&lt;int&gt; firstLineBaseline() const { return Optional&lt;int&gt;(); }
+    virtual Optional&lt;int&gt; inlineBlockBaseline(LineDirectionMode) const { return Optional&lt;int&gt;(); } // Returns empty if we should skip this box when computing the baseline of an inline-block.
</ins><span class="cx"> 
</span><span class="cx">     bool shrinkToAvoidFloats() const;
</span><span class="cx">     virtual bool avoidsFloats() const;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderDeprecatedFlexibleBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp (181397 => 181398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp        2015-03-11 18:21:05 UTC (rev 181397)
+++ trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp        2015-03-11 18:22:06 UTC (rev 181398)
</span><span class="lines">@@ -433,9 +433,7 @@
</span><span class="cx"> 
</span><span class="cx">             // Update our height and overflow height.
</span><span class="cx">             if (style().boxAlign() == BBASELINE) {
</span><del>-                LayoutUnit ascent = child-&gt;firstLineBaseline();
-                if (ascent == -1)
-                    ascent = child-&gt;height() + child-&gt;marginBottom();
</del><ins>+                LayoutUnit ascent = child-&gt;firstLineBaseline().valueOr(child-&gt;height() + child-&gt;marginBottom());
</ins><span class="cx">                 ascent += child-&gt;marginTop();
</span><span class="cx">                 LayoutUnit descent = (child-&gt;height() + child-&gt;verticalMarginExtent()) - ascent;
</span><span class="cx"> 
</span><span class="lines">@@ -510,9 +508,7 @@
</span><span class="cx">                     childY += child-&gt;marginTop() + std::max&lt;LayoutUnit&gt;(0, (contentHeight() - (child-&gt;height() + child-&gt;verticalMarginExtent())) / 2);
</span><span class="cx">                     break;
</span><span class="cx">                 case BBASELINE: {
</span><del>-                    LayoutUnit ascent = child-&gt;firstLineBaseline();
-                    if (ascent == -1)
-                        ascent = child-&gt;height() + child-&gt;marginBottom();
</del><ins>+                    LayoutUnit ascent = child-&gt;firstLineBaseline().valueOr(child-&gt;height() + child-&gt;marginBottom());
</ins><span class="cx">                     ascent += child-&gt;marginTop();
</span><span class="cx">                     childY += child-&gt;marginTop() + (maxAscent - ascent);
</span><span class="cx">                     break;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderFlexibleBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (181397 => 181398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp        2015-03-11 18:21:05 UTC (rev 181397)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp        2015-03-11 18:22:06 UTC (rev 181398)
</span><span class="lines">@@ -169,18 +169,16 @@
</span><span class="cx"> 
</span><span class="cx"> int RenderFlexibleBox::baselinePosition(FontBaseline, bool, LineDirectionMode direction, LinePositionMode) const
</span><span class="cx"> {
</span><del>-    int baseline = firstLineBaseline();
-    if (baseline == -1)
-        baseline = synthesizedBaselineFromContentBox(*this, direction);
</del><ins>+    int baseline = firstLineBaseline().valueOr(synthesizedBaselineFromContentBox(*this, direction));
</ins><span class="cx"> 
</span><span class="cx">     int marginAscent = direction == HorizontalLine ? marginTop() : marginRight();
</span><span class="cx">     return baseline + marginAscent;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-int RenderFlexibleBox::firstLineBaseline() const
</del><ins>+Optional&lt;int&gt; RenderFlexibleBox::firstLineBaseline() const
</ins><span class="cx"> {
</span><span class="cx">     if (isWritingModeRoot() || m_numberOfInFlowChildrenOnFirstLine &lt;= 0)
</span><del>-        return -1;
</del><ins>+        return Optional&lt;int&gt;();
</ins><span class="cx">     RenderBox* baselineChild = 0;
</span><span class="cx">     int childNumber = 0;
</span><span class="cx">     for (RenderBox* child = m_orderIterator.first(); child; child = m_orderIterator.next()) {
</span><span class="lines">@@ -199,28 +197,27 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (!baselineChild)
</span><del>-        return -1;
</del><ins>+        return Optional&lt;int&gt;();
</ins><span class="cx"> 
</span><span class="cx">     if (!isColumnFlow() &amp;&amp; hasOrthogonalFlow(*baselineChild))
</span><del>-        return crossAxisExtentForChild(*baselineChild) + baselineChild-&gt;logicalTop();
</del><ins>+        return Optional&lt;int&gt;(crossAxisExtentForChild(*baselineChild) + baselineChild-&gt;logicalTop());
</ins><span class="cx">     if (isColumnFlow() &amp;&amp; !hasOrthogonalFlow(*baselineChild))
</span><del>-        return mainAxisExtentForChild(*baselineChild) + baselineChild-&gt;logicalTop();
</del><ins>+        return Optional&lt;int&gt;(mainAxisExtentForChild(*baselineChild) + baselineChild-&gt;logicalTop());
</ins><span class="cx"> 
</span><del>-    int baseline = baselineChild-&gt;firstLineBaseline();
-    if (baseline == -1) {
</del><ins>+    Optional&lt;int&gt; baseline = baselineChild-&gt;firstLineBaseline();
+    if (!baseline) {
</ins><span class="cx">         // FIXME: We should pass |direction| into firstLineBoxBaseline and stop bailing out if we're a writing mode root.
</span><span class="cx">         // This would also fix some cases where the flexbox is orthogonal to its container.
</span><span class="cx">         LineDirectionMode direction = isHorizontalWritingMode() ? HorizontalLine : VerticalLine;
</span><del>-        return synthesizedBaselineFromContentBox(*baselineChild, direction) + baselineChild-&gt;logicalTop();
</del><ins>+        return Optional&lt;int&gt;(synthesizedBaselineFromContentBox(*baselineChild, direction) + baselineChild-&gt;logicalTop());
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return baseline + baselineChild-&gt;logicalTop();
</del><ins>+    return Optional&lt;int&gt;(baseline.value() + baselineChild-&gt;logicalTop());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-int RenderFlexibleBox::inlineBlockBaseline(LineDirectionMode direction) const
</del><ins>+Optional&lt;int&gt; RenderFlexibleBox::inlineBlockBaseline(LineDirectionMode direction) const
</ins><span class="cx"> {
</span><del>-    int baseline = firstLineBaseline();
-    if (baseline != -1)
</del><ins>+    if (Optional&lt;int&gt; baseline = firstLineBaseline())
</ins><span class="cx">         return baseline;
</span><span class="cx"> 
</span><span class="cx">     int marginAscent = direction == HorizontalLine ? marginTop() : marginRight();
</span><span class="lines">@@ -818,9 +815,7 @@
</span><span class="cx"> 
</span><span class="cx"> LayoutUnit RenderFlexibleBox::marginBoxAscentForChild(RenderBox&amp; child)
</span><span class="cx"> {
</span><del>-    LayoutUnit ascent = child.firstLineBaseline();
-    if (ascent == -1)
-        ascent = crossAxisExtentForChild(child);
</del><ins>+    LayoutUnit ascent = child.firstLineBaseline().valueOr(crossAxisExtentForChild(child));
</ins><span class="cx">     return ascent + flowAwareMarginBeforeForChild(child);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderFlexibleBoxh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.h (181397 => 181398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderFlexibleBox.h        2015-03-11 18:21:05 UTC (rev 181397)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.h        2015-03-11 18:22:06 UTC (rev 181398)
</span><span class="lines">@@ -49,8 +49,8 @@
</span><span class="cx">     virtual void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) override final;
</span><span class="cx"> 
</span><span class="cx">     virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override;
</span><del>-    virtual int firstLineBaseline() const override;
-    virtual int inlineBlockBaseline(LineDirectionMode) const override;
</del><ins>+    virtual Optional&lt;int&gt; firstLineBaseline() const override;
+    virtual Optional&lt;int&gt; inlineBlockBaseline(LineDirectionMode) const override;
</ins><span class="cx"> 
</span><span class="cx">     virtual void paintChildren(PaintInfo&amp; forSelf, const LayoutPoint&amp;, PaintInfo&amp; forChild, bool usePrintRect) override;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderMenuListh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderMenuList.h (181397 => 181398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderMenuList.h        2015-03-11 18:21:05 UTC (rev 181397)
+++ trunk/Source/WebCore/rendering/RenderMenuList.h        2015-03-11 18:22:06 UTC (rev 181398)
</span><span class="lines">@@ -123,8 +123,8 @@
</span><span class="cx">     {
</span><span class="cx">         return RenderBlock::baselinePosition(baseline, firstLine, direction, position);
</span><span class="cx">     }
</span><del>-    virtual int firstLineBaseline() const override { return RenderBlock::firstLineBaseline(); }
-    virtual int inlineBlockBaseline(LineDirectionMode direction) const override { return RenderBlock::inlineBlockBaseline(direction); }
</del><ins>+    virtual Optional&lt;int&gt; firstLineBaseline() const override { return RenderBlock::firstLineBaseline(); }
+    virtual Optional&lt;int&gt; inlineBlockBaseline(LineDirectionMode direction) const override { return RenderBlock::inlineBlockBaseline(direction); }
</ins><span class="cx"> 
</span><span class="cx">     void getItemBackgroundColor(unsigned listIndex, Color&amp;, bool&amp; itemHasCustomBackgroundColor) const;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderTablecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderTable.cpp (181397 => 181398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderTable.cpp        2015-03-11 18:21:05 UTC (rev 181397)
+++ trunk/Source/WebCore/rendering/RenderTable.cpp        2015-03-11 18:22:06 UTC (rev 181398)
</span><span class="lines">@@ -1332,7 +1332,7 @@
</span><span class="cx"> 
</span><span class="cx">     // Find the section and row to look in
</span><span class="cx">     unsigned r = cell-&gt;rowIndex();
</span><del>-    RenderTableSection* section = 0;
</del><ins>+    RenderTableSection* section = nullptr;
</ins><span class="cx">     unsigned rAbove = 0;
</span><span class="cx">     if (r &gt; 0) {
</span><span class="cx">         // cell is not in the first row, so use the above row in its own section
</span><span class="lines">@@ -1352,7 +1352,7 @@
</span><span class="cx">         RenderTableSection::CellStruct&amp; aboveCell = section-&gt;cellAt(rAbove, effCol);
</span><span class="cx">         return aboveCell.primaryCell();
</span><span class="cx">     } else
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> RenderTableCell* RenderTable::cellBelow(const RenderTableCell* cell) const
</span><span class="lines">@@ -1361,7 +1361,7 @@
</span><span class="cx"> 
</span><span class="cx">     // Find the section and row to look in
</span><span class="cx">     unsigned r = cell-&gt;rowIndex() + cell-&gt;rowSpan() - 1;
</span><del>-    RenderTableSection* section = 0;
</del><ins>+    RenderTableSection* section = nullptr;
</ins><span class="cx">     unsigned rBelow = 0;
</span><span class="cx">     if (r &lt; cell-&gt;section()-&gt;numRows() - 1) {
</span><span class="cx">         // The cell is not in the last row, so use the next row in the section.
</span><span class="lines">@@ -1379,7 +1379,7 @@
</span><span class="cx">         RenderTableSection::CellStruct&amp; belowCell = section-&gt;cellAt(rBelow, effCol);
</span><span class="cx">         return belowCell.primaryCell();
</span><span class="cx">     } else
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> RenderTableCell* RenderTable::cellBefore(const RenderTableCell* cell) const
</span><span class="lines">@@ -1389,7 +1389,7 @@
</span><span class="cx">     RenderTableSection* section = cell-&gt;section();
</span><span class="cx">     unsigned effCol = colToEffCol(cell-&gt;col());
</span><span class="cx">     if (!effCol)
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx">     
</span><span class="cx">     // If we hit a colspan back up to a real cell.
</span><span class="cx">     RenderTableSection::CellStruct&amp; prevCell = section-&gt;cellAt(cell-&gt;rowIndex(), effCol - 1);
</span><span class="lines">@@ -1402,13 +1402,13 @@
</span><span class="cx"> 
</span><span class="cx">     unsigned effCol = colToEffCol(cell-&gt;col() + cell-&gt;colSpan());
</span><span class="cx">     if (effCol &gt;= numEffCols())
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx">     return cell-&gt;section()-&gt;primaryCellAt(cell-&gt;rowIndex(), effCol);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> RenderBlock* RenderTable::firstLineBlock() const
</span><span class="cx"> {
</span><del>-    return 0;
</del><ins>+    return nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void RenderTable::updateFirstLetter()
</span><span class="lines">@@ -1417,40 +1417,37 @@
</span><span class="cx"> 
</span><span class="cx"> int RenderTable::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
</span><span class="cx"> {
</span><del>-    LayoutUnit baseline = firstLineBaseline();
-    if (baseline != -1)
-        return baseline;
-
-    return RenderBox::baselinePosition(baselineType, firstLine, direction, linePositionMode);
</del><ins>+    return firstLineBaseline().valueOrCompute([&amp;] {
+        return RenderBox::baselinePosition(baselineType, firstLine, direction, linePositionMode);
+    });
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-int RenderTable::inlineBlockBaseline(LineDirectionMode) const
</del><ins>+Optional&lt;int&gt; RenderTable::inlineBlockBaseline(LineDirectionMode) const
</ins><span class="cx"> {
</span><span class="cx">     // Tables are skipped when computing an inline-block's baseline.
</span><del>-    return -1;
</del><ins>+    return Optional&lt;int&gt;();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-int RenderTable::firstLineBaseline() const
</del><ins>+Optional&lt;int&gt; RenderTable::firstLineBaseline() const
</ins><span class="cx"> {
</span><span class="cx">     // The baseline of a 'table' is the same as the 'inline-table' baseline per CSS 3 Flexbox (CSS 2.1
</span><span class="cx">     // doesn't define the baseline of a 'table' only an 'inline-table').
</span><span class="cx">     // This is also needed to properly determine the baseline of a cell if it has a table child.
</span><span class="cx"> 
</span><span class="cx">     if (isWritingModeRoot())
</span><del>-        return -1;
</del><ins>+        return Optional&lt;int&gt;();
</ins><span class="cx"> 
</span><span class="cx">     recalcSectionsIfNeeded();
</span><span class="cx"> 
</span><span class="cx">     const RenderTableSection* topNonEmptySection = this-&gt;topNonEmptySection();
</span><span class="cx">     if (!topNonEmptySection)
</span><del>-        return -1;
</del><ins>+        return Optional&lt;int&gt;();
</ins><span class="cx"> 
</span><del>-    int baseline = topNonEmptySection-&gt;firstLineBaseline();
-    if (baseline &gt; 0)
-        return topNonEmptySection-&gt;logicalTop() + baseline;
</del><ins>+    if (Optional&lt;int&gt; baseline = topNonEmptySection-&gt;firstLineBaseline())
+        return Optional&lt;int&gt;(topNonEmptySection-&gt;logicalTop() + baseline.value());
</ins><span class="cx"> 
</span><span class="cx">     // FIXME: A table row always has a baseline per CSS 2.1. Will this return the right value?
</span><del>-    return -1;
</del><ins>+    return Optional&lt;int&gt;();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> LayoutRect RenderTable::overflowClipRect(const LayoutPoint&amp; location, RenderRegion* region, OverlayScrollbarSizeRelevancy relevancy, PaintPhase phase)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderTableh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderTable.h (181397 => 181398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderTable.h        2015-03-11 18:21:05 UTC (rev 181397)
+++ trunk/Source/WebCore/rendering/RenderTable.h        2015-03-11 18:22:06 UTC (rev 181398)
</span><span class="lines">@@ -299,8 +299,8 @@
</span><span class="cx">     virtual bool nodeAtPoint(const HitTestRequest&amp;, HitTestResult&amp;, const HitTestLocation&amp; locationInContainer, const LayoutPoint&amp; accumulatedOffset, HitTestAction) override;
</span><span class="cx"> 
</span><span class="cx">     virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override final;
</span><del>-    virtual int firstLineBaseline() const override;
-    virtual int inlineBlockBaseline(LineDirectionMode) const override final;
</del><ins>+    virtual Optional&lt;int&gt; firstLineBaseline() const override;
+    virtual Optional&lt;int&gt; inlineBlockBaseline(LineDirectionMode) const override final;
</ins><span class="cx"> 
</span><span class="cx">     RenderTableCol* slowColElement(unsigned col, bool* startEdge, bool* endEdge) const;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderTableCellcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderTableCell.cpp (181397 => 181398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderTableCell.cpp        2015-03-11 18:21:05 UTC (rev 181397)
+++ trunk/Source/WebCore/rendering/RenderTableCell.cpp        2015-03-11 18:22:06 UTC (rev 181398)
</span><span class="lines">@@ -393,10 +393,7 @@
</span><span class="cx">     // &lt;http://www.w3.org/TR/2007/CR-CSS21-20070719/tables.html#height-layout&gt;: The baseline of a cell is the baseline of
</span><span class="cx">     // the first in-flow line box in the cell, or the first in-flow table-row in the cell, whichever comes first. If there
</span><span class="cx">     // is no such line box or table-row, the baseline is the bottom of content edge of the cell box.
</span><del>-    LayoutUnit baseline = firstLineBaseline();
-    if (baseline != -1)
-        return baseline;
-    return borderAndPaddingBefore() + contentLogicalHeight();
</del><ins>+    return firstLineBaseline().valueOr(borderAndPaddingBefore() + contentLogicalHeight());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void RenderTableCell::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderTableSectioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderTableSection.cpp (181397 => 181398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderTableSection.cpp        2015-03-11 18:21:05 UTC (rev 181397)
+++ trunk/Source/WebCore/rendering/RenderTableSection.cpp        2015-03-11 18:22:06 UTC (rev 181398)
</span><span class="lines">@@ -908,26 +908,28 @@
</span><span class="cx">     m_outerBorderEnd = calcOuterBorderEnd();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-int RenderTableSection::firstLineBaseline() const
</del><ins>+Optional&lt;int&gt; RenderTableSection::firstLineBaseline() const
</ins><span class="cx"> {
</span><span class="cx">     if (!m_grid.size())
</span><del>-        return -1;
</del><ins>+        return Optional&lt;int&gt;();
</ins><span class="cx"> 
</span><span class="cx">     int firstLineBaseline = m_grid[0].baseline;
</span><span class="cx">     if (firstLineBaseline)
</span><span class="cx">         return firstLineBaseline + m_rowPos[0];
</span><span class="cx"> 
</span><del>-    firstLineBaseline = -1;
</del><ins>+    Optional&lt;int&gt; result;
</ins><span class="cx">     const Row&amp; firstRow = m_grid[0].row;
</span><span class="cx">     for (size_t i = 0; i &lt; firstRow.size(); ++i) {
</span><span class="cx">         const CellStruct&amp; cs = firstRow.at(i);
</span><span class="cx">         const RenderTableCell* cell = cs.primaryCell();
</span><span class="cx">         // Only cells with content have a baseline
</span><del>-        if (cell &amp;&amp; cell-&gt;contentLogicalHeight())
-            firstLineBaseline = std::max&lt;int&gt;(firstLineBaseline, cell-&gt;logicalTop() + cell-&gt;borderAndPaddingBefore() + cell-&gt;contentLogicalHeight());
</del><ins>+        if (cell &amp;&amp; cell-&gt;contentLogicalHeight()) {
+            int candidate = cell-&gt;logicalTop() + cell-&gt;borderAndPaddingBefore() + cell-&gt;contentLogicalHeight();
+            result = std::max(result.valueOr(candidate), candidate);
+        }
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return firstLineBaseline;
</del><ins>+    return result;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void RenderTableSection::paint(PaintInfo&amp; paintInfo, const LayoutPoint&amp; paintOffset)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderTableSectionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderTableSection.h (181397 => 181398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderTableSection.h        2015-03-11 18:21:05 UTC (rev 181397)
+++ trunk/Source/WebCore/rendering/RenderTableSection.h        2015-03-11 18:22:06 UTC (rev 181398)
</span><span class="lines">@@ -64,7 +64,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0) override;
</span><span class="cx"> 
</span><del>-    virtual int firstLineBaseline() const override;
</del><ins>+    virtual Optional&lt;int&gt; firstLineBaseline() const override;
</ins><span class="cx"> 
</span><span class="cx">     void addCell(RenderTableCell*, RenderTableRow* row);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderTextControlh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderTextControl.h (181397 => 181398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderTextControl.h        2015-03-11 18:21:05 UTC (rev 181397)
+++ trunk/Source/WebCore/rendering/RenderTextControl.h        2015-03-11 18:22:06 UTC (rev 181398)
</span><span class="lines">@@ -102,8 +102,8 @@
</span><span class="cx">     {
</span><span class="cx">         return RenderBlock::baselinePosition(baseline, firstLine, direction, position);
</span><span class="cx">     }
</span><del>-    virtual int firstLineBaseline() const override { return RenderBlock::firstLineBaseline(); }
-    virtual int inlineBlockBaseline(LineDirectionMode direction) const override { return RenderBlock::inlineBlockBaseline(direction); }
</del><ins>+    virtual Optional&lt;int&gt; firstLineBaseline() const override { return RenderBlock::firstLineBaseline(); }
+    virtual Optional&lt;int&gt; inlineBlockBaseline(LineDirectionMode direction) const override { return RenderBlock::inlineBlockBaseline(direction); }
</ins><span class="cx"> 
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLBlockcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp (181397 => 181398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp        2015-03-11 18:21:05 UTC (rev 181397)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp        2015-03-11 18:22:06 UTC (rev 181398)
</span><span class="lines">@@ -72,11 +72,10 @@
</span><span class="cx">     if (linePositionMode == PositionOfInteriorLineBoxes)
</span><span class="cx">         return 0;
</span><span class="cx">     
</span><del>-    LayoutUnit baseline = firstLineBaseline(); // FIXME: This may be unnecessary after flex baselines are implemented (https://bugs.webkit.org/show_bug.cgi?id=96188).
-    if (baseline != -1)
-        return baseline;
-    
-    return RenderFlexibleBox::baselinePosition(baselineType, firstLine, direction, linePositionMode);
</del><ins>+    // FIXME: This may be unnecessary after flex baselines are implemented (https://bugs.webkit.org/show_bug.cgi?id=96188).
+    return firstLineBaseline().valueOrCompute([&amp;] {
+        return RenderFlexibleBox::baselinePosition(baselineType, firstLine, direction, linePositionMode);
+    });
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> const char* RenderMathMLBlock::renderName() const
</span><span class="lines">@@ -299,7 +298,7 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-int RenderMathMLTable::firstLineBaseline() const
</del><ins>+Optional&lt;int&gt; RenderMathMLTable::firstLineBaseline() const
</ins><span class="cx"> {
</span><span class="cx">     // In legal MathML, we'll have a MathML parent. That RenderFlexibleBox parent will use our firstLineBaseline() for baseline alignment, per
</span><span class="cx">     // http://dev.w3.org/csswg/css3-flexbox/#flex-baselines. We want to vertically center an &lt;mtable&gt;, such as a matrix. Essentially the whole &lt;mtable&gt; element fits on a
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLBlockh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.h (181397 => 181398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.h        2015-03-11 18:21:05 UTC (rev 181397)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.h        2015-03-11 18:22:06 UTC (rev 181398)
</span><span class="lines">@@ -76,7 +76,7 @@
</span><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    virtual int firstLineBaseline() const override;
</del><ins>+    virtual Optional&lt;int&gt; firstLineBaseline() const override;
</ins><span class="cx">     
</span><span class="cx"> private:
</span><span class="cx">     virtual bool isRenderMathMLTable() const override { return true; }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLFractioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp (181397 => 181398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp        2015-03-11 18:21:05 UTC (rev 181397)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp        2015-03-11 18:22:06 UTC (rev 181398)
</span><span class="lines">@@ -159,10 +159,10 @@
</span><span class="cx">     info.context-&gt;drawLine(adjustedPaintOffset, IntPoint(adjustedPaintOffset.x() + denominatorWrapper-&gt;pixelSnappedOffsetWidth(), adjustedPaintOffset.y()));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-int RenderMathMLFraction::firstLineBaseline() const
</del><ins>+Optional&lt;int&gt; RenderMathMLFraction::firstLineBaseline() const
</ins><span class="cx"> {
</span><span class="cx">     if (RenderBox* denominatorWrapper = lastChildBox())
</span><del>-        return denominatorWrapper-&gt;logicalTop() + static_cast&lt;int&gt;(lroundf((m_lineThickness + style().fontMetrics().xHeight()) / 2));
</del><ins>+        return Optional&lt;int&gt;(denominatorWrapper-&gt;logicalTop() + static_cast&lt;int&gt;(lroundf((m_lineThickness + style().fontMetrics().xHeight()) / 2)));
</ins><span class="cx">     return RenderMathMLBlock::firstLineBaseline();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLFractionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.h (181397 => 181398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.h        2015-03-11 18:21:05 UTC (rev 181397)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.h        2015-03-11 18:22:06 UTC (rev 181398)
</span><span class="lines">@@ -47,7 +47,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void addChild(RenderObject* child, RenderObject* beforeChild) override;
</span><span class="cx">     virtual void updateFromElement() override;
</span><del>-    virtual int firstLineBaseline() const override;
</del><ins>+    virtual Optional&lt;int&gt; firstLineBaseline() const override;
</ins><span class="cx">     virtual void paint(PaintInfo&amp;, const LayoutPoint&amp;) override;
</span><span class="cx">     virtual RenderMathMLOperator* unembellishedOperator() override;
</span><span class="cx">     virtual void layout() override;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLOperatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp (181397 => 181398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp        2015-03-11 18:21:05 UTC (rev 181397)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp        2015-03-11 18:22:06 UTC (rev 181398)
</span><span class="lines">@@ -1737,10 +1737,10 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-int RenderMathMLOperator::firstLineBaseline() const
</del><ins>+Optional&lt;int&gt; RenderMathMLOperator::firstLineBaseline() const
</ins><span class="cx"> {
</span><span class="cx">     if (m_stretchyData.mode() != DrawNormal)
</span><del>-        return m_stretchHeightAboveBaseline;
</del><ins>+        return Optional&lt;int&gt;(m_stretchHeightAboveBaseline);
</ins><span class="cx">     return RenderMathMLToken::firstLineBaseline();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLOperatorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h (181397 => 181398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h        2015-03-11 18:21:05 UTC (rev 181397)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h        2015-03-11 18:22:06 UTC (rev 181398)
</span><span class="lines">@@ -154,7 +154,7 @@
</span><span class="cx">     bool isInvisibleOperator() const { return 0x2061 &lt;= m_textContent &amp;&amp; m_textContent &lt;= 0x2064; }
</span><span class="cx">     virtual bool isChildAllowed(const RenderObject&amp;, const RenderStyle&amp;) const override;
</span><span class="cx"> 
</span><del>-    virtual int firstLineBaseline() const override;
</del><ins>+    virtual Optional&lt;int&gt; firstLineBaseline() const override;
</ins><span class="cx">     virtual RenderMathMLOperator* unembellishedOperator() override { return this; }
</span><span class="cx">     void rebuildTokenContent(const String&amp; operatorString);
</span><span class="cx">     virtual void updateFromElement() override;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLRootcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp (181397 => 181398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp        2015-03-11 18:21:05 UTC (rev 181397)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp        2015-03-11 18:22:06 UTC (rev 181398)
</span><span class="lines">@@ -250,11 +250,11 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-int RenderMathMLRoot::firstLineBaseline() const
</del><ins>+Optional&lt;int&gt; RenderMathMLRoot::firstLineBaseline() const
</ins><span class="cx"> {
</span><span class="cx">     if (!isEmpty()) {
</span><span class="cx">         auto base = baseWrapper();
</span><del>-        return static_cast&lt;int&gt;(lroundf(base-&gt;firstLineBaseline() + base-&gt;marginTop()));
</del><ins>+        return static_cast&lt;int&gt;(lroundf(base-&gt;firstLineBaseline().valueOr(-1) + base-&gt;marginTop()));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return RenderMathMLBlock::firstLineBaseline();
</span><span class="lines">@@ -285,9 +285,7 @@
</span><span class="cx">     if (radical) {
</span><span class="cx">         // We stretch the radical sign to cover the height of the base wrapper.
</span><span class="cx">         float baseHeight = base-&gt;logicalHeight();
</span><del>-        float baseHeightAboveBaseline = base-&gt;firstLineBaseline();
-        if (baseHeightAboveBaseline == -1)
-            baseHeightAboveBaseline = baseHeight;
</del><ins>+        float baseHeightAboveBaseline = base-&gt;firstLineBaseline().valueOr(baseHeight);
</ins><span class="cx">         float baseDepthBelowBaseline = baseHeight - baseHeightAboveBaseline;
</span><span class="cx">         baseHeightAboveBaseline += m_verticalGap;
</span><span class="cx">         radical-&gt;stretchTo(baseHeightAboveBaseline, baseDepthBelowBaseline);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLRooth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.h (181397 => 181398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.h        2015-03-11 18:21:05 UTC (rev 181397)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.h        2015-03-11 18:22:06 UTC (rev 181398)
</span><span class="lines">@@ -60,7 +60,7 @@
</span><span class="cx"> private:
</span><span class="cx">     virtual bool isRenderMathMLRoot() const override final { return true; }
</span><span class="cx">     virtual const char* renderName() const override { return &quot;RenderMathMLRoot&quot;; }
</span><del>-    virtual int firstLineBaseline() const override;
</del><ins>+    virtual Optional&lt;int&gt; firstLineBaseline() const override;
</ins><span class="cx">     void updateStyle();
</span><span class="cx">     void restructureWrappers();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLRowcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp (181397 => 181398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp        2015-03-11 18:21:05 UTC (rev 181397)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp        2015-03-11 18:22:06 UTC (rev 181398)
</span><span class="lines">@@ -81,13 +81,11 @@
</span><span class="cx">         LayoutUnit childHeightAboveBaseline = 0, childDepthBelowBaseline = 0;
</span><span class="cx">         if (is&lt;RenderMathMLBlock&gt;(*child)) {
</span><span class="cx">             RenderMathMLBlock&amp; mathmlChild = downcast&lt;RenderMathMLBlock&gt;(*child);
</span><del>-            childHeightAboveBaseline = mathmlChild.firstLineBaseline();
-            if (childHeightAboveBaseline == -1)
-                childHeightAboveBaseline = mathmlChild.logicalHeight();
</del><ins>+            childHeightAboveBaseline = mathmlChild.firstLineBaseline().valueOr(mathmlChild.logicalHeight());
</ins><span class="cx">             childDepthBelowBaseline = mathmlChild.logicalHeight() - childHeightAboveBaseline;
</span><span class="cx">         } else if (is&lt;RenderMathMLTable&gt;(*child)) {
</span><span class="cx">             RenderMathMLTable&amp; tableChild = downcast&lt;RenderMathMLTable&gt;(*child);
</span><del>-            childHeightAboveBaseline = tableChild.firstLineBaseline();
</del><ins>+            childHeightAboveBaseline = tableChild.firstLineBaseline().valueOr(-1);
</ins><span class="cx">             childDepthBelowBaseline = tableChild.logicalHeight() - childHeightAboveBaseline;
</span><span class="cx">         } else if (is&lt;RenderBox&gt;(*child)) {
</span><span class="cx">             childHeightAboveBaseline = downcast&lt;RenderBox&gt;(*child).logicalHeight();
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLScriptscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp (181397 => 181398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp        2015-03-11 18:21:05 UTC (rev 181397)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp        2015-03-11 18:22:06 UTC (rev 181398)
</span><span class="lines">@@ -280,9 +280,7 @@
</span><span class="cx">     // below the base's top edge, or the subscript's bottom edge above the base's bottom edge.
</span><span class="cx"> 
</span><span class="cx">     LayoutUnit baseHeight = base-&gt;logicalHeight();
</span><del>-    LayoutUnit baseBaseline = base-&gt;firstLineBaseline();
-    if (baseBaseline == -1)
-        baseBaseline = baseHeight;
</del><ins>+    LayoutUnit baseBaseline = base-&gt;firstLineBaseline().valueOr(baseHeight);
</ins><span class="cx">     LayoutUnit axis = style().fontMetrics().xHeight() / 2;
</span><span class="cx">     int fontSize = style().fontSize();
</span><span class="cx"> 
</span><span class="lines">@@ -314,9 +312,7 @@
</span><span class="cx"> 
</span><span class="cx">         if (RenderBox* superscript = m_kind == Sub ? 0 : subSupPair-&gt;lastChildBox()) {
</span><span class="cx">             LayoutUnit superscriptHeight = superscript-&gt;logicalHeight();
</span><del>-            LayoutUnit superscriptBaseline = superscript-&gt;firstLineBaseline();
-            if (superscriptBaseline == -1)
-                superscriptBaseline = superscriptHeight;
</del><ins>+            LayoutUnit superscriptBaseline = superscript-&gt;firstLineBaseline().valueOr(superscriptHeight);
</ins><span class="cx">             LayoutUnit minBaseline = std::max&lt;LayoutUnit&gt;(fontSize / 3 + 1 + superscriptBaseline, superscriptHeight + axis + superscriptShiftValue);
</span><span class="cx"> 
</span><span class="cx">             topPadding = std::max&lt;LayoutUnit&gt;(topPadding, minBaseline - baseBaseline);
</span><span class="lines">@@ -324,9 +320,7 @@
</span><span class="cx"> 
</span><span class="cx">         if (RenderBox* subscript = m_kind == Super ? 0 : subSupPair-&gt;firstChildBox()) {
</span><span class="cx">             LayoutUnit subscriptHeight = subscript-&gt;logicalHeight();
</span><del>-            LayoutUnit subscriptBaseline = subscript-&gt;firstLineBaseline();
-            if (subscriptBaseline == -1)
-                subscriptBaseline = subscriptHeight;
</del><ins>+            LayoutUnit subscriptBaseline = subscript-&gt;firstLineBaseline().valueOr(subscriptHeight);
</ins><span class="cx">             LayoutUnit baseExtendUnderBaseline = baseHeight - baseBaseline;
</span><span class="cx">             LayoutUnit subscriptUnderItsBaseline = subscriptHeight - subscriptBaseline;
</span><span class="cx">             LayoutUnit minExtendUnderBaseline = std::max&lt;LayoutUnit&gt;(fontSize / 5 + 1 + subscriptUnderItsBaseline, subscriptHeight + subscriptShiftValue - axis);
</span><span class="lines">@@ -356,11 +350,10 @@
</span><span class="cx">     RenderMathMLBlock::layout();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-int RenderMathMLScripts::firstLineBaseline() const
</del><ins>+Optional&lt;int&gt; RenderMathMLScripts::firstLineBaseline() const
</ins><span class="cx"> {
</span><span class="cx">     if (m_baseWrapper) {
</span><del>-        LayoutUnit baseline = m_baseWrapper-&gt;firstLineBaseline();
-        if (baseline != -1)
</del><ins>+        if (Optional&lt;int&gt; baseline = m_baseWrapper-&gt;firstLineBaseline())
</ins><span class="cx">             return baseline;
</span><span class="cx">     }
</span><span class="cx">     return RenderMathMLBlock::firstLineBaseline();
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLScriptsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLScripts.h (181397 => 181398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLScripts.h        2015-03-11 18:21:05 UTC (rev 181397)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLScripts.h        2015-03-11 18:22:06 UTC (rev 181398)
</span><span class="lines">@@ -76,7 +76,7 @@
</span><span class="cx">     virtual void removeChild(RenderObject&amp;) override;
</span><span class="cx">     
</span><span class="cx">     virtual RenderMathMLOperator* unembellishedOperator() override;
</span><del>-    virtual int firstLineBaseline() const override;
</del><ins>+    virtual Optional&lt;int&gt; firstLineBaseline() const override;
</ins><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="cx">     virtual void layout() override;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLSpacecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.cpp (181397 => 181398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.cpp        2015-03-11 18:21:05 UTC (rev 181397)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.cpp        2015-03-11 18:22:06 UTC (rev 181398)
</span><span class="lines">@@ -91,9 +91,9 @@
</span><span class="cx">     updateFromElement();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-int RenderMathMLSpace::firstLineBaseline() const
</del><ins>+Optional&lt;int&gt; RenderMathMLSpace::firstLineBaseline() const
</ins><span class="cx"> {
</span><del>-    return m_height;
</del><ins>+    return Optional&lt;int&gt;(m_height);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLSpaceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.h (181397 => 181398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.h        2015-03-11 18:21:05 UTC (rev 181397)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.h        2015-03-11 18:22:06 UTC (rev 181398)
</span><span class="lines">@@ -45,7 +45,7 @@
</span><span class="cx">     virtual bool isChildAllowed(const RenderObject&amp;, const RenderStyle&amp;) const override { return false; }
</span><span class="cx">     virtual void computeIntrinsicLogicalWidths(LayoutUnit&amp; minLogicalWidth, LayoutUnit&amp; maxLogicalWidth) const override;
</span><span class="cx">     virtual void updateFromElement() override;
</span><del>-    virtual int firstLineBaseline() const override;
</del><ins>+    virtual Optional&lt;int&gt; firstLineBaseline() const override;
</ins><span class="cx">     virtual void updateLogicalWidth() override;
</span><span class="cx">     virtual void updateLogicalHeight() override;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLUnderOvercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp (181397 => 181398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp        2015-03-11 18:21:05 UTC (rev 181397)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp        2015-03-11 18:22:06 UTC (rev 181398)
</span><span class="lines">@@ -60,14 +60,14 @@
</span><span class="cx">     return downcast&lt;RenderMathMLBlock&gt;(*base).unembellishedOperator();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-int RenderMathMLUnderOver::firstLineBaseline() const
</del><ins>+Optional&lt;int&gt; RenderMathMLUnderOver::firstLineBaseline() const
</ins><span class="cx"> {
</span><span class="cx">     RenderBox* base = firstChildBox();
</span><span class="cx">     if (!base)
</span><del>-        return -1;
-    LayoutUnit baseline = base-&gt;firstLineBaseline();
-    if (baseline != -1)
-        baseline += base-&gt;logicalTop();
</del><ins>+        return Optional&lt;int&gt;();
+    Optional&lt;int&gt; baseline = base-&gt;firstLineBaseline();
+    if (baseline)
+        baseline.value() += static_cast&lt;int&gt;(base-&gt;logicalTop());
</ins><span class="cx">     return baseline;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLUnderOverh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.h (181397 => 181398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.h        2015-03-11 18:21:05 UTC (rev 181397)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.h        2015-03-11 18:22:06 UTC (rev 181398)
</span><span class="lines">@@ -38,7 +38,7 @@
</span><span class="cx">     
</span><span class="cx">     virtual RenderMathMLOperator* unembellishedOperator() override;
</span><span class="cx"> 
</span><del>-    virtual int firstLineBaseline() const override;
</del><ins>+    virtual Optional&lt;int&gt; firstLineBaseline() const override;
</ins><span class="cx">     
</span><span class="cx"> protected:
</span><span class="cx">     virtual void layout() override;
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (181397 => 181398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2015-03-11 18:21:05 UTC (rev 181397)
+++ trunk/Tools/ChangeLog        2015-03-11 18:22:06 UTC (rev 181398)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2015-03-11  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
+
+        Use out-of-band messaging for RenderBox::firstLineBaseline() and RenderBox::inlineBlockBaseline()
+        https://bugs.webkit.org/show_bug.cgi?id=142569
+
+        Reviewed by David Hyatt.
+
+        Test Optional::valueOrCompute().
+
+        * TestWebKitAPI/Tests/WTF/Optional.cpp:
+        (TestWebKitAPI::TEST):
+
</ins><span class="cx"> 2015-03-11  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] Add an option to enable MiniBrowser for non developer builds and always install it
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWTFOptionalcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/Optional.cpp (181397 => 181398)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WTF/Optional.cpp        2015-03-11 18:21:05 UTC (rev 181397)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/Optional.cpp        2015-03-11 18:22:06 UTC (rev 181398)
</span><span class="lines">@@ -72,4 +72,25 @@
</span><span class="cx">     EXPECT_TRUE(didCallDestructor);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+TEST(WTF_Optional, Callback)
+{
+    bool called = false;
+    Optional&lt;int&gt; a;
+    int result = a.valueOrCompute([&amp;] {
+        called = true;
+        return 300;
+    });
+    EXPECT_TRUE(called);
+    EXPECT_EQ(result, 300);
+
+    a = 250;
+    called = false;
+    result = a.valueOrCompute([&amp;] {
+        called = true;
+        return 300;
+    });
+    EXPECT_FALSE(called);
+    EXPECT_EQ(result, 250);
+}
+
</ins><span class="cx"> } // namespace TestWebKitAPI
</span></span></pre>
</div>
</div>

</body>
</html>