Only skip stretchy operators when determining the stretch height.
authorfred.wang@free.fr <fred.wang@free.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 22 Feb 2014 10:21:18 +0000 (10:21 +0000)
committerfred.wang@free.fr <fred.wang@free.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 22 Feb 2014 10:21:18 +0000 (10:21 +0000)
https://bugs.webkit.org/show_bug.cgi?id=126842

Reviewed by Chris Fleizach.

Source/WebCore:

The MathML code only takes into account non-mo children for the computation of the stretch size. This change includes non-stretchy mo in that computation. A new test is added into mathml/presentation/stretchy-depth-height.html.

* rendering/mathml/RenderMathMLRow.cpp:
(WebCore::RenderMathMLRow::layout):

LayoutTests:

* mathml/presentation/stretchy-depth-height.html: Add a test with non-stretchy mo siblings.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@164538 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/mathml/presentation/stretchy-depth-height-expected.txt
LayoutTests/mathml/presentation/stretchy-depth-height.html
Source/WebCore/ChangeLog
Source/WebCore/rendering/mathml/RenderMathMLRow.cpp

index 21a65a9..f9e0930 100644 (file)
@@ -1,5 +1,14 @@
 2014-02-22  Frédéric Wang  <fred.wang@free.fr>
 
+        Only skip stretchy operators when determining the stretch height.
+        https://bugs.webkit.org/show_bug.cgi?id=126842
+
+        Reviewed by Chris Fleizach.
+
+        * mathml/presentation/stretchy-depth-height.html: Add a test with non-stretchy mo siblings.
+
+2014-02-22  Frédéric Wang  <fred.wang@free.fr>
+
         Implement asymmetric/symmetric stretching of vertical operators.
         https://bugs.webkit.org/show_bug.cgi?id=124827.
 
index 5a03dda..98543c3 100644 (file)
@@ -40,6 +40,7 @@ x     y       z
 5
 6
  
 
 symmetric stretching: PASS
 large depth: PASS
@@ -49,4 +50,5 @@ several siblings with different heights/depths: PASS
 testing several operators in one mrow (operator 1): PASS
 testing several operators in one mrow (operator 2): PASS
 testing several operators in one mrow (operator 3): PASS
+testing with non-stretchy mo: PASS
 
index db257fb..b851fd1 100644 (file)
               assert("testing several operators in one mrow (operator " + i + ")", almostEqual(s6.top, c6maxheight.top) && almostEqual(s6.bottom, c6maxdepth.bottom));
           }
 
+          var s71 = document.getElementById("s71").getBoundingClientRect();
+          var c71 = document.getElementById("c71").getBoundingClientRect();
+          var s72 = document.getElementById("s72").getBoundingClientRect();
+          var c72 = document.getElementById("c72").getBoundingClientRect();
+
+          assert("testing with non-stretchy mo", almostEqual(s71.top, c71.top) && almostEqual(s71.bottom, c71.bottom) && almostEqual(s72.top, c72.top) && almostEqual(s72.bottom, c72.bottom));
+
           document.getElementById("result").innerText = result;
   
           if (window.testRunner)
           <mo id="s6_3" symmetric="false">}</mo>
         </mrow>
       </math>
-
+      <!-- These tests whether the size of non-stretchy operators is taken into account (bug 126842). -->
+      <math>
+        <mrow>
+          <mo id="s71" symmetric="false">{</mo>
+          <mo id="c71" mathsize="8em">p</mo>
+        </mrow>
+        <mrow>
+          <mo id="s72" symmetric="false">{</mo>
+          <mo id="c72" mathsize="8em" stretchy="false">|</mo>
+        </mrow>
+      </math>
     </p>
 
     <div id="result"></div>
index ddd74d6..90a66a6 100644 (file)
@@ -1,5 +1,17 @@
 2014-02-22  Frédéric Wang  <fred.wang@free.fr>
 
+        Only skip stretchy operators when determining the stretch height.
+        https://bugs.webkit.org/show_bug.cgi?id=126842
+
+        Reviewed by Chris Fleizach.
+
+        The MathML code only takes into account non-mo children for the computation of the stretch size. This change includes non-stretchy mo in that computation. A new test is added into mathml/presentation/stretchy-depth-height.html.
+
+        * rendering/mathml/RenderMathMLRow.cpp:
+        (WebCore::RenderMathMLRow::layout):
+
+2014-02-22  Frédéric Wang  <fred.wang@free.fr>
+
         Implement asymmetric/symmetric stretching of vertical operators.
         https://bugs.webkit.org/show_bug.cgi?id=124827.
 
index 3e0eecf..e40745a 100644 (file)
@@ -61,9 +61,12 @@ void RenderMathMLRow::layout()
     for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
         if (child->needsLayout())
             toRenderElement(child)->layout();
-        // FIXME: Only skip renderMo if it is stretchy.
-        if (child->isRenderMathMLBlock() && toRenderMathMLBlock(child)->unembellishedOperator())
-            continue;
+        if (child->isRenderMathMLBlock()) {
+            // We skip the stretchy operators as they must not be included in the computation of the stretch size.
+            auto renderOperator = toRenderMathMLBlock(child)->unembellishedOperator();
+            if (renderOperator && renderOperator->hasOperatorFlag(MathMLOperatorDictionary::Stretchy))
+                continue;
+        }
         int childHeightAboveBaseline = 0, childDepthBelowBaseline = 0;
         if (child->isRenderMathMLBlock()) {
             RenderMathMLBlock* mathmlChild = toRenderMathMLBlock(child);