Title: [205100] trunk/Source/WebCore
Revision
205100
Author
[email protected]
Date
2016-08-28 01:50:57 -0700 (Sun, 28 Aug 2016)

Log Message

Make MathMLSpaceElement and MathMLTokenElement inherit from MathMLPresentationElement
https://bugs.webkit.org/show_bug.cgi?id=161232

Patch by Frederic Wang <[email protected]> on 2016-08-28
Reviewed by Darin Adler.

The mrow-like features of MathMLPresentationElement are now moved into RenderMathMLRow.
Hence we make MathMLSpaceElement and MathMLTokenElement inherit from the generic class
MathMLPresentationElement for presentation MathML elements.

No new tests, already covered by existing tests.

* mathml/MathMLSpaceElement.cpp:
(WebCore::MathMLSpaceElement::MathMLSpaceElement): Derive from MathMLPresentationElement.
(WebCore::MathMLSpaceElement::parseAttribute): Ditto.
* mathml/MathMLSpaceElement.h: Ditto. Override acceptsDisplayStyleAttribute as a small
optimization. isPresentationMathML is no longer needed.
* mathml/MathMLTokenElement.cpp:
(WebCore::MathMLTokenElement::MathMLTokenElement): Derive from MathMLPresentationElement.
(WebCore::MathMLTokenElement::didAttachRenderers): Ditto.
(WebCore::MathMLTokenElement::childrenChanged): Ditto.
(WebCore::MathMLTokenElement::parseAttribute): Deleted. No need to override this function
any more since it's already implemented in MathMLPresentationElement.
* mathml/MathMLTokenElement.h: Derive from MathMLPresentationElement. Override
acceptsDisplayStyleAttribute as a small optimization. isPresentationMathML is no longer
needed.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (205099 => 205100)


--- trunk/Source/WebCore/ChangeLog	2016-08-28 08:41:13 UTC (rev 205099)
+++ trunk/Source/WebCore/ChangeLog	2016-08-28 08:50:57 UTC (rev 205100)
@@ -1,5 +1,33 @@
 2016-08-28  Frederic Wang  <[email protected]>
 
+        Make MathMLSpaceElement and MathMLTokenElement inherit from MathMLPresentationElement
+        https://bugs.webkit.org/show_bug.cgi?id=161232
+
+        Reviewed by Darin Adler.
+
+        The mrow-like features of MathMLPresentationElement are now moved into RenderMathMLRow.
+        Hence we make MathMLSpaceElement and MathMLTokenElement inherit from the generic class
+        MathMLPresentationElement for presentation MathML elements.
+
+        No new tests, already covered by existing tests.
+
+        * mathml/MathMLSpaceElement.cpp:
+        (WebCore::MathMLSpaceElement::MathMLSpaceElement): Derive from MathMLPresentationElement.
+        (WebCore::MathMLSpaceElement::parseAttribute): Ditto.
+        * mathml/MathMLSpaceElement.h: Ditto. Override acceptsDisplayStyleAttribute as a small
+        optimization. isPresentationMathML is no longer needed.
+        * mathml/MathMLTokenElement.cpp:
+        (WebCore::MathMLTokenElement::MathMLTokenElement): Derive from MathMLPresentationElement.
+        (WebCore::MathMLTokenElement::didAttachRenderers): Ditto.
+        (WebCore::MathMLTokenElement::childrenChanged): Ditto.
+        (WebCore::MathMLTokenElement::parseAttribute): Deleted. No need to override this function
+        any more since it's already implemented in MathMLPresentationElement.
+        * mathml/MathMLTokenElement.h: Derive from MathMLPresentationElement. Override
+        acceptsDisplayStyleAttribute as a small optimization. isPresentationMathML is no longer
+        needed.
+
+2016-08-28  Frederic Wang  <[email protected]>
+
         RenderMathMLRow::firstLineBaseline does not need to be overridden in RenderMathMLMenclose
         https://bugs.webkit.org/show_bug.cgi?id=161127
 

Modified: trunk/Source/WebCore/mathml/MathMLSpaceElement.cpp (205099 => 205100)


--- trunk/Source/WebCore/mathml/MathMLSpaceElement.cpp	2016-08-28 08:41:13 UTC (rev 205099)
+++ trunk/Source/WebCore/mathml/MathMLSpaceElement.cpp	2016-08-28 08:50:57 UTC (rev 205100)
@@ -36,7 +36,7 @@
 using namespace MathMLNames;
 
 MathMLSpaceElement::MathMLSpaceElement(const QualifiedName& tagName, Document& document)
-    : MathMLElement(tagName, document)
+    : MathMLPresentationElement(tagName, document)
 {
 }
 
@@ -69,7 +69,7 @@
     else if (name == depthAttr)
         m_depth = Nullopt;
 
-    MathMLElement::parseAttribute(name, value);
+    MathMLPresentationElement::parseAttribute(name, value);
 }
 
 RenderPtr<RenderElement> MathMLSpaceElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&)

