Title: [205133] trunk/Source/WebCore
Revision
205133
Author
commit-qu...@webkit.org
Date
2016-08-29 12:07:22 -0700 (Mon, 29 Aug 2016)

Log Message

Use MathMLPresentationElement for all MathML presentation tags
https://bugs.webkit.org/show_bug.cgi?id=161297

Patch by Frederic Wang <fw...@igalia.com> on 2016-08-29
Reviewed by Darin Adler.

Some tabular MathML elements as well as unsupported presentation MathML markup currently
create a generic MathMLElement instance. We make them instead use the
MathMLPresentationElement class since they are presentation MathML elements. This also
allows to make MathMLElement::isPresentationMathML always return false.

No new tests, already covered by existing tests.

* mathml/MathMLElement.cpp:
(WebCore::MathMLElement::isPresentationMathML): Deleted. Moved into the header file.
* mathml/MathMLElement.h:
(WebCore::MathMLElement::isPresentationMathML): Make this always return false now that all
presentation markup are handled by MathMLPresentationElement.
* mathml/MathMLPresentationElement.cpp:
(WebCore::MathMLPresentationElement::createElementRenderer): Make the fallback always call
MathMLElement::createElementRenderer. This preserves the behavior for the new elements
handled here and does not affect the old ones (table is handled above while all the others
are already handled in the derived class).
* mathml/mathtags.in: Use MathMLPresentationElement for all MathML presentation tags.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (205132 => 205133)


--- trunk/Source/WebCore/ChangeLog	2016-08-29 18:54:38 UTC (rev 205132)
+++ trunk/Source/WebCore/ChangeLog	2016-08-29 19:07:22 UTC (rev 205133)
@@ -1,3 +1,29 @@
+2016-08-29  Frederic Wang  <fw...@igalia.com>
+
+        Use MathMLPresentationElement for all MathML presentation tags
+        https://bugs.webkit.org/show_bug.cgi?id=161297
+
+        Reviewed by Darin Adler.
+
+        Some tabular MathML elements as well as unsupported presentation MathML markup currently
+        create a generic MathMLElement instance. We make them instead use the
+        MathMLPresentationElement class since they are presentation MathML elements. This also
+        allows to make MathMLElement::isPresentationMathML always return false.
+
+        No new tests, already covered by existing tests.
+
+        * mathml/MathMLElement.cpp:
+        (WebCore::MathMLElement::isPresentationMathML): Deleted. Moved into the header file.
+        * mathml/MathMLElement.h:
+        (WebCore::MathMLElement::isPresentationMathML): Make this always return false now that all
+        presentation markup are handled by MathMLPresentationElement.
+        * mathml/MathMLPresentationElement.cpp:
+        (WebCore::MathMLPresentationElement::createElementRenderer): Make the fallback always call
+        MathMLElement::createElementRenderer. This preserves the behavior for the new elements
+        handled here and does not affect the old ones (table is handled above while all the others
+        are already handled in the derived class).
+        * mathml/mathtags.in: Use MathMLPresentationElement for all MathML presentation tags.
+
 2016-08-29  Alex Christensen  <achristen...@webkit.org>
 
         API test URLParserTest.ParserFailures failing ASSERT_NOT_REACHED

Modified: trunk/Source/WebCore/mathml/MathMLElement.cpp (205132 => 205133)


--- trunk/Source/WebCore/mathml/MathMLElement.cpp	2016-08-29 18:54:38 UTC (rev 205132)
+++ trunk/Source/WebCore/mathml/MathMLElement.cpp	2016-08-29 19:07:22 UTC (rev 205133)
@@ -64,26 +64,6 @@
     return adoptRef(*new MathMLElement(tagName, document));
 }
 
