Title: [224910] trunk
Revision
224910
Author
fred.w...@free.fr
Date
2017-11-16 00:14:33 -0800 (Thu, 16 Nov 2017)

Log Message

ASSERTION FAILED: !isAnonymous() in WebCore::RenderMathMLOperator::updateTokenContent
https://bugs.webkit.org/show_bug.cgi?id=166011

Patch by Frederic Wang <fw...@igalia.com> on 2017-11-16
Reviewed by Alejandro G. Castro.

Source/WebCore:

RenderMathMLFencedOperator does not support mathvariant or displaystyle transforms. This is
one of several issues of the mfenced element (see bug 160509). However,
MathMLStyle::updateStyleIfNeeded() still tries to use the implementation of the parent
RenderMathMLOperator class, which only works for non-anonymous operators. This patch skips
the updateTokenContent() calls for anonymous mfenced operators in order to avoid ASSERTION
failures.

Test: mathml/mfenced-displaystyle-and-mathvariant-crash.html

* rendering/mathml/MathMLStyle.cpp:
(WebCore::MathMLStyle::updateStyleIfNeeded): Skip anonymous token elements.

LayoutTests:

Add a crash test checking displaystyle and mathvariant on mfenced operators.

* mathml/mfenced-displaystyle-and-mathvariant-crash-expected.txt: Added.
* mathml/mfenced-displaystyle-and-mathvariant-crash.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (224909 => 224910)


--- trunk/LayoutTests/ChangeLog	2017-11-16 03:05:02 UTC (rev 224909)
+++ trunk/LayoutTests/ChangeLog	2017-11-16 08:14:33 UTC (rev 224910)
@@ -1,3 +1,15 @@
+2017-11-16  Frederic Wang  <fw...@igalia.com>
+
+        ASSERTION FAILED: !isAnonymous() in WebCore::RenderMathMLOperator::updateTokenContent
+        https://bugs.webkit.org/show_bug.cgi?id=166011
+
+        Reviewed by Alejandro G. Castro.
+
+        Add a crash test checking displaystyle and mathvariant on mfenced operators.
+
+        * mathml/mfenced-displaystyle-and-mathvariant-crash-expected.txt: Added.
+        * mathml/mfenced-displaystyle-and-mathvariant-crash.html: Added.
+
 2017-11-15  Youenn Fablet  <you...@apple.com>
 
         Service Worker fetch should handle empty responses

Added: trunk/LayoutTests/mathml/mfenced-displaystyle-and-mathvariant-crash-expected.txt (0 => 224910)


--- trunk/LayoutTests/mathml/mfenced-displaystyle-and-mathvariant-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/mathml/mfenced-displaystyle-and-mathvariant-crash-expected.txt	2017-11-16 08:14:33 UTC (rev 224910)
@@ -0,0 +1,10 @@
+This test passes if it does not crash
+
+0
+1
+2
+ 
+0
+1
+2
+
Property changes on: trunk/LayoutTests/mathml/mfenced-displaystyle-and-mathvariant-crash-expected.txt
___________________________________________________________________

Added: svn:eol-style

+LF \ No newline at end of property

Added: trunk/LayoutTests/mathml/mfenced-displaystyle-and-mathvariant-crash.html (0 => 224910)


--- trunk/LayoutTests/mathml/mfenced-displaystyle-and-mathvariant-crash.html	                        (rev 0)
+++ trunk/LayoutTests/mathml/mfenced-displaystyle-and-mathvariant-crash.html	2017-11-16 08:14:33 UTC (rev 224910)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>displaystyle/mathvariant on anonymous mfenced operators</title>
+    <meta charset="utf-8"/>
+    <script>
+        if (window.testRunner)
+            testRunner.dumpAsText();
+    </script>
+  </head>
+  <body>
+
+    <p>This test passes if it does not crash</p>
+
+    <math mathvariant="fraktur">
+      <mfenced open="A" separators="B" close="C">
+        <mn>0</mn>
+        <mn>1</mn>
+        <mn>2</mn>
+      </mfenced>
+    </math>
+
+    <math displaystyle="true">
+      <mfenced open="∑" separators="∫" close="∏">
+        <mn>0</mn>
+        <mn>1</mn>
+        <mn>2</mn>
+      </mfenced>
+    </math>
+
+  </body>
+</html>
Property changes on: trunk/LayoutTests/mathml/mfenced-displaystyle-and-mathvariant-crash.html
___________________________________________________________________

Added: svn:eol-style

+LF \ No newline at end of property

Added: svn:mime-type

+text/html \ No newline at end of property

Modified: trunk/Source/WebCore/ChangeLog (224909 => 224910)


--- trunk/Source/WebCore/ChangeLog	2017-11-16 03:05:02 UTC (rev 224909)
+++ trunk/Source/WebCore/ChangeLog	2017-11-16 08:14:33 UTC (rev 224910)
@@ -1,3 +1,22 @@
+2017-11-16  Frederic Wang  <fw...@igalia.com>
+
+        ASSERTION FAILED: !isAnonymous() in WebCore::RenderMathMLOperator::updateTokenContent
+        https://bugs.webkit.org/show_bug.cgi?id=166011
+
+        Reviewed by Alejandro G. Castro.
+
+        RenderMathMLFencedOperator does not support mathvariant or displaystyle transforms. This is
+        one of several issues of the mfenced element (see bug 160509). However,
+        MathMLStyle::updateStyleIfNeeded() still tries to use the implementation of the parent
+        RenderMathMLOperator class, which only works for non-anonymous operators. This patch skips
+        the updateTokenContent() calls for anonymous mfenced operators in order to avoid ASSERTION
+        failures.
+
+        Test: mathml/mfenced-displaystyle-and-mathvariant-crash.html
+
+        * rendering/mathml/MathMLStyle.cpp:
+        (WebCore::MathMLStyle::updateStyleIfNeeded): Skip anonymous token elements.
+
 2017-11-15  Brady Eidson  <beid...@apple.com>
 
         Implement basics of "Terminate Service Worker" algorithm.

Modified: trunk/Source/WebCore/rendering/mathml/MathMLStyle.cpp (224909 => 224910)


--- trunk/Source/WebCore/rendering/mathml/MathMLStyle.cpp	2017-11-16 03:05:02 UTC (rev 224909)
+++ trunk/Source/WebCore/rendering/mathml/MathMLStyle.cpp	2017-11-16 08:14:33 UTC (rev 224910)
@@ -80,15 +80,19 @@
 
 void MathMLStyle::updateStyleIfNeeded(RenderObject* renderer, bool oldDisplayStyle, MathMLElement::MathVariant oldMathVariant)
 {
+    // RenderMathMLFencedOperator does not support mathvariant or displaystyle transforms.
+    // See https://bugs.webkit.org/show_bug.cgi?id=160509#c1.
+    bool isNonAnonymousTokenElement = is<RenderMathMLToken>(renderer) && !renderer->isAnonymous();
+
     if (oldDisplayStyle != m_displayStyle) {
         renderer->setNeedsLayoutAndPrefWidthsRecalc();
-        if (is<RenderMathMLToken>(renderer))
+        if (isNonAnonymousTokenElement)
             downcast<RenderMathMLToken>(renderer)->updateTokenContent();
         else if (is<RenderMathMLFraction>(renderer))
             downcast<RenderMathMLFraction>(renderer)->updateFromElement();
     }
     if (oldMathVariant != m_mathVariant) {
-        if (is<RenderMathMLToken>(renderer))
+        if (isNonAnonymousTokenElement)
             downcast<RenderMathMLToken>(renderer)->updateTokenContent();
     }
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to