Title: [204715] trunk/Source/WebCore
Revision
204715
Author
fred.w...@free.fr
Date
2016-08-22 08:18:10 -0700 (Mon, 22 Aug 2016)

Log Message

Rename MathMLTextElement to MathMLTokenElement
https://bugs.webkit.org/show_bug.cgi?id=160542

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

No new tests, behavior is unchanged.

* CMakeLists.txt: Rename MathMLTextElement to MathMLTokenElement.
* WebCore.xcodeproj/project.pbxproj: Ditto.
* mathml/MathMLAllInOne.cpp: Ditto.
* mathml/MathMLOperatorElement.cpp: Ditto.
* mathml/MathMLOperatorElement.h: Ditto.
* mathml/MathMLTokenElement.cpp: Ditto. Also remove dead code in childShouldCreateRenderer
to handle the case of mspace since that element uses its own class and forbids child creation
in RenderMathMLSpace::isChildAllowed.
* mathml/MathMLTokenElement.h: Rename MathMLTextElement to MathMLTokenElement.
* mathml/mathtags.in: Ditto.
* rendering/mathml/RenderMathMLToken.cpp: Move inclusion of MathMLTokenElement.h and
implementation of element() here.
* rendering/mathml/RenderMathMLToken.h: Do not implement element() in the header so that
we only need need to predeclare MathMLTokenElement instead of including its header.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (204714 => 204715)


--- trunk/Source/WebCore/CMakeLists.txt	2016-08-22 14:12:10 UTC (rev 204714)
+++ trunk/Source/WebCore/CMakeLists.txt	2016-08-22 15:18:10 UTC (rev 204715)
@@ -2014,7 +2014,7 @@
     mathml/MathMLScriptsElement.cpp
     mathml/MathMLSelectElement.cpp
     mathml/MathMLSpaceElement.cpp
-    mathml/MathMLTextElement.cpp
+    mathml/MathMLTokenElement.cpp
     mathml/MathMLUnderOverElement.cpp
 
     page/AutoscrollController.cpp

Modified: trunk/Source/WebCore/ChangeLog (204714 => 204715)


--- trunk/Source/WebCore/ChangeLog	2016-08-22 14:12:10 UTC (rev 204714)
+++ trunk/Source/WebCore/ChangeLog	2016-08-22 15:18:10 UTC (rev 204715)
@@ -1,3 +1,27 @@
+2016-08-22  Frederic Wang  <fw...@igalia.com>
+
+        Rename MathMLTextElement to MathMLTokenElement
+        https://bugs.webkit.org/show_bug.cgi?id=160542
+
+        Reviewed by Darin Adler.
+
+        No new tests, behavior is unchanged.
+
+        * CMakeLists.txt: Rename MathMLTextElement to MathMLTokenElement.
+        * WebCore.xcodeproj/project.pbxproj: Ditto.
+        * mathml/MathMLAllInOne.cpp: Ditto.
+        * mathml/MathMLOperatorElement.cpp: Ditto.
+        * mathml/MathMLOperatorElement.h: Ditto.
+        * mathml/MathMLTokenElement.cpp: Ditto. Also remove dead code in childShouldCreateRenderer
+        to handle the case of mspace since that element uses its own class and forbids child creation
+        in RenderMathMLSpace::isChildAllowed.
+        * mathml/MathMLTokenElement.h: Rename MathMLTextElement to MathMLTokenElement.
+        * mathml/mathtags.in: Ditto.
+        * rendering/mathml/RenderMathMLToken.cpp: Move inclusion of MathMLTokenElement.h and
+        implementation of element() here.
+        * rendering/mathml/RenderMathMLToken.h: Do not implement element() in the header so that
+        we only need need to predeclare MathMLTokenElement instead of including its header.
+
 2016-08-21  Alex Christensen  <achristen...@webkit.org>
 
         Use Document& instead of Document* when getting cookies

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (204714 => 204715)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2016-08-22 14:12:10 UTC (rev 204714)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2016-08-22 15:18:10 UTC (rev 204715)
@@ -6709,10 +6709,10 @@
 		F98FFF4411A2676200F548E8 /* CSSOMUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F98FFF4211A2676200F548E8 /* CSSOMUtils.cpp */; };
 		F98FFF4511A2676200F548E8 /* CSSOMUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = F98FFF4311A2676200F548E8 /* CSSOMUtils.h */; };
 		F9F0ED7A0DB50CA200D16DB9 /* XMLHttpRequestProgressEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = F9F0ED770DB50CA200D16DB9 /* XMLHttpRequestProgressEvent.h */; };