-bool MathMLElement::isPresentationMathML() const
-{
-    return hasTagName(MathMLNames::mtrTag)
-        || hasTagName(MathMLNames::mtdTag)
-        || hasTagName(MathMLNames::maligngroupTag)
-        || hasTagName(MathMLNames::malignmarkTag)
-        || hasTagName(MathMLNames::mencloseTag)
-        || hasTagName(MathMLNames::mglyphTag)
-        || hasTagName(MathMLNames::mlabeledtrTag)
-        || hasTagName(MathMLNames::mlongdivTag)
-        || hasTagName(MathMLNames::mpaddedTag)
-        || hasTagName(MathMLNames::msTag)
-        || hasTagName(MathMLNames::mscarriesTag)
-        || hasTagName(MathMLNames::mscarryTag)
-        || hasTagName(MathMLNames::msgroupTag)
-        || hasTagName(MathMLNames::mslineTag)
-        || hasTagName(MathMLNames::msrowTag)
-        || hasTagName(MathMLNames::mstackTag);
-}
-
 bool MathMLElement::isPhrasingContent(const Node& node) const
 {
     // Phrasing content is described in the HTML 5 specification:

Modified: trunk/Source/WebCore/mathml/MathMLElement.h (205132 => 205133)


--- trunk/Source/WebCore/mathml/MathMLElement.h	2016-08-29 18:54:38 UTC (rev 205132)
+++ trunk/Source/WebCore/mathml/MathMLElement.h	2016-08-29 19:07:22 UTC (rev 205133)
@@ -44,7 +44,7 @@
 
     virtual bool isMathMLToken() const { return false; }
     virtual bool isSemanticAnnotation() const { return false; }
-    virtual bool isPresentationMathML() const;
+    virtual bool isPresentationMathML() const { return false; }
 
     bool hasTagName(const MathMLQualifiedName& name) const { return hasLocalName(name.localName()); }
 

Modified: trunk/Source/WebCore/mathml/MathMLPresentationElement.cpp (205132 => 205133)


--- trunk/Source/WebCore/mathml/MathMLPresentationElement.cpp	2016-08-29 18:54:38 UTC (rev 205132)
+++ trunk/Source/WebCore/mathml/MathMLPresentationElement.cpp	2016-08-29 19:07:22 UTC (rev 205133)
@@ -47,12 +47,12 @@
     return adoptRef(*new MathMLPresentationElement(tagName, document));
 }
 
-RenderPtr<RenderElement> MathMLPresentationElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&)
+RenderPtr<RenderElement> MathMLPresentationElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition& insertionPosition)
 {
     if (hasTagName(mtableTag))
         return createRenderer<RenderMathMLTable>(*this, WTFMove(style));
 
-    return createRenderer<RenderMathMLBlock>(*this, WTFMove(style));
+    return MathMLElement::createElementRenderer(WTFMove(style), insertionPosition);
 }
 
 bool MathMLPresentationElement::acceptsDisplayStyleAttribute()

Modified: trunk/Source/WebCore/mathml/mathtags.in (205132 => 205133)


--- trunk/Source/WebCore/mathml/mathtags.in	2016-08-29 18:54:38 UTC (rev 205132)
+++ trunk/Source/WebCore/mathml/mathtags.in	2016-08-29 19:07:22 UTC (rev 205133)
@@ -29,8 +29,8 @@
 msub interfaceName=MathMLScriptsElement
 msup interfaceName=MathMLScriptsElement
 mtable interfaceName=MathMLPresentationElement
-mtr interfaceName=MathMLElement
-mtd interfaceName=MathMLElement
+mtr interfaceName=MathMLPresentationElement
+mtd interfaceName=MathMLPresentationElement
 mmultiscripts interfaceName=MathMLScriptsElement
 mprescripts interfaceName=MathMLPresentationElement
 menclose interfaceName=MathMLMencloseElement
@@ -37,14 +37,14 @@
 none interfaceName=MathMLPresentationElement
 semantics interfaceName=MathMLSelectElement
 
-maligngroup interfaceName=MathMLElement
-malignmark interfaceName=MathMLElement
-mglyph interfaceName=MathMLElement
-mlabeledtr interfaceName=MathMLElement
-mlongdiv interfaceName=MathMLElement
-mscarries interfaceName=MathMLElement
-mscarry interfaceName=MathMLElement
-msgroup interfaceName=MathMLElement
-msline interfaceName=MathMLElement
-msrow interfaceName=MathMLElement
-mstack interfaceName=MathMLElement
+maligngroup interfaceName=MathMLPresentationElement
+malignmark interfaceName=MathMLPresentationElement
+mglyph interfaceName=MathMLPresentationElement
+mlabeledtr interfaceName=MathMLPresentationElement
+mlongdiv interfaceName=MathMLPresentationElement
+mscarries interfaceName=MathMLPresentationElement
+mscarry interfaceName=MathMLPresentationElement
+msgroup interfaceName=MathMLPresentationElement
+msline interfaceName=MathMLPresentationElement
+msrow interfaceName=MathMLPresentationElement
+mstack interfaceName=MathMLPresentationElement
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to