Diff
Modified: trunk/Source/WebCore/CMakeLists.txt (203687 => 203688)
--- trunk/Source/WebCore/CMakeLists.txt 2016-07-25 16:57:28 UTC (rev 203687)
+++ trunk/Source/WebCore/CMakeLists.txt 2016-07-25 17:13:04 UTC (rev 203688)
@@ -1989,6 +1989,7 @@
mathml/MathMLMathElement.cpp
mathml/MathMLMencloseElement.cpp
mathml/MathMLOperatorDictionary.cpp
+ mathml/MathMLOperatorElement.cpp
mathml/MathMLPaddedElement.cpp
mathml/MathMLScriptsElement.cpp
mathml/MathMLSelectElement.cpp
Modified: trunk/Source/WebCore/ChangeLog (203687 => 203688)
--- trunk/Source/WebCore/ChangeLog 2016-07-25 16:57:28 UTC (rev 203687)
+++ trunk/Source/WebCore/ChangeLog 2016-07-25 17:13:04 UTC (rev 203688)
@@ -1,3 +1,33 @@
+2016-07-25 Frederic Wang <fw...@igalia.com>
+
+ Introduce a MathMLOperatorElement class
+ https://bugs.webkit.org/show_bug.cgi?id=160034
+
+ Reviewed by Darin Adler.
+
+ No new tests, rendering is unchaned.
+
+ * CMakeLists.txt: Add MathMLOperatorElement to the build file.
+ * WebCore.xcodeproj/project.pbxproj: Ditto.
+ * mathml/MathMLAllInOne.cpp: Ditto.
+ * mathml/MathMLOperatorElement.cpp: New DOM class for <mo> element.
+ (WebCore::MathMLOperatorElement::MathMLOperatorElement):
+ (WebCore::MathMLOperatorElement::create):
+ (WebCore::MathMLOperatorElement::parseAttribute): Handle mo attributes.
+ (WebCore::MathMLOperatorElement::createElementRenderer): Create RenderMathMLOperator.
+ * mathml/MathMLOperatorElement.h: Declare a class deriving from MathMLTextElement.
+ * mathml/MathMLTextElement.cpp: Remove all the RenderMathMLOperator parts.
+ (WebCore::MathMLTextElement::MathMLTextElement): Remove inline keyword so that the class can
+ be overriden.
+ (WebCore::MathMLTextElement::parseAttribute): Remove code handled in MathMLOperatorElement.
+ (WebCore::MathMLTextElement::createElementRenderer): Ditto.
+ * mathml/MathMLTextElement.h: Make class and members overridable.
+ * mathml/mathtags.in: Map mo to MathMLOperatorElement.
+ * rendering/mathml/RenderMathMLOperator.cpp:
+ (WebCore::RenderMathMLOperator::RenderMathMLOperator): Make the constructor take a
+ MathMLOperatorElement.
+ * rendering/mathml/RenderMathMLOperator.h: Ditto.
+
2016-07-25 Darin Adler <da...@apple.com>
Speed up make process slightly by improving "list of files" idiom
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (203687 => 203688)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-07-25 16:57:28 UTC (rev 203687)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-07-25 17:13:04 UTC (rev 203688)
@@ -6905,6 +6905,8 @@
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 */; };
+ FA654A6B1108ABED002616F1 /* MathMLOperatorElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA654A691108ABED002616F1 /* MathMLOperatorElement.cpp */; };
+ FA654A6C1108ABED002616F1 /* MathMLOperatorElement.h in Headers */ = {isa = PBXBuildFile; fileRef = FA654A6A1108ABED002616F1 /* MathMLOperatorElement.h */; };
FA654A6B1108ABED002615E0 /* MathMLTextElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA654A691108ABED002615E0 /* MathMLTextElement.cpp */; };
FA654A6C1108ABED002615E0 /* MathMLTextElement.h in Headers */ = {isa = PBXBuildFile; fileRef = FA654A6A1108ABED002615E0 /* MathMLTextElement.h */; };
FA654A6B1108ABED002626F1 /* MathMLUnderOverElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA654A691108ABED002626F1 /* MathMLUnderOverElement.cpp */; };
@@ -15085,6 +15087,8 @@
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>"; };
+ FA654A691108ABED002616F1 /* MathMLOperatorElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLOperatorElement.cpp; sourceTree = "<group>"; };
+ FA654A6A1108ABED002616F1 /* MathMLOperatorElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathMLOperatorElement.h; sourceTree = "<group>"; };
FA654A691108ABED002615E0 /* MathMLTextElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLTextElement.cpp; sourceTree = "<group>"; };
FA654A6A1108ABED002615E0 /* MathMLTextElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathMLTextElement.h; sourceTree = "<group>"; };
FA654A691108ABED002626F1 /* MathMLUnderOverElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLUnderOverElement.cpp; sourceTree = "<group>"; };
@@ -24910,6 +24914,8 @@
59780849D41E6F65D81198BC /* MathMLSelectElement.h */,
4FA65A691108ABED002615E0 /* MathMLSpaceElement.cpp */,
4FA65A6A1108ABED002615E0 /* MathMLSpaceElement.h */,
+ FA654A691108ABED002616F1 /* MathMLOperatorElement.cpp */,
+ FA654A6A1108ABED002616F1 /* MathMLOperatorElement.h */,
FA654A691108ABED002615E0 /* MathMLTextElement.cpp */,
FA654A6A1108ABED002615E0 /* MathMLTextElement.h */,
FA654A691108ABED002626F1 /* MathMLUnderOverElement.cpp */,
@@ -27451,6 +27457,7 @@
44A28AAF12DFB8BF00AE923B /* MathMLNames.h in Headers */,
439176E012DA25E17BAF80A2 /* MathMLStyle.h in Headers */,
4FA65A6C1108ABED002615E0 /* MathMLSpaceElement.h in Headers */,
+ FA654A6C1108ABED002616F1 /* MathMLOperatorElement.h in Headers */,
FA654A6C1108ABED002615E0 /* MathMLTextElement.h in Headers */,
FA654A6C1108ABED002626F1 /* MathMLUnderOverElement.h in Headers */,
439046EA12DA25E812AF80AC /* MathOperator.h in Headers */,
@@ -31284,6 +31291,7 @@
B59CA390CED66C3255F72C59 /* MathMLPaddedElement.cpp in Sources */,
FED48390CED66C3255F72C59 /* MathMLSelectElement.cpp in Sources */,
4FA65A6B1108ABED002615E0 /* MathMLSpaceElement.cpp in Sources */,
+ FA654A6B1108ABED002616F1 /* MathMLOperatorElement.cpp in Sources */,
FA654A6B1108ABED002615E0 /* MathMLTextElement.cpp in Sources */,
FA654A6B1108ABED002626F1 /* MathMLUnderOverElement.cpp in Sources */,
439046E912DA25E812AF80AC /* MathOperator.cpp in Sources */,
Modified: trunk/Source/WebCore/mathml/MathMLAllInOne.cpp (203687 => 203688)
--- trunk/Source/WebCore/mathml/MathMLAllInOne.cpp 2016-07-25 16:57:28 UTC (rev 203687)
+++ trunk/Source/WebCore/mathml/MathMLAllInOne.cpp 2016-07-25 17:13:04 UTC (rev 203688)
@@ -31,6 +31,7 @@
#include "MathMLMathElement.cpp"
#include "MathMLMencloseElement.cpp"
#include "MathMLOperatorDictionary.cpp"
+#include "MathMLOperatorElement.cpp"
#include "MathMLPaddedElement.cpp"
#include "MathMLScriptsElement.cpp"
#include "MathMLSelectElement.cpp"
Copied: trunk/Source/WebCore/mathml/MathMLOperatorElement.cpp (from rev 203687, trunk/Source/WebCore/mathml/MathMLTextElement.h) (0 => 203688)
--- trunk/Source/WebCore/mathml/MathMLOperatorElement.cpp (rev 0)
+++ trunk/Source/WebCore/mathml/MathMLOperatorElement.cpp 2016-07-25 17:13:04 UTC (rev 203688)
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2016 Igalia S.L. 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 "MathMLOperatorElement.h"
+
+#include "RenderMathMLOperator.h"
+
+namespace WebCore {
+
+using namespace MathMLNames;
+
+MathMLOperatorElement::MathMLOperatorElement(const QualifiedName& tagName, Document& document)
+ : MathMLTextElement(tagName, document)
+{
+}
+
+Ref<MathMLOperatorElement> MathMLOperatorElement::create(const QualifiedName& tagName, Document& document)
+{
+ return adoptRef(*new MathMLOperatorElement(tagName, document));
+}
+
+void MathMLOperatorElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
+{
+ if ((name == stretchyAttr || name == lspaceAttr || name == rspaceAttr || name == movablelimitsAttr) && renderer()) {
+ downcast<RenderMathMLOperator>(*renderer()).updateFromElement();
+ return;
+ }
+
+ MathMLTextElement::parseAttribute(name, value);
+}
+
+RenderPtr<RenderElement> MathMLOperatorElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&)
+{
+ ASSERT(hasTagName(MathMLNames::moTag));
+ return createRenderer<RenderMathMLOperator>(*this, WTFMove(style));
+}
+
+}
+
+#endif // ENABLE(MATHML)
Copied: trunk/Source/WebCore/mathml/MathMLOperatorElement.h (from rev 203687, trunk/Source/WebCore/mathml/MathMLTextElement.h) (0 => 203688)
--- trunk/Source/WebCore/mathml/MathMLOperatorElement.h (rev 0)
+++ trunk/Source/WebCore/mathml/MathMLOperatorElement.h 2016-07-25 17:13:04 UTC (rev 203688)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2016 Igalia S.L. 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.
+ */
+
+#pragma once
+
+#if ENABLE(MATHML)
+#include "MathMLTextElement.h"
+
+namespace WebCore {
+
+class MathMLOperatorElement final : public MathMLTextElement {
+public:
+ static Ref<MathMLOperatorElement> create(const QualifiedName& tagName, Document&);
+private:
+ MathMLOperatorElement(const QualifiedName& tagName, Document&);
+ RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final;
+ void parseAttribute(const QualifiedName&, const AtomicString&) final;
+};
+
+}
+
+#endif // ENABLE(MATHML)
Modified: trunk/Source/WebCore/mathml/MathMLTextElement.cpp (203687 => 203688)
--- trunk/Source/WebCore/mathml/MathMLTextElement.cpp 2016-07-25 16:57:28 UTC (rev 203687)
+++ trunk/Source/WebCore/mathml/MathMLTextElement.cpp 2016-07-25 17:13:04 UTC (rev 203688)
@@ -31,7 +31,6 @@
#include "MathMLTextElement.h"
#include "MathMLNames.h"
-#include "RenderMathMLOperator.h"
#include "RenderMathMLToken.h"
namespace WebCore {
@@ -38,7 +37,7 @@
using namespace MathMLNames;
-inline MathMLTextElement::MathMLTextElement(const QualifiedName& tagName, Document& document)
+MathMLTextElement::MathMLTextElement(const QualifiedName& tagName, Document& document)
: MathMLElement(tagName, document)
{
setHasCustomStyleResolveCallbacks();
@@ -65,12 +64,6 @@
void MathMLTextElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
- if (name == stretchyAttr || name == lspaceAttr || name == rspaceAttr || name == movablelimitsAttr) {
- if (is<RenderMathMLOperator>(renderer()))
- downcast<RenderMathMLOperator>(*renderer()).updateFromElement();
- return;
- }
-
if (name == mathvariantAttr) {
m_mathVariant.dirty = true;
if (renderer())
@@ -82,8 +75,6 @@
RenderPtr<RenderElement> MathMLTextElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition& insertionPosition)
{
- if (hasTagName(MathMLNames::moTag))
- return createRenderer<RenderMathMLOperator>(*this, WTFMove(style));
if (hasTagName(MathMLNames::annotationTag))
return MathMLElement::createElementRenderer(WTFMove(style), insertionPosition);
Modified: trunk/Source/WebCore/mathml/MathMLTextElement.h (203687 => 203688)
--- trunk/Source/WebCore/mathml/MathMLTextElement.h 2016-07-25 16:57:28 UTC (rev 203687)
+++ trunk/Source/WebCore/mathml/MathMLTextElement.h 2016-07-25 17:13:04 UTC (rev 203688)
@@ -32,19 +32,20 @@
namespace WebCore {
-class MathMLTextElement final : public MathMLElement {
+class MathMLTextElement : public MathMLElement {
public:
static Ref<MathMLTextElement> create(const QualifiedName& tagName, Document&);
bool acceptsMathVariantAttribute() final { return true; }
-private:
+protected:
MathMLTextElement(const QualifiedName& tagName, Document&);
+ void parseAttribute(const QualifiedName&, const AtomicString&) override;
- RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final;
+private:
+ RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override;
bool childShouldCreateRenderer(const Node&) const final;
void childrenChanged(const ChildChange&) final;
- void parseAttribute(const QualifiedName&, const AtomicString&) final;
void didAttachRenderers() final;
bool isPresentationMathML() const final { return true; }
Modified: trunk/Source/WebCore/mathml/mathtags.in (203687 => 203688)
--- trunk/Source/WebCore/mathml/mathtags.in 2016-07-25 16:57:28 UTC (rev 203687)
+++ trunk/Source/WebCore/mathml/mathtags.in 2016-07-25 17:13:04 UTC (rev 203688)
@@ -22,7 +22,7 @@
mroot interfaceName=MathMLInlineContainerElement
mi interfaceName=MathMLTextElement
mn interfaceName=MathMLTextElement
-mo interfaceName=MathMLTextElement
+mo interfaceName=MathMLOperatorElement
mtext interfaceName=MathMLTextElement
ms interfaceName=MathMLTextElement
mspace interfaceName=MathMLSpaceElement
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp (203687 => 203688)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp 2016-07-25 16:57:28 UTC (rev 203687)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp 2016-07-25 17:13:04 UTC (rev 203688)
@@ -33,6 +33,7 @@
#include "FontSelector.h"
#include "MathMLNames.h"
+#include "MathMLOperatorElement.h"
#include "PaintInfo.h"
#include "RenderBlockFlow.h"
#include "RenderText.h"
@@ -46,7 +47,7 @@
using namespace MathMLNames;
-RenderMathMLOperator::RenderMathMLOperator(MathMLElement& element, RenderStyle&& style)
+RenderMathMLOperator::RenderMathMLOperator(MathMLOperatorElement& element, RenderStyle&& style)
: RenderMathMLToken(element, WTFMove(style))
, m_stretchHeightAboveBaseline(0)
, m_stretchDepthBelowBaseline(0)
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h (203687 => 203688)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h 2016-07-25 16:57:28 UTC (rev 203687)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h 2016-07-25 17:13:04 UTC (rev 203688)
@@ -34,9 +34,11 @@
namespace WebCore {
+class MathMLOperatorElement;
+
class RenderMathMLOperator final : public RenderMathMLToken {
public:
- RenderMathMLOperator(MathMLElement&, RenderStyle&&);
+ RenderMathMLOperator(MathMLOperatorElement&, RenderStyle&&);
RenderMathMLOperator(Document&, RenderStyle&&, const String& operatorString, MathMLOperatorDictionary::Form, unsigned short flags = 0);
void stretchTo(LayoutUnit heightAboveBaseline, LayoutUnit depthBelowBaseline);