-		FA654A6B1108ABED002615E0 /* MathMLTextElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA654A691108ABED002615E0 /* MathMLTextElement.cpp */; };
+		FA654A6B1108ABED002615E0 /* MathMLTokenElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA654A691108ABED002615E0 /* MathMLTokenElement.cpp */; };
 		FA654A6B1108ABED002616F1 /* MathMLOperatorElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA654A691108ABED002616F1 /* MathMLOperatorElement.cpp */; };
 		FA654A6B1108ABED002626F1 /* MathMLUnderOverElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA654A691108ABED002626F1 /* MathMLUnderOverElement.cpp */; };
-		FA654A6C1108ABED002615E0 /* MathMLTextElement.h in Headers */ = {isa = PBXBuildFile; fileRef = FA654A6A1108ABED002615E0 /* MathMLTextElement.h */; };
+		FA654A6C1108ABED002615E0 /* MathMLTokenElement.h in Headers */ = {isa = PBXBuildFile; fileRef = FA654A6A1108ABED002615E0 /* MathMLTokenElement.h */; };
 		FA654A6C1108ABED002616F1 /* MathMLOperatorElement.h in Headers */ = {isa = PBXBuildFile; fileRef = FA654A6A1108ABED002616F1 /* MathMLOperatorElement.h */; };
 		FA654A6C1108ABED002626F1 /* MathMLUnderOverElement.h in Headers */ = {isa = PBXBuildFile; fileRef = FA654A6A1108ABED002626F1 /* MathMLUnderOverElement.h */; };
 		FABE72F41059C1EB00D888CC /* MathMLAnnotationElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FABE72ED1059C1EB00D888CC /* MathMLAnnotationElement.cpp */; };
@@ -14687,10 +14687,10 @@
 		F9F0ED780DB50CA200D16DB9 /* XMLHttpRequestProgressEvent.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = XMLHttpRequestProgressEvent.idl; sourceTree = "<group>"; };
 		FA654A631108ABB7002615E0 /* mathml.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = mathml.css; sourceTree = "<group>"; };
 		FA654A671108ABE2002615E0 /* mathattrs.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = mathattrs.in; sourceTree = "<group>"; };
-		FA654A691108ABED002615E0 /* MathMLTextElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLTextElement.cpp; sourceTree = "<group>"; };
+		FA654A691108ABED002615E0 /* MathMLTokenElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLTokenElement.cpp; sourceTree = "<group>"; };
 		FA654A691108ABED002616F1 /* MathMLOperatorElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLOperatorElement.cpp; sourceTree = "<group>"; };
 		FA654A691108ABED002626F1 /* MathMLUnderOverElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLUnderOverElement.cpp; sourceTree = "<group>"; };
-		FA654A6A1108ABED002615E0 /* MathMLTextElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathMLTextElement.h; sourceTree = "<group>"; };
+		FA654A6A1108ABED002615E0 /* MathMLTokenElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathMLTokenElement.h; sourceTree = "<group>"; };
 		FA654A6A1108ABED002616F1 /* MathMLOperatorElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathMLOperatorElement.h; sourceTree = "<group>"; };
 		FA654A6A1108ABED002626F1 /* MathMLUnderOverElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathMLUnderOverElement.h; sourceTree = "<group>"; };
 		FA6E466FCD0418A9966A5B60 /* DNSResolveQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DNSResolveQueue.h; sourceTree = "<group>"; };
@@ -24372,8 +24372,8 @@
 				59780849D41E6F65D81198BC /* MathMLSelectElement.h */,
 				4FA65A691108ABED002615E0 /* MathMLSpaceElement.cpp */,
 				4FA65A6A1108ABED002615E0 /* MathMLSpaceElement.h */,