Modified: trunk/Source/WebCore/mathml/MathMLSpaceElement.h (205099 => 205100)


--- trunk/Source/WebCore/mathml/MathMLSpaceElement.h	2016-08-28 08:41:13 UTC (rev 205099)
+++ trunk/Source/WebCore/mathml/MathMLSpaceElement.h	2016-08-28 08:50:57 UTC (rev 205100)
@@ -27,11 +27,11 @@
 
 #if ENABLE(MATHML)
 
-#include "MathMLElement.h"
+#include "MathMLPresentationElement.h"
 
 namespace WebCore {
 
-class MathMLSpaceElement final : public MathMLElement {
+class MathMLSpaceElement final : public MathMLPresentationElement {
 public:
     static Ref<MathMLSpaceElement> create(const QualifiedName& tagName, Document&);
     const Length& width();
@@ -39,10 +39,11 @@
     const Length& depth();
 private:
     MathMLSpaceElement(const QualifiedName& tagName, Document&);
-    bool isPresentationMathML() const final { return true; }
     RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final;
     void parseAttribute(const QualifiedName&, const AtomicString&) final;
 
+    bool acceptsDisplayStyleAttribute() final { return false; }
+
     Optional<Length> m_width;
     Optional<Length> m_height;
     Optional<Length> m_depth;

Modified: trunk/Source/WebCore/mathml/MathMLTokenElement.cpp (205099 => 205100)


--- trunk/Source/WebCore/mathml/MathMLTokenElement.cpp	2016-08-28 08:41:13 UTC (rev 205099)
+++ trunk/Source/WebCore/mathml/MathMLTokenElement.cpp	2016-08-28 08:50:57 UTC (rev 205100)
@@ -38,7 +38,7 @@
 using namespace MathMLNames;
 
 MathMLTokenElement::MathMLTokenElement(const QualifiedName& tagName, Document& document)
-    : MathMLElement(tagName, document)
+    : MathMLPresentationElement(tagName, document)
 {
     setHasCustomStyleResolveCallbacks();
 }
@@ -50,7 +50,7 @@
 
 void MathMLTokenElement::didAttachRenderers()
 {
-    MathMLElement::didAttachRenderers();
+    MathMLPresentationElement::didAttachRenderers();
     auto* mathmlRenderer = renderer();
     if (is<RenderMathMLToken>(mathmlRenderer))
         downcast<RenderMathMLToken>(*mathmlRenderer).updateTokenContent();
@@ -58,23 +58,12 @@
 
 void MathMLTokenElement::childrenChanged(const ChildChange& change)
 {
-    MathMLElement::childrenChanged(change);
+    MathMLPresentationElement::childrenChanged(change);
     auto* mathmlRenderer = renderer();
     if (is<RenderMathMLToken>(mathmlRenderer))
         downcast<RenderMathMLToken>(*mathmlRenderer).updateTokenContent();
 }
 
-void MathMLTokenElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
-{
-    if (name == mathvariantAttr) {
-        m_mathVariant = Nullopt;
-        if (renderer())
-            MathMLStyle::resolveMathMLStyleTree(renderer());
-    }
-
-    MathMLElement::parseAttribute(name, value);
-}
-
 RenderPtr<RenderElement> MathMLTokenElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&)
 {
     ASSERT(hasTagName(MathMLNames::miTag) || hasTagName(MathMLNames::mnTag) || hasTagName(MathMLNames::msTag) || hasTagName(MathMLNames::mtextTag));

Modified: trunk/Source/WebCore/mathml/MathMLTokenElement.h (205099 => 205100)


--- trunk/Source/WebCore/mathml/MathMLTokenElement.h	2016-08-28 08:41:13 UTC (rev 205099)
+++ trunk/Source/WebCore/mathml/MathMLTokenElement.h	2016-08-28 08:50:57 UTC (rev 205100)
@@ -29,11 +29,11 @@
 
 #if ENABLE(MATHML)
 
-#include "MathMLElement.h"
+#include "MathMLPresentationElement.h"
 
 namespace WebCore {
 
-class MathMLTokenElement : public MathMLElement {
+class MathMLTokenElement : public MathMLPresentationElement {
 public:
     static Ref<MathMLTokenElement> create(const QualifiedName& tagName, Document&);
 
@@ -42,7 +42,6 @@
 protected:
     MathMLTokenElement(const QualifiedName& tagName, Document&);
     void childrenChanged(const ChildChange&) override;
-    void parseAttribute(const QualifiedName&, const AtomicString&) override;
 
 private:
     RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override;
@@ -51,8 +50,8 @@
     void didAttachRenderers() final;
 
     bool isMathMLToken() const final { return true; }
-    bool isPresentationMathML() const final { return true; }
     bool acceptsMathVariantAttribute() final { return true; }
+    bool acceptsDisplayStyleAttribute() final { return false; }
 };
 
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to