<!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>[208296] 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/208296">208296</a></dd>
<dt>Author</dt> <dd>bfulgham@apple.com</dd>
<dt>Date</dt> <dd>2016-11-02 12:47:16 -0700 (Wed, 02 Nov 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>REGRESSION(<a href="http://trac.webkit.org/projects/webkit/changeset/203289">r203289</a>):Assertion in MathOperator::stretchTo() on Wikipedia Page
https://bugs.webkit.org/show_bug.cgi?id=162933
&lt;rdar://problem/28570590&gt;

Reviewed by Dean Jackson.

Source/WebCore:

A debug assertion is triggered when an empty &lt;mo&gt; tag is used with a &quot;stretchy&quot; flag.

We shouldn't be trying to apply stretch operations on an empty MathML element. Create a
helper function (isStretchy) to encapsulate the fact that only non-empty elements with
the 'MathMLOperatorDictionary::Stretchy' operator flag should have stretching applied.

Test: mathml/empty-mo.html

* rendering/mathml/RenderMathMLOperator.cpp:
(WebCore::RenderMathMLOperator::stretchTo): Revise assertion to use new 'isStretchy' predicate.
* rendering/mathml/RenderMathMLOperator.h:
(WebCore::RenderMathMLOperator::isStretchy): Added.
* rendering/mathml/RenderMathMLRow.cpp:
(WebCore::RenderMathMLRow::computeLineVerticalStretch): Use new 'isStretchy' predicate.
(WebCore::RenderMathMLRow::layoutRowItems): Ditto.
* rendering/mathml/RenderMathMLUnderOver.cpp:
(WebCore::RenderMathMLUnderOver::computeOperatorsHorizontalStretch): Ditto.
(WebCore::RenderMathMLUnderOver::verticalParameters): Ditto.

LayoutTests:

* mathml/empty-mo-expected.txt: Added.
* mathml/empty-mo.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</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="#trunkSourceWebCorerenderingmathmlRenderMathMLRowcpp">trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLUnderOvercpp">trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsmathmlemptymoexpectedtxt">trunk/LayoutTests/mathml/empty-mo-expected.txt</a></li>
<li><a href="#trunkLayoutTestsmathmlemptymohtml">trunk/LayoutTests/mathml/empty-mo.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (208295 => 208296)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-11-02 18:52:39 UTC (rev 208295)
+++ trunk/LayoutTests/ChangeLog        2016-11-02 19:47:16 UTC (rev 208296)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2016-11-02  Brent Fulgham  &lt;bfulgham@apple.com&gt;
+
+        REGRESSION(r203289):Assertion in MathOperator::stretchTo() on Wikipedia Page
+        https://bugs.webkit.org/show_bug.cgi?id=162933
+        &lt;rdar://problem/28570590&gt;
+
+        Reviewed by Dean Jackson.
+
+        * mathml/empty-mo-expected.txt: Added.
+        * mathml/empty-mo.html: Added.
+
</ins><span class="cx"> 2016-11-01  Dean Jackson  &lt;dino@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Filter functions grayscale/invert/opacity/sepia should clamp values over 100%, not fail
</span></span></pre></div>
<a id="trunkLayoutTestsmathmlemptymoexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/mathml/empty-mo-expected.txt (0 => 208296)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/mathml/empty-mo-expected.txt                                (rev 0)
+++ trunk/LayoutTests/mathml/empty-mo-expected.txt        2016-11-02 19:47:16 UTC (rev 208296)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+Test passes if it does not debug assert.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Test 1: Empty &lt;mo&gt; tag:
+
+Test 2: Multi-character &lt;mo&gt; tag:
+
+++
+
</ins></span></pre></div>
<a id="trunkLayoutTestsmathmlemptymohtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/mathml/empty-mo.html (0 => 208296)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/mathml/empty-mo.html                                (rev 0)
+++ trunk/LayoutTests/mathml/empty-mo.html        2016-11-02 19:47:16 UTC (rev 208296)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+    &lt;script src=&quot;../resources/js-test.js&quot;&gt;&lt;/script&gt;
+    &lt;script&gt;
+      description(&quot;Test passes if it does not debug assert.&quot;);
+    &lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+        &lt;div&gt;
+        &lt;p&gt;Test 1: Empty &amp;lt;mo&amp;gt; tag:&lt;/p&gt;
+        &lt;math&gt;
+            &lt;mo stretchy=&quot;true&quot;&gt;&lt;/mo&gt;
+        &lt;/math&gt;
+    &lt;/div&gt;
+        &lt;div&gt;
+        &lt;p&gt;Test 2: Multi-character &amp;lt;mo&amp;gt; tag:&lt;/p&gt;
+        &lt;math&gt;
+            &lt;mo stretchy=&quot;true&quot;&gt;++&lt;/mo&gt;
+        &lt;/math&gt;
+    &lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (208295 => 208296)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-11-02 18:52:39 UTC (rev 208295)
+++ trunk/Source/WebCore/ChangeLog        2016-11-02 19:47:16 UTC (rev 208296)
</span><span class="lines">@@ -1,3 +1,30 @@
</span><ins>+2016-11-02  Brent Fulgham  &lt;bfulgham@apple.com&gt;
+
+        REGRESSION(r203289):Assertion in MathOperator::stretchTo() on Wikipedia Page
+        https://bugs.webkit.org/show_bug.cgi?id=162933
+        &lt;rdar://problem/28570590&gt;
+
+        Reviewed by Dean Jackson.
+
+        A debug assertion is triggered when an empty &lt;mo&gt; tag is used with a &quot;stretchy&quot; flag.
+
+        We shouldn't be trying to apply stretch operations on an empty MathML element. Create a
+        helper function (isStretchy) to encapsulate the fact that only non-empty elements with
+        the 'MathMLOperatorDictionary::Stretchy' operator flag should have stretching applied.
+
+        Test: mathml/empty-mo.html
+
+        * rendering/mathml/RenderMathMLOperator.cpp:
+        (WebCore::RenderMathMLOperator::stretchTo): Revise assertion to use new 'isStretchy' predicate.
+        * rendering/mathml/RenderMathMLOperator.h:
+        (WebCore::RenderMathMLOperator::isStretchy): Added.
+        * rendering/mathml/RenderMathMLRow.cpp:
+        (WebCore::RenderMathMLRow::computeLineVerticalStretch): Use new 'isStretchy' predicate.
+        (WebCore::RenderMathMLRow::layoutRowItems): Ditto.
+        * rendering/mathml/RenderMathMLUnderOver.cpp:
+        (WebCore::RenderMathMLUnderOver::computeOperatorsHorizontalStretch): Ditto.
+        (WebCore::RenderMathMLUnderOver::verticalParameters): Ditto.
+
</ins><span class="cx"> 2016-11-01  Dean Jackson  &lt;dino@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Filter functions grayscale/invert/opacity/sepia should clamp values over 100%, not fail
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLOperatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp (208295 => 208296)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp        2016-11-02 18:52:39 UTC (rev 208295)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp        2016-11-02 19:47:16 UTC (rev 208296)
</span><span class="lines">@@ -117,7 +117,7 @@
</span><span class="cx"> 
</span><span class="cx"> void RenderMathMLOperator::stretchTo(LayoutUnit heightAboveBaseline, LayoutUnit depthBelowBaseline)
</span><span class="cx"> {
</span><del>-    ASSERT(hasOperatorFlag(MathMLOperatorDictionary::Stretchy));
</del><ins>+    ASSERT(isStretchy());
</ins><span class="cx">     ASSERT(isVertical());
</span><span class="cx"> 
</span><span class="cx">     if (!isVertical() || (heightAboveBaseline == m_stretchHeightAboveBaseline &amp;&amp; depthBelowBaseline == m_stretchDepthBelowBaseline))
</span><span class="lines">@@ -157,7 +157,7 @@
</span><span class="cx"> 
</span><span class="cx"> void RenderMathMLOperator::stretchTo(LayoutUnit width)
</span><span class="cx"> {
</span><del>-    ASSERT(hasOperatorFlag(MathMLOperatorDictionary::Stretchy));
</del><ins>+    ASSERT(isStretchy());
</ins><span class="cx">     ASSERT(!isVertical());
</span><span class="cx"> 
</span><span class="cx">     if (isVertical() || m_stretchWidth == width)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLOperatorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h (208295 => 208296)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h        2016-11-02 18:52:39 UTC (rev 208295)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h        2016-11-02 19:47:16 UTC (rev 208296)
</span><span class="lines">@@ -56,6 +56,7 @@
</span><span class="cx">     void updateTokenContent() final;
</span><span class="cx">     void updateFromElement() final;
</span><span class="cx">     virtual UChar32 textContent() const;
</span><ins>+    bool isStretchy() const { return textContent() &amp;&amp; hasOperatorFlag(MathMLOperatorDictionary::Stretchy); }
</ins><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="cx">     virtual void updateMathOperator();
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLRowcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp (208295 => 208296)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp        2016-11-02 18:52:39 UTC (rev 208295)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp        2016-11-02 19:47:16 UTC (rev 208296)
</span><span class="lines">@@ -63,7 +63,7 @@
</span><span class="cx">     for (auto* child = firstChildBox(); child; child = child-&gt;nextSiblingBox()) {
</span><span class="cx">         if (is&lt;RenderMathMLBlock&gt;(child)) {
</span><span class="cx">             auto* renderOperator = downcast&lt;RenderMathMLBlock&gt;(child)-&gt;unembellishedOperator();
</span><del>-            if (renderOperator &amp;&amp; renderOperator-&gt;hasOperatorFlag(MathMLOperatorDictionary::Stretchy))
</del><ins>+            if (renderOperator &amp;&amp; renderOperator-&gt;isStretchy())
</ins><span class="cx">                 continue;
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -109,7 +109,7 @@
</span><span class="cx"> 
</span><span class="cx">         if (is&lt;RenderMathMLBlock&gt;(child)) {
</span><span class="cx">             auto renderOperator = downcast&lt;RenderMathMLBlock&gt;(child)-&gt;unembellishedOperator();
</span><del>-            if (renderOperator &amp;&amp; renderOperator-&gt;hasOperatorFlag(MathMLOperatorDictionary::Stretchy) &amp;&amp; renderOperator-&gt;isVertical())
</del><ins>+            if (renderOperator &amp;&amp; renderOperator-&gt;isStretchy() &amp;&amp; renderOperator-&gt;isVertical())
</ins><span class="cx">                 renderOperator-&gt;stretchTo(ascent, descent);
</span><span class="cx">         }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLUnderOvercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp (208295 => 208296)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp        2016-11-02 18:52:39 UTC (rev 208295)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp        2016-11-02 19:47:16 UTC (rev 208296)
</span><span class="lines">@@ -56,7 +56,7 @@
</span><span class="cx">         if (child-&gt;needsLayout()) {
</span><span class="cx">             if (is&lt;RenderMathMLBlock&gt;(child)) {
</span><span class="cx">                 if (auto renderOperator = downcast&lt;RenderMathMLBlock&gt;(*child).unembellishedOperator()) {
</span><del>-                    if (renderOperator-&gt;hasOperatorFlag(MathMLOperatorDictionary::Stretchy) &amp;&amp; !renderOperator-&gt;isVertical()) {
</del><ins>+                    if (renderOperator-&gt;isStretchy() &amp;&amp; !renderOperator-&gt;isVertical()) {
</ins><span class="cx">                         renderOperator-&gt;resetStretchSize();
</span><span class="cx">                         renderOperators.append(renderOperator);
</span><span class="cx">                     }
</span><span class="lines">@@ -217,7 +217,7 @@
</span><span class="cx">                 parameters.useUnderOverBarFallBack = false;
</span><span class="cx">                 return parameters;
</span><span class="cx">             }
</span><del>-            if (baseOperator-&gt;hasOperatorFlag(MathMLOperatorDictionary::Stretchy) &amp;&amp; !baseOperator-&gt;isVertical()) {
</del><ins>+            if (baseOperator-&gt;isStretchy() &amp;&amp; !baseOperator-&gt;isVertical()) {
</ins><span class="cx">                 // The base is a horizontal stretchy operator, so we read StretchStack constants from the MATH table.
</span><span class="cx">                 parameters.underGapMin = mathData-&gt;getMathConstant(primaryFont, OpenTypeMathData::StretchStackGapBelowMin);
</span><span class="cx">                 parameters.overGapMin = mathData-&gt;getMathConstant(primaryFont, OpenTypeMathData::StretchStackGapAboveMin);
</span></span></pre>
</div>
</div>

</body>
</html>