-				FA654A691108ABED002615E0 /* MathMLTextElement.cpp */,
-				FA654A6A1108ABED002615E0 /* MathMLTextElement.h */,
+				FA654A691108ABED002615E0 /* MathMLTokenElement.cpp */,
+				FA654A6A1108ABED002615E0 /* MathMLTokenElement.h */,
 				FA654A691108ABED002626F1 /* MathMLUnderOverElement.cpp */,
 				FA654A6A1108ABED002626F1 /* MathMLUnderOverElement.h */,
 				FABE72F31059C1EB00D999DD /* mathtags.in */,
@@ -26807,7 +26807,7 @@
 				FA654A6C1108ABED002616F1 /* MathMLOperatorElement.h in Headers */,
 				4FA65A6C1108ABED002615E0 /* MathMLSpaceElement.h in Headers */,
 				439176E012DA25E17BAF80A2 /* MathMLStyle.h in Headers */,
-				FA654A6C1108ABED002615E0 /* MathMLTextElement.h in Headers */,
+				FA654A6C1108ABED002615E0 /* MathMLTokenElement.h in Headers */,
 				FA654A6C1108ABED002626F1 /* MathMLUnderOverElement.h in Headers */,
 				439046EA12DA25E812AF80AC /* MathOperator.h in Headers */,
 				49D5DC2C0F423A73008F20FD /* Matrix3DTransformOperation.h in Headers */,
@@ -30620,7 +30620,7 @@
 				FED48390CED66C3255F72C59 /* MathMLSelectElement.cpp in Sources */,
 				4FA65A6B1108ABED002615E0 /* MathMLSpaceElement.cpp in Sources */,
 				439176DF12DA25E17BAF80A2 /* MathMLStyle.cpp in Sources */,
-				FA654A6B1108ABED002615E0 /* MathMLTextElement.cpp in Sources */,
+				FA654A6B1108ABED002615E0 /* MathMLTokenElement.cpp in Sources */,
 				FA654A6B1108ABED002626F1 /* MathMLUnderOverElement.cpp in Sources */,
 				439046E912DA25E812AF80AC /* MathOperator.cpp in Sources */,
 				49D5DC2B0F423A73008F20FD /* Matrix3DTransformOperation.cpp in Sources */,

Modified: trunk/Source/WebCore/mathml/MathMLAllInOne.cpp (204714 => 204715)


--- trunk/Source/WebCore/mathml/MathMLAllInOne.cpp	2016-08-22 14:12:10 UTC (rev 204714)
+++ trunk/Source/WebCore/mathml/MathMLAllInOne.cpp	2016-08-22 15:18:10 UTC (rev 204715)
@@ -36,6 +36,6 @@
 #include "MathMLPaddedElement.cpp"
 #include "MathMLScriptsElement.cpp"
 #include "MathMLSelectElement.cpp"
-#include "MathMLTextElement.cpp"
+#include "MathMLTokenElement.cpp"
 #include "MathMLUnderOverElement.cpp"
 

Modified: trunk/Source/WebCore/mathml/MathMLOperatorElement.cpp (204714 => 204715)


--- trunk/Source/WebCore/mathml/MathMLOperatorElement.cpp	2016-08-22 14:12:10 UTC (rev 204714)
+++ trunk/Source/WebCore/mathml/MathMLOperatorElement.cpp	2016-08-22 15:18:10 UTC (rev 204715)
@@ -38,7 +38,7 @@
 using namespace MathMLOperatorDictionary;
 
 MathMLOperatorElement::MathMLOperatorElement(const QualifiedName& tagName, Document& document)
-    : MathMLTextElement(tagName, document)
+    : MathMLTokenElement(tagName, document)
 {
 }
 
@@ -219,7 +219,7 @@
     m_operatorChar = Nullopt;
     m_dictionaryProperty = Nullopt;
     m_properties.dirtyFlags = MathMLOperatorDictionary::allFlags;
-    MathMLTextElement::childrenChanged(change);
+    MathMLTokenElement::childrenChanged(change);
 }
 
 static Optional<MathMLOperatorDictionary::Flag> attributeNameToPropertyFlag(const QualifiedName& name)
@@ -262,7 +262,7 @@
         return;
     }
 
-    MathMLTextElement::parseAttribute(name, value);
+    MathMLTokenElement::parseAttribute(name, value);
 }
 
 RenderPtr<RenderElement> MathMLOperatorElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&)

Modified: trunk/Source/WebCore/mathml/MathMLOperatorElement.h (204714 => 204715)


--- trunk/Source/WebCore/mathml/MathMLOperatorElement.h	2016-08-22 14:12:10 UTC (rev 204714)
+++ trunk/Source/WebCore/mathml/MathMLOperatorElement.h	2016-08-22 15:18:10 UTC (rev 204715)
@@ -27,11 +27,11 @@
 
 #if ENABLE(MATHML)
 #include "MathMLOperatorDictionary.h"
-#include "MathMLTextElement.h"
+#include "MathMLTokenElement.h"
 
 namespace WebCore {
 
-class MathMLOperatorElement final : public MathMLTextElement {
+class MathMLOperatorElement final : public MathMLTokenElement {
 public:
     static Ref<MathMLOperatorElement> create(const QualifiedName& tagName, Document&);
     struct OperatorChar {

Deleted: trunk/Source/WebCore/mathml/MathMLTextElement.cpp (204714 => 204715)


--- trunk/Source/WebCore/mathml/MathMLTextElement.cpp	2016-08-22 14:12:10 UTC (rev 204714)
+++ trunk/Source/WebCore/mathml/MathMLTextElement.cpp	2016-08-22 15:18:10 UTC (rev 204715)
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2009 Alex Milowski (a...@milowski.com). All rights reserved.
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(MATHML)
-
-#include "MathMLTextElement.h"
-
-#include "MathMLNames.h"
-#include "RenderMathMLToken.h"
-
-namespace WebCore {
-
-using namespace MathMLNames;
-
-MathMLTextElement::MathMLTextElement(const QualifiedName& tagName, Document& document)
-    : MathMLElement(tagName, document)
-{
-    setHasCustomStyleResolveCallbacks();
-}
-
-Ref<MathMLTextElement> MathMLTextElement::create(const QualifiedName& tagName, Document& document)
-{
-    return adoptRef(*new MathMLTextElement(tagName, document));
-}
-
-void MathMLTextElement::didAttachRenderers()
-{
-    MathMLElement::didAttachRenderers();
-    if (is<RenderMathMLToken>(renderer()))
-        downcast<RenderMathMLToken>(*renderer()).updateTokenContent();
-}
-
-void MathMLTextElement::childrenChanged(const ChildChange& change)
-{
-    MathMLElement::childrenChanged(change);
-    if (is<RenderMathMLToken>(renderer()))
-        downcast<RenderMathMLToken>(*renderer()).updateTokenContent();
-}
-
-void MathMLTextElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
-{
-    if (name == mathvariantAttr) {
-        m_mathVariant = Nullopt;
-        if (renderer())
-            MathMLStyle::resolveMathMLStyleTree(renderer());
-    }
-
-    MathMLElement::parseAttribute(name, value);
-}
-
-RenderPtr<RenderElement> MathMLTextElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&)
-{
-    ASSERT(hasTagName(MathMLNames::miTag) || hasTagName(MathMLNames::mnTag) || hasTagName(MathMLNames::msTag) || hasTagName(MathMLNames::mtextTag));
-
-    return createRenderer<RenderMathMLToken>(*this, WTFMove(style));
-}
-
-bool MathMLTextElement::childShouldCreateRenderer(const Node& child) const
-{
-    if (hasTagName(MathMLNames::mspaceTag))
-        return false;
-
-    // The HTML specification defines <mi>, <mo>, <mn>, <ms> and <mtext> as insertion points.
-    return isPhrasingContent(child) && StyledElement::childShouldCreateRenderer(child);
-}
-
-}
-
-#endif // ENABLE(MATHML)

Deleted: trunk/Source/WebCore/mathml/MathMLTextElement.h (204714 => 204715)


--- trunk/Source/WebCore/mathml/MathMLTextElement.h	2016-08-22 14:12:10 UTC (rev 204714)
+++ trunk/Source/WebCore/mathml/MathMLTextElement.h	2016-08-22 15:18:10 UTC (rev 204715)
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2009 Alex Milowski (a...@milowski.com). All rights reserved.
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- * Copyright (C) 2016 Igalia S.L.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#if ENABLE(MATHML)
-#include "MathMLElement.h"
-
-namespace WebCore {
-
-class MathMLTextElement : public MathMLElement {
-public:
-    static Ref<MathMLTextElement> create(const QualifiedName& tagName, Document&);
-    bool acceptsMathVariantAttribute() final { return true; }
-
-protected:
-    MathMLTextElement(const QualifiedName& tagName, Document&);
-    void childrenChanged(const ChildChange&) override;
-    void parseAttribute(const QualifiedName&, const AtomicString&) override;
-
-private:
-    RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override;
-    bool childShouldCreateRenderer(const Node&) const final;
-
-    void didAttachRenderers() final;
-
-    bool isMathMLToken() const final { return true; }
-    bool isPresentationMathML() const final { return true; }
-};
-
-}
-
-#endif // ENABLE(MATHML)

Copied: trunk/Source/WebCore/mathml/MathMLTokenElement.cpp (from rev 204714, trunk/Source/WebCore/mathml/MathMLTextElement.cpp) (0 => 204715)


--- trunk/Source/WebCore/mathml/MathMLTokenElement.cpp	                        (rev 0)
+++ trunk/Source/WebCore/mathml/MathMLTokenElement.cpp	2016-08-22 15:18:10 UTC (rev 204715)
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2009 Alex Milowski (a...@milowski.com). All rights reserved.
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2016 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(MATHML)
+#include "MathMLTokenElement.h"
+
+#include "MathMLNames.h"
+#include "RenderMathMLToken.h"
+
+namespace WebCore {
+
+using namespace MathMLNames;
+
+MathMLTokenElement::MathMLTokenElement(const QualifiedName& tagName, Document& document)
+    : MathMLElement(tagName, document)
+{
+    setHasCustomStyleResolveCallbacks();
+}
+
+Ref<MathMLTokenElement> MathMLTokenElement::create(const QualifiedName& tagName, Document& document)
+{
+    return adoptRef(*new MathMLTokenElement(tagName, document));
+}
+
+void MathMLTokenElement::didAttachRenderers()
+{
+    MathMLElement::didAttachRenderers();
+    auto* mathmlRenderer = renderer();
+    if (is<RenderMathMLToken>(mathmlRenderer))
+        downcast<RenderMathMLToken>(*mathmlRenderer).updateTokenContent();
+}
+
+void MathMLTokenElement::childrenChanged(const ChildChange& change)
+{
+    MathMLElement::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));
+
+    return createRenderer<RenderMathMLToken>(*this, WTFMove(style));
+}
+
+bool MathMLTokenElement::childShouldCreateRenderer(const Node& child) const
+{
+    // The HTML specification defines <mi>, <mo>, <mn>, <ms> and <mtext> as insertion points.
+    return isPhrasingContent(child) && StyledElement::childShouldCreateRenderer(child);
+}
+
+}
+
+#endif // ENABLE(MATHML)

Property changes: trunk/Source/WebCore/mathml/MathMLTokenElement.cpp


Added: svn:eol-style

+LF \ No newline at end of property

Copied: trunk/Source/WebCore/mathml/MathMLTokenElement.h (from rev 204714, trunk/Source/WebCore/mathml/MathMLTextElement.h) (0 => 204715)


--- trunk/Source/WebCore/mathml/MathMLTokenElement.h	                        (rev 0)
+++ trunk/Source/WebCore/mathml/MathMLTokenElement.h	2016-08-22 15:18:10 UTC (rev 204715)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2009 Alex Milowski (a...@milowski.com). All rights reserved.
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2016 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(MATHML)
+
+#include "MathMLElement.h"
+
+namespace WebCore {
+
+class MathMLTokenElement : public MathMLElement {
+public:
+    static Ref<MathMLTokenElement> create(const QualifiedName& tagName, Document&);
+
+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;
+    bool childShouldCreateRenderer(const Node&) const final;
+
+    void didAttachRenderers() final;
+
+    bool isMathMLToken() const final { return true; }
+    bool isPresentationMathML() const final { return true; }
+    bool acceptsMathVariantAttribute() final { return true; }
+};
+
+}
+
+#endif // ENABLE(MATHML)

Property changes: trunk/Source/WebCore/mathml/MathMLTokenElement.h


Added: svn:eol-style

+LF \ No newline at end of property

Modified: trunk/Source/WebCore/mathml/mathtags.in (204714 => 204715)


--- trunk/Source/WebCore/mathml/mathtags.in	2016-08-22 14:12:10 UTC (rev 204714)
+++ trunk/Source/WebCore/mathml/mathtags.in	2016-08-22 15:18:10 UTC (rev 204715)
@@ -20,11 +20,11 @@
 munderover interfaceName=MathMLUnderOverElement
 msqrt interfaceName=MathMLInlineContainerElement
 mroot interfaceName=MathMLInlineContainerElement
-mi interfaceName=MathMLTextElement
-mn interfaceName=MathMLTextElement
+mi interfaceName=MathMLTokenElement
+mn interfaceName=MathMLTokenElement
 mo interfaceName=MathMLOperatorElement
-mtext interfaceName=MathMLTextElement
-ms interfaceName=MathMLTextElement
+mtext interfaceName=MathMLTokenElement
+ms interfaceName=MathMLTokenElement
 mspace interfaceName=MathMLSpaceElement
 msub interfaceName=MathMLScriptsElement
 msup interfaceName=MathMLScriptsElement

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLToken.cpp (204714 => 204715)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLToken.cpp	2016-08-22 14:12:10 UTC (rev 204714)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLToken.cpp	2016-08-22 15:18:10 UTC (rev 204715)
@@ -31,6 +31,7 @@
 
 #include "MathMLElement.h"
 #include "MathMLNames.h"
+#include "MathMLTokenElement.h"
 #include "PaintInfo.h"
 #include "RenderElement.h"
 #include "RenderIterator.h"
@@ -53,6 +54,11 @@
 {
 }
 
+MathMLTokenElement& RenderMathMLToken::element()
+{
+    return static_cast<MathMLTokenElement&>(nodeForNonAnonymous());
+}
+
 void RenderMathMLToken::updateTokenContent()
 {
     RenderMathMLBlock::updateFromElement();

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLToken.h (204714 => 204715)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLToken.h	2016-08-22 14:12:10 UTC (rev 204714)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLToken.h	2016-08-22 15:18:10 UTC (rev 204715)
@@ -28,17 +28,18 @@
 
 #if ENABLE(MATHML)
 
-#include "MathMLTextElement.h"
 #include "RenderMathMLBlock.h"
 
 namespace WebCore {
 
+class MathMLTokenElement;
+
 class RenderMathMLToken : public RenderMathMLBlock {
 public:
     RenderMathMLToken(Element&, RenderStyle&&);
     RenderMathMLToken(Document&, RenderStyle&&);
 
-    MathMLTextElement& element() { return static_cast<MathMLTextElement&>(nodeForNonAnonymous()); }
+    MathMLTokenElement& element();
 
     virtual void updateTokenContent();
     void updateFromElement() override;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to