Title: [160711] trunk
Revision
160711
Author
[email protected]
Date
2013-12-17 09:56:21 -0800 (Tue, 17 Dec 2013)

Log Message

Ensure inferred mrows for msqrt, mstyle, merror, mphantom and math.
https://bugs.webkit.org/show_bug.cgi?id=124841

Patch by Frédéric Wang <[email protected]> on 2013-12-17
Reviewed by Darin Adler.

Source/WebCore:

Tests: mathml/presentation/inferred-mrow-baseline.html
       mathml/presentation/inferred-mrow-stretchy.html

* css/mathml.css: make merror, mphantom and mstyle behave like an mrow.
(mo, mrow, mfenced, mfrac, msub, msup, msubsup, mmultiscripts, mprescripts, none, munder, mover, munderover, msqrt, mroot, merror, mphantom, mstyle):
(math, mrow, mfenced, msqrt, mroot, merror, mphantom, mstyle):
* mathml/MathMLInlineContainerElement.cpp: ditto
(WebCore::MathMLInlineContainerElement::createRenderer):
* mathml/mathtags.in: ditto
* rendering/mathml/RenderMathMLOperator.cpp:
(WebCore::RenderMathMLOperator::paint): fix failure in mathml/presentation/phantom.html now that phantom can stretch operators.

LayoutTests:

* mathml/presentation/inferred-mrow-baseline-expected.txt: Added.
* mathml/presentation/inferred-mrow-baseline.html: Added.
* mathml/presentation/inferred-mrow-stretchy-expected.txt: Added.
* mathml/presentation/inferred-mrow-stretchy.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (160710 => 160711)


--- trunk/LayoutTests/ChangeLog	2013-12-17 17:40:07 UTC (rev 160710)
+++ trunk/LayoutTests/ChangeLog	2013-12-17 17:56:21 UTC (rev 160711)
@@ -1,3 +1,15 @@
+2013-12-17  Frédéric Wang  <[email protected]>
+
+        Ensure inferred mrows for msqrt, mstyle, merror, mphantom and math.
+        https://bugs.webkit.org/show_bug.cgi?id=124841
+
+        Reviewed by Darin Adler.
+
+        * mathml/presentation/inferred-mrow-baseline-expected.txt: Added.
+        * mathml/presentation/inferred-mrow-baseline.html: Added.
+        * mathml/presentation/inferred-mrow-stretchy-expected.txt: Added.
+        * mathml/presentation/inferred-mrow-stretchy.html: Added.
+
 2013-12-17  Brent Fulgham  <[email protected]>
 
         [Win] Temporarily disable mediate tests to get bots green.

Added: trunk/LayoutTests/mathml/presentation/inferred-mrow-baseline-expected.txt (0 => 160711)


--- trunk/LayoutTests/mathml/presentation/inferred-mrow-baseline-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/mathml/presentation/inferred-mrow-baseline-expected.txt	2013-12-17 17:56:21 UTC (rev 160711)
@@ -0,0 +1,15 @@
+This test passes if rectangles are correctly aligned with respect to the baseline.
+
+ 
+ 
+ 
+ 
+ 
+
+Mrow: PASS
+Sqrt: PASS
+Style: PASS
+Error: PASS
+Phantom: PASS
+Math: PASS
+

Added: trunk/LayoutTests/mathml/presentation/inferred-mrow-baseline.html (0 => 160711)


--- trunk/LayoutTests/mathml/presentation/inferred-mrow-baseline.html	                        (rev 0)
+++ trunk/LayoutTests/mathml/presentation/inferred-mrow-baseline.html	2013-12-17 17:56:21 UTC (rev 160711)
@@ -0,0 +1,44 @@
+<html>
+  <head>
+    <title>inferred mrows</title>
+    <meta charset="utf-8">
+    <script type="text/_javascript_">
+      function test()
+      {
+        var tags = ["Mrow", "Sqrt", "Style", "Error", "Phantom", "Math"];
+        var result = "";
+        for (var i in tags) {
+          var tag = tags[i];
+          var x = document.getElementById("above" + tag).getBoundingClientRect();
+          var y = document.getElementById("below" + tag).getBoundingClientRect();
+          result += tag + ": " + (x.bottom == y.top ? "PASS" : "FAIL") + "\n";
+        }
+        document.getElementById("result").innerText = result;
+  
+        if (window.testRunner)
+          testRunner.dumpAsText();
+      }
+    </script>
+  </head>
+  <body _onload_="test()">
+
+    <p>This test passes if rectangles are correctly aligned with respect to the baseline.</p>
+
+    <p>
+      <math><mrow><mspace id="aboveMrow" width="10px" height="30px" mathbackground="red"></mspace><mspace id="belowMrow" width="10px" depth="30px" mathbackground="blue"></mspace></mrow></math>
+
+      <math><msqrt><mspace id="aboveSqrt" width="10px" height="30px" mathbackground="red"></mspace><mspace id="belowSqrt" width="10px" depth="30px" mathbackground="blue"></mspace></msqrt></math>
+
+      <math><mstyle><mspace id="aboveStyle" width="10px" height="30px" mathbackground="red"></mspace><mspace id="belowStyle" width="10px" depth="30px" mathbackground="blue"></mspace></mstyle></math>
+
+      <math><merror><mspace id="aboveError" width="10px" height="30px" mathbackground="red"></mspace><mspace id="belowError" width="10px" depth="30px" mathbackground="blue"></mspace></merror></math>
+
+      <math><mphantom><mspace style="visibility: visible;" id="abovePhantom" width="10px" height="30px" mathbackground="red"></mspace><mspace style="visibility: visible;" id="belowPhantom" width="10px" depth="30px" mathbackground="blue"></mspace></mphantom></math>
+
+      <math><mspace id="aboveMath" width="10px" height="30px" mathbackground="red"></mspace><mspace id="belowMath" width="10px" depth="30px" mathbackground="blue"></mspace></math>
+    </p>
+
+    <div id="result"></div>
+
+  </body>
+</html>

Added: trunk/LayoutTests/mathml/presentation/inferred-mrow-stretchy-expected.txt (0 => 160711)


--- trunk/LayoutTests/mathml/presentation/inferred-mrow-stretchy-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/mathml/presentation/inferred-mrow-stretchy-expected.txt	2013-12-17 17:56:21 UTC (rev 160711)
@@ -0,0 +1,15 @@
+This test passes if all the vertical bars stretch.
+
+ 
+ 
+ 
+ 
+ 
+
+Mrow: PASS
+Sqrt: PASS
+Style: PASS
+Error: PASS
+Phantom: PASS
+Math: PASS
+

Added: trunk/LayoutTests/mathml/presentation/inferred-mrow-stretchy.html (0 => 160711)


--- trunk/LayoutTests/mathml/presentation/inferred-mrow-stretchy.html	                        (rev 0)
+++ trunk/LayoutTests/mathml/presentation/inferred-mrow-stretchy.html	2013-12-17 17:56:21 UTC (rev 160711)
@@ -0,0 +1,38 @@
+<html>
+  <head>
+    <title>inferred mrows</title>
+    <meta charset="utf-8">
+    <script type="text/_javascript_">
+      function test()
+      {
+        var tags = ["Mrow", "Sqrt", "Style", "Error", "Phantom", "Math"];
+        var result = "";
+        for (var i in tags) {
+          var tag = tags[i];
+          var mo = document.getElementById("mo" + tag);
+          result += tag + ": " + (mo.getBoundingClientRect().height >= 60 ? "PASS" : "FAIL") + "\n";
+        }
+        document.getElementById("result").innerText = result;
+  
+        if (window.testRunner)
+          testRunner.dumpAsText();
+      }
+    </script>
+  </head>
+  <body _onload_="test()">
+
+    <p>This test passes if all the vertical bars stretch.</p>
+
+    <p>
+      <math><mrow><mo id="moMrow">|</mo><mspace width="1px" height="30px" depth="30px" mathbackground="red"></mspace></mrow></math>
+      <math><msqrt><mo id="moSqrt">|</mo><mspace width="1px" height="30px" depth="30px" mathbackground="red"></mspace></msqrt></math>
+      <math><mstyle><mo id="moStyle">|</mo><mspace width="1px" height="30px" depth="30px" mathbackground="red"></mspace></mstyle></math>
+      <math><merror><mo id="moError">|</mo><mspace width="1px" height="30px" depth="30px" mathbackground="red"></mspace></merror></math>
+      <math><mphantom><mo style="visibilty: visible;" id="moPhantom">|</mo><mspace width="1px" height="30px" depth="30px" mathbackground="red"></mspace></mphantom></math>
+      <math><mo id="moMath">|</mo><mspace width="1px" height="30px" depth="30px" mathbackground="red"></mspace></math>
+    </p>
+
+    <div id="result"></div>
+
+  </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (160710 => 160711)


--- trunk/Source/WebCore/ChangeLog	2013-12-17 17:40:07 UTC (rev 160710)
+++ trunk/Source/WebCore/ChangeLog	2013-12-17 17:56:21 UTC (rev 160711)
@@ -1,3 +1,22 @@
+2013-12-17  Frédéric Wang  <[email protected]>
+
+        Ensure inferred mrows for msqrt, mstyle, merror, mphantom and math.
+        https://bugs.webkit.org/show_bug.cgi?id=124841
+
+        Reviewed by Darin Adler.
+
+        Tests: mathml/presentation/inferred-mrow-baseline.html
+               mathml/presentation/inferred-mrow-stretchy.html
+
+        * css/mathml.css: make merror, mphantom and mstyle behave like an mrow.
+        (mo, mrow, mfenced, mfrac, msub, msup, msubsup, mmultiscripts, mprescripts, none, munder, mover, munderover, msqrt, mroot, merror, mphantom, mstyle):
+        (math, mrow, mfenced, msqrt, mroot, merror, mphantom, mstyle):
+        * mathml/MathMLInlineContainerElement.cpp: ditto
+        (WebCore::MathMLInlineContainerElement::createRenderer):
+        * mathml/mathtags.in: ditto
+        * rendering/mathml/RenderMathMLOperator.cpp:
+        (WebCore::RenderMathMLOperator::paint): fix failure in mathml/presentation/phantom.html now that phantom can stretch operators.
+
 2013-12-17  Simon Pena  <[email protected]>
 
         [NIX] Enable full debug builds by having ar creating thin archives

Modified: trunk/Source/WebCore/css/mathml.css (160710 => 160711)


--- trunk/Source/WebCore/css/mathml.css	2013-12-17 17:40:07 UTC (rev 160710)
+++ trunk/Source/WebCore/css/mathml.css	2013-12-17 17:56:21 UTC (rev 160711)
@@ -32,11 +32,11 @@
     -webkit-margin-after: 1em;
 }
 
-mo, mrow, mfenced, mfrac, msub, msup, msubsup, mmultiscripts, mprescripts, none, munder, mover, munderover, msqrt, mroot {
+mo, mrow, mfenced, mfrac, msub, msup, msubsup, mmultiscripts, mprescripts, none, munder, mover, munderover, msqrt, mroot, merror, mphantom, mstyle {
     display: -webkit-inline-flex !important;
 }
 
-math, mrow, mfenced, msqrt, mroot {
+math, mrow, mfenced, msqrt, mroot, merror, mphantom, mstyle {
     -webkit-align-items: baseline;
 }
 msqrt > * { /* This rule is needed because of <msqrt>'s anonymous <mrow>. */

Modified: trunk/Source/WebCore/mathml/MathMLInlineContainerElement.cpp (160710 => 160711)


--- trunk/Source/WebCore/mathml/MathMLInlineContainerElement.cpp	2013-12-17 17:40:07 UTC (rev 160710)
+++ trunk/Source/WebCore/mathml/MathMLInlineContainerElement.cpp	2013-12-17 17:56:21 UTC (rev 160711)
@@ -58,7 +58,7 @@
 {
     if (hasLocalName(annotation_xmlTag))
         return new RenderMathMLRow(*this, std::move(style));
-    if (hasLocalName(mrowTag))
+    if (hasLocalName(merrorTag) || hasLocalName(mphantomTag) || hasLocalName(mrowTag) || hasLocalName(mstyleTag))
         return new RenderMathMLRow(*this, std::move(style));
     if (hasLocalName(msubTag))
         return new RenderMathMLScripts(*this, std::move(style));

Modified: trunk/Source/WebCore/mathml/mathtags.in (160710 => 160711)


--- trunk/Source/WebCore/mathml/mathtags.in	2013-12-17 17:40:07 UTC (rev 160710)
+++ trunk/Source/WebCore/mathml/mathtags.in	2013-12-17 17:56:21 UTC (rev 160711)
@@ -10,8 +10,10 @@
 mfrac interfaceName=MathMLInlineContainerElement
 mfenced interfaceName=MathMLInlineContainerElement
 msubsup interfaceName=MathMLInlineContainerElement
+merror interfaceName=MathMLInlineContainerElement
+mphantom interfaceName=MathMLInlineContainerElement
 mrow interfaceName=MathMLInlineContainerElement
-mstyle interfaceName=MathMLElement
+mstyle interfaceName=MathMLInlineContainerElement
 mover interfaceName=MathMLInlineContainerElement
 munder interfaceName=MathMLInlineContainerElement
 munderover interfaceName=MathMLInlineContainerElement

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp (160710 => 160711)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp	2013-12-17 17:40:07 UTC (rev 160710)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp	2013-12-17 17:56:21 UTC (rev 160711)
@@ -360,7 +360,7 @@
 {
     RenderMathMLBlock::paint(info, paintOffset);
 
-    if (info.context->paintingDisabled() || info.phase != PaintPhaseForeground)
+    if (info.context->paintingDisabled() || info.phase != PaintPhaseForeground || style().visibility() != VISIBLE)
         return;
 
     if (!m_isStretched && !m_stretchyCharacter) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to