Graphical elements inside mphantom should not be visible.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Jul 2013 17:12:15 +0000 (17:12 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Jul 2013 17:12:15 +0000 (17:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=116600.

Patch by Frédéric Wang <fred.wang@free.fr> on 2013-07-24
Reviewed by Chris Fleizach.

Source/WebCore:

Test: mathml/presentation/phantom.html

* rendering/mathml/RenderMathMLFraction.cpp:
(WebCore::RenderMathMLFraction::paint): don't paint the fraction bar when the visibility is not "visible"
* rendering/mathml/RenderMathMLRoot.cpp:
(WebCore::RenderMathMLRoot::paint): don't paint the radical symbol when the visibility is not "visible"

LayoutTests:

* mathml/presentation/phantom-expected.html: Added.
* mathml/presentation/phantom.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/mathml/presentation/phantom-expected.html [new file with mode: 0644]
LayoutTests/mathml/presentation/phantom.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp
Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp

index 9dc2167..7ed19a0 100644 (file)
@@ -1,3 +1,13 @@
+2013-07-24  Frédéric Wang  <fred.wang@free.fr>
+
+        Graphical elements inside mphantom should not be visible.
+        https://bugs.webkit.org/show_bug.cgi?id=116600.
+
+        Reviewed by Chris Fleizach.
+
+        * mathml/presentation/phantom-expected.html: Added.
+        * mathml/presentation/phantom.html: Added.
+
 2013-07-24  Simon Pena  <simon.pena@samsung.com>
 
         [GTK] Unreviewed gardening. Add expectations for flaky test.
diff --git a/LayoutTests/mathml/presentation/phantom-expected.html b/LayoutTests/mathml/presentation/phantom-expected.html
new file mode 100644 (file)
index 0000000..38745b9
--- /dev/null
@@ -0,0 +1,31 @@
+<!doctype html>
+<html>
+  <head>
+    <title>phantom</title>
+    <meta charset="utf-8"/>
+  </head>
+  <body style="background: white;">
+
+    <math>
+      <mfrac>
+        <mtext>mphantom</mtext>
+        <mrow>
+          <mo>[</mo>
+          <mphantom style="color: white;">
+            <mo>(</mo>
+            <mn>2</mn>
+            <mo>+</mo>
+            <msqrt>
+              <mfrac>
+                <mi>x</mi>
+                <mi>y</mi>
+              </mfrac>
+            </msqrt>
+          </mphantom>
+          <mo>]</mo>
+        </mrow>
+      </mfrac>
+    </math>
+
+</body>
+</html>
diff --git a/LayoutTests/mathml/presentation/phantom.html b/LayoutTests/mathml/presentation/phantom.html
new file mode 100644 (file)
index 0000000..60843c6
--- /dev/null
@@ -0,0 +1,33 @@
+<!doctype html>
+<html>
+  <head>
+    <title>phantom</title>
+    <meta charset="utf-8"/>
+  </head>
+  <body style="background: white;">
+
+    <!-- The <mphantom> element should be invisible but should have the size
+         of its content. -->
+    <math>
+      <mfrac>
+        <mtext>mphantom</mtext>
+        <mrow>
+          <mo>[</mo>
+          <mphantom>
+            <mo>(</mo>
+            <mn>2</mn>
+            <mo>+</mo>
+            <msqrt>
+              <mfrac>
+                <mi>x</mi>
+                <mi>y</mi>
+              </mfrac>
+            </msqrt>
+          </mphantom>
+          <mo>]</mo>
+        </mrow>
+      </mfrac>
+    </math>
+
+</body>
+</html>
index 9292aad..de0633b 100644 (file)
@@ -1,3 +1,17 @@
+2013-07-24  Frédéric Wang  <fred.wang@free.fr>
+
+        Graphical elements inside mphantom should not be visible.
+        https://bugs.webkit.org/show_bug.cgi?id=116600.
+
+        Reviewed by Chris Fleizach.
+
+        Test: mathml/presentation/phantom.html
+
+        * rendering/mathml/RenderMathMLFraction.cpp:
+        (WebCore::RenderMathMLFraction::paint): don't paint the fraction bar when the visibility is not "visible"
+        * rendering/mathml/RenderMathMLRoot.cpp:
+        (WebCore::RenderMathMLRoot::paint): don't paint the radical symbol when the visibility is not "visible"
+
 2013-07-24  Brendan Long  <b.long@cablelabs.com>
 
         WebVTTParser's identifier buffering can ignore subsequent lines
index efb2255..e5c92a6 100644 (file)
@@ -143,7 +143,7 @@ void RenderMathMLFraction::layout()
 void RenderMathMLFraction::paint(PaintInfo& info, const LayoutPoint& paintOffset)
 {
     RenderMathMLBlock::paint(info, paintOffset);
-    if (info.context->paintingDisabled() || info.phase != PaintPhaseForeground)
+    if (info.context->paintingDisabled() || info.phase != PaintPhaseForeground || style()->visibility() != VISIBLE)
         return;
     
     RenderBox* denominatorWrapper = lastChildBox();
index 7f72c7b..4918e86 100644 (file)
@@ -251,7 +251,7 @@ void RenderMathMLRoot::paint(PaintInfo& info, const LayoutPoint& paintOffset)
 {
     RenderMathMLBlock::paint(info, paintOffset);
     
-    if (info.context->paintingDisabled())
+    if (info.context->paintingDisabled() || style()->visibility() != VISIBLE)
         return;
     
     IntPoint adjustedPaintOffset = roundedIntPoint(paintOffset + location() + contentBoxRect().location());