Diff
Modified: trunk/Source/WebCore/CMakeLists.txt (204778 => 204779)
--- trunk/Source/WebCore/CMakeLists.txt 2016-08-23 08:23:31 UTC (rev 204778)
+++ trunk/Source/WebCore/CMakeLists.txt 2016-08-23 08:28:07 UTC (rev 204779)
@@ -2011,6 +2011,7 @@
mathml/MathMLOperatorDictionary.cpp
mathml/MathMLOperatorElement.cpp
mathml/MathMLPaddedElement.cpp
+ mathml/MathMLRowElement.cpp
mathml/MathMLScriptsElement.cpp
mathml/MathMLSelectElement.cpp
mathml/MathMLSpaceElement.cpp
Modified: trunk/Source/WebCore/ChangeLog (204778 => 204779)
--- trunk/Source/WebCore/ChangeLog 2016-08-23 08:23:31 UTC (rev 204778)
+++ trunk/Source/WebCore/ChangeLog 2016-08-23 08:28:07 UTC (rev 204779)
@@ -1,3 +1,58 @@
+2016-08-23 Frederic Wang <[email protected]>
+
+ Introduce a MathMLRowElement class for mrow-like elements
+ https://bugs.webkit.org/show_bug.cgi?id=161050
+
+ Reviewed by Darin Adler.
+
+ We introduce a MathMLRowElement class for elements creating RenderMathMLRow renderers.
+ We also force constructors of the corresponding renderer classes to accept MathMLRowElement.
+ It's not clear whether semantics-xml really needs to create RenderMathMLRow but for now
+ we make MathMLAnnotationElement inherits from MathMLRowElement to preserve that behavior.
+
+ No new tests, behavior is unchanged.
+
+ * CMakeLists.txt: Add MathMLRowElement files.
+ * WebCore.xcodeproj/project.pbxproj: Ditto.
+ * mathml/MathMLAllInOne.cpp: Ditto.
+ * mathml/MathMLInlineContainerElement.cpp: Remove unused headers.
+ (WebCore::MathMLInlineContainerElement::createElementRenderer): Handle some mrow-like
+ elements in the MathMLRowElement class.
+ (WebCore::MathMLInlineContainerElement::acceptsDisplayStyleAttribute): Ditto.
+ (WebCore::MathMLInlineContainerElement::childrenChanged): Deleted. We only need to calculate
+ the form for operators inside a MathMLRowElement.
+ (WebCore::MathMLInlineContainerElement::acceptsMathVariantAttribute): Deleted. mstyle is
+ handled in the MathMLRowElement class.
+ * mathml/MathMLInlineContainerElement.h: Update function declarations.
+ * mathml/MathMLMathElement.cpp: Make this class inherits from MathMLRowElement.
+ * mathml/MathMLMathElement.h: Ditto.
+ * mathml/MathMLPaddedElement.cpp: Ditto.
+ * mathml/MathMLPaddedElement.h: Ditto.
+ * mathml/MathMLSelectElement.cpp: Ditto.
+ * mathml/MathMLSelectElement.h: Ditto.
+ * mathml/MathMLAnnotationElement.cpp: Ditto.
+ * mathml/MathMLAnnotationElement.h: Ditto.
+ * mathml/MathMLRowElement.cpp: New class for mrow-like element.
+ (WebCore::MathMLRowElement::MathMLRowElement):
+ (WebCore::MathMLRowElement::create):
+ (WebCore::MathMLRowElement::childrenChanged): Move code from MathMLInlineContainerElement.
+ (WebCore::MathMLRowElement::createElementRenderer): Ditto.
+ (WebCore::MathMLRowElement::acceptsDisplayStyleAttribute): Ditto.
+ (WebCore::MathMLRowElement::acceptsMathVariantAttribute): Ditto.
+ * mathml/MathMLRowElement.h:
+ * mathml/mathtags.in: Map tags creating RenderMathMLRow renderers to MathMLRowElement.
+ * rendering/mathml/RenderMathMLFenced.cpp: Force the constructor to take MathMLRowElement.
+ * rendering/mathml/RenderMathMLFenced.h: Ditto.
+ * rendering/mathml/RenderMathMLMath.cpp: Ditto.
+ * rendering/mathml/RenderMathMLMath.h: Ditto.
+ * rendering/mathml/RenderMathMLMenclose.cpp: Force the constructor to take MathMLMencloseElement.
+ * rendering/mathml/RenderMathMLMenclose.h: Ditto.
+ * rendering/mathml/RenderMathMLRoot.cpp: Force the constructor to take MathMLRowElement.
+ * rendering/mathml/RenderMathMLRoot.h: Ditto.
+ * rendering/mathml/RenderMathMLRow.cpp: Ditto and add an helper function element() to
+ retrieve the MathMLRowElement.
+ * rendering/mathml/RenderMathMLRow.h: Ditto.
+
2016-08-22 Chris Dumez <[email protected]>
Drop TextTrackCue's constructor as per the latest specification
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (204778 => 204779)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-08-23 08:23:31 UTC (rev 204778)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-08-23 08:28:07 UTC (rev 204779)
@@ -6312,9 +6312,11 @@
F98FFF4511A2676200F548E8 /* CSSOMUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = F98FFF4311A2676200F548E8 /* CSSOMUtils.h */; };
F9F0ED7A0DB50CA200D16DB9 /* XMLHttpRequestProgressEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = F9F0ED770DB50CA200D16DB9 /* XMLHttpRequestProgressEvent.h */; };
FA654A6B1108ABED002615E0 /* MathMLTokenElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA654A691108ABED002615E0 /* MathMLTokenElement.cpp */; };
+ FA765A6B1108ABED002615E0 /* MathMLRowElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA765A691108ABED002615E0 /* MathMLRowElement.cpp */; };
FA654A6B1108ABED002616F1 /* MathMLOperatorElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA654A691108ABED002616F1 /* MathMLOperatorElement.cpp */; };
FA654A6B1108ABED002626F1 /* MathMLUnderOverElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA654A691108ABED002626F1 /* MathMLUnderOverElement.cpp */; };
FA654A6C1108ABED002615E0 /* MathMLTokenElement.h in Headers */ = {isa = PBXBuildFile; fileRef = FA654A6A1108ABED002615E0 /* MathMLTokenElement.h */; };
+ FA765A6C1108ABED002615E0 /* MathMLRowElement.h in Headers */ = {isa = PBXBuildFile; fileRef = FA765A6A1108ABED002615E0 /* MathMLRowElement.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 */; };
@@ -13884,9 +13886,11 @@
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 /* MathMLTokenElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLTokenElement.cpp; sourceTree = "<group>"; };
+ FA765A691108ABED002615E0 /* MathMLRowElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLRowElement.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 /* MathMLTokenElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathMLTokenElement.h; sourceTree = "<group>"; };
+ FA765A6A1108ABED002615E0 /* MathMLRowElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathMLRowElement.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>"; };
@@ -23142,6 +23146,8 @@
4FA65A6A1108ABED002615E0 /* MathMLSpaceElement.h */,
FA654A691108ABED002615E0 /* MathMLTokenElement.cpp */,
FA654A6A1108ABED002615E0 /* MathMLTokenElement.h */,
+ FA765A691108ABED002615E0 /* MathMLRowElement.cpp */,
+ FA765A6A1108ABED002615E0 /* MathMLRowElement.h */,
FA654A691108ABED002626F1 /* MathMLUnderOverElement.cpp */,
FA654A6A1108ABED002626F1 /* MathMLUnderOverElement.h */,
FABE72F31059C1EB00D999DD /* mathtags.in */,
@@ -25375,6 +25381,7 @@
4FA65A6C1108ABED002615E0 /* MathMLSpaceElement.h in Headers */,
439176E012DA25E17BAF80A2 /* MathMLStyle.h in Headers */,
FA654A6C1108ABED002615E0 /* MathMLTokenElement.h in Headers */,
+ FA765A6C1108ABED002615E0 /* MathMLRowElement.h in Headers */,
FA654A6C1108ABED002626F1 /* MathMLUnderOverElement.h in Headers */,
439046EA12DA25E812AF80AC /* MathOperator.h in Headers */,
49D5DC2C0F423A73008F20FD /* Matrix3DTransformOperation.h in Headers */,
@@ -29059,6 +29066,7 @@
4FA65A6B1108ABED002615E0 /* MathMLSpaceElement.cpp in Sources */,
439176DF12DA25E17BAF80A2 /* MathMLStyle.cpp in Sources */,
FA654A6B1108ABED002615E0 /* MathMLTokenElement.cpp in Sources */,
+ FA765A6B1108ABED002615E0 /* MathMLRowElement.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 (204778 => 204779)
--- trunk/Source/WebCore/mathml/MathMLAllInOne.cpp 2016-08-23 08:23:31 UTC (rev 204778)
+++ trunk/Source/WebCore/mathml/MathMLAllInOne.cpp 2016-08-23 08:28:07 UTC (rev 204779)
@@ -34,6 +34,7 @@
#include "MathMLOperatorDictionary.cpp"
#include "MathMLOperatorElement.cpp"
#include "MathMLPaddedElement.cpp"
+#include "MathMLRowElement.cpp"
#include "MathMLScriptsElement.cpp"
#include "MathMLSelectElement.cpp"
#include "MathMLTokenElement.cpp"
Modified: trunk/Source/WebCore/mathml/MathMLAnnotationElement.cpp (204778 => 204779)
--- trunk/Source/WebCore/mathml/MathMLAnnotationElement.cpp 2016-08-23 08:23:31 UTC (rev 204778)
+++ trunk/Source/WebCore/mathml/MathMLAnnotationElement.cpp 2016-08-23 08:28:07 UTC (rev 204779)
@@ -41,7 +41,7 @@
using namespace MathMLNames;
MathMLAnnotationElement::MathMLAnnotationElement(const QualifiedName& tagName, Document& document)
- : MathMLElement(tagName, document)
+ : MathMLRowElement(tagName, document)
{
ASSERT(hasTagName(annotationTag) || hasTagName(annotation_xmlTag));
}
@@ -100,7 +100,7 @@
if (is<MathMLElement>(parent) && parent->hasTagName(semanticsTag))
downcast<MathMLElement>(*parent).updateSelectedChild();
}
- MathMLElement::attributeChanged(name, oldValue, newValue, reason);
+ MathMLRowElement::attributeChanged(name, oldValue, newValue, reason);
}
}
Modified: trunk/Source/WebCore/mathml/MathMLAnnotationElement.h (204778 => 204779)
--- trunk/Source/WebCore/mathml/MathMLAnnotationElement.h 2016-08-23 08:23:31 UTC (rev 204778)
+++ trunk/Source/WebCore/mathml/MathMLAnnotationElement.h 2016-08-23 08:28:07 UTC (rev 204779)
@@ -26,11 +26,11 @@
#pragma once
#if ENABLE(MATHML)
-#include "MathMLElement.h"
+#include "MathMLRowElement.h"
namespace WebCore {
-class MathMLAnnotationElement final : public MathMLElement {
+class MathMLAnnotationElement final : public MathMLRowElement {
public:
static Ref<MathMLAnnotationElement> create(const QualifiedName& tagName, Document&);
private:
@@ -38,7 +38,6 @@
RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final;
bool isSemanticAnnotation() const final { return true; }
- bool isPresentationMathML() const final { return true; }
bool childShouldCreateRenderer(const Node&) const final;
void attributeChanged(const QualifiedName&, const AtomicString& oldValue, const AtomicString& newValue, AttributeModificationReason) final;
Modified: trunk/Source/WebCore/mathml/MathMLInlineContainerElement.cpp (204778 => 204779)
--- trunk/Source/WebCore/mathml/MathMLInlineContainerElement.cpp 2016-08-23 08:23:31 UTC (rev 204778)
+++ trunk/Source/WebCore/mathml/MathMLInlineContainerElement.cpp 2016-08-23 08:28:07 UTC (rev 204779)
@@ -32,12 +32,7 @@
#include "MathMLInlineContainerElement.h"
#include "MathMLNames.h"
-#include "MathMLOperatorElement.h"
#include "RenderMathMLBlock.h"
-#include "RenderMathMLFenced.h"
-#include "RenderMathMLMenclose.h"
-#include "RenderMathMLRoot.h"
-#include "RenderMathMLRow.h"
namespace WebCore {
@@ -53,24 +48,8 @@
return adoptRef(*new MathMLInlineContainerElement(tagName, document));
}
-void MathMLInlineContainerElement::childrenChanged(const ChildChange& change)
-{
- for (auto child = firstChild(); child; child = child->nextSibling()) {
- if (child->hasTagName(MathMLNames::moTag))
- static_cast<MathMLOperatorElement*>(child)->setOperatorFormDirty();
- }
-
- MathMLElement::childrenChanged(change);
-}
-
RenderPtr<RenderElement> MathMLInlineContainerElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&)
{
- if (hasTagName(merrorTag) || hasTagName(mphantomTag) || hasTagName(mrowTag) || hasTagName(mstyleTag))
- return createRenderer<RenderMathMLRow>(*this, WTFMove(style));
- if (hasTagName(msqrtTag) || hasTagName(mrootTag))
- return createRenderer<RenderMathMLRoot>(*this, WTFMove(style));
- if (hasTagName(mfencedTag))
- return createRenderer<RenderMathMLFenced>(*this, WTFMove(style));
if (hasTagName(mtableTag))
return createRenderer<RenderMathMLTable>(*this, WTFMove(style));
@@ -79,14 +58,9 @@
bool MathMLInlineContainerElement::acceptsDisplayStyleAttribute()
{
- return hasTagName(mstyleTag) || hasTagName(mtableTag);
+ return hasTagName(mtableTag);
}
-bool MathMLInlineContainerElement::acceptsMathVariantAttribute()
-{
- return hasTagName(mstyleTag);
-}
-
void MathMLInlineContainerElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
bool displayStyleAttribute = name == displaystyleAttr && acceptsDisplayStyleAttribute();
Modified: trunk/Source/WebCore/mathml/MathMLInlineContainerElement.h (204778 => 204779)
--- trunk/Source/WebCore/mathml/MathMLInlineContainerElement.h 2016-08-23 08:23:31 UTC (rev 204778)
+++ trunk/Source/WebCore/mathml/MathMLInlineContainerElement.h 2016-08-23 08:28:07 UTC (rev 204779)
@@ -38,11 +38,9 @@
protected:
MathMLInlineContainerElement(const QualifiedName& tagName, Document&);
- void childrenChanged(const ChildChange&) override;
void parseAttribute(const QualifiedName&, const AtomicString&) override;
bool acceptsDisplayStyleAttribute() override;
- bool acceptsMathVariantAttribute() override;
private:
RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override;
Modified: trunk/Source/WebCore/mathml/MathMLMathElement.cpp (204778 => 204779)
--- trunk/Source/WebCore/mathml/MathMLMathElement.cpp 2016-08-23 08:23:31 UTC (rev 204778)
+++ trunk/Source/WebCore/mathml/MathMLMathElement.cpp 2016-08-23 08:28:07 UTC (rev 204779)
@@ -39,7 +39,7 @@
using namespace MathMLNames;
inline MathMLMathElement::MathMLMathElement(const QualifiedName& tagName, Document& document)
- : MathMLInlineContainerElement(tagName, document)
+ : MathMLRowElement(tagName, document)
{
setHasCustomStyleResolveCallbacks();
}
@@ -83,7 +83,7 @@
void MathMLMathElement::didAttachRenderers()
{
- MathMLInlineContainerElement::didAttachRenderers();
+ MathMLRowElement::didAttachRenderers();
MathMLStyle::resolveMathMLStyleTree(renderer());
}
Modified: trunk/Source/WebCore/mathml/MathMLMathElement.h (204778 => 204779)
--- trunk/Source/WebCore/mathml/MathMLMathElement.h 2016-08-23 08:23:31 UTC (rev 204778)
+++ trunk/Source/WebCore/mathml/MathMLMathElement.h 2016-08-23 08:28:07 UTC (rev 204779)
@@ -28,11 +28,11 @@
#pragma once
#if ENABLE(MATHML)
-#include "MathMLInlineContainerElement.h"
+#include "MathMLRowElement.h"
namespace WebCore {
-class MathMLMathElement final : public MathMLInlineContainerElement {
+class MathMLMathElement final : public MathMLRowElement {
public:
static Ref<MathMLMathElement> create(const QualifiedName& tagName, Document&);
Modified: trunk/Source/WebCore/mathml/MathMLMencloseElement.cpp (204778 => 204779)
--- trunk/Source/WebCore/mathml/MathMLMencloseElement.cpp 2016-08-23 08:23:31 UTC (rev 204778)
+++ trunk/Source/WebCore/mathml/MathMLMencloseElement.cpp 2016-08-23 08:28:07 UTC (rev 204779)
@@ -37,7 +37,7 @@
using namespace MathMLNames;
MathMLMencloseElement::MathMLMencloseElement(const QualifiedName& tagName, Document& document)
- : MathMLInlineContainerElement(tagName, document)
+ : MathMLRowElement(tagName, document)
{
// By default we draw a longdiv.
clearNotations();
@@ -118,7 +118,7 @@
if (name == notationAttr)
m_notationFlags = Nullopt;
- MathMLInlineContainerElement::parseAttribute(name, value);
+ MathMLRowElement::parseAttribute(name, value);
}
}
Modified: trunk/Source/WebCore/mathml/MathMLMencloseElement.h (204778 => 204779)
--- trunk/Source/WebCore/mathml/MathMLMencloseElement.h 2016-08-23 08:23:31 UTC (rev 204778)
+++ trunk/Source/WebCore/mathml/MathMLMencloseElement.h 2016-08-23 08:28:07 UTC (rev 204779)
@@ -28,11 +28,11 @@
#if ENABLE(MATHML)
#include "Element.h"
-#include "MathMLInlineContainerElement.h"
+#include "MathMLRowElement.h"
namespace WebCore {
-class MathMLMencloseElement final: public MathMLInlineContainerElement {
+class MathMLMencloseElement final: public MathMLRowElement {
public:
static Ref<MathMLMencloseElement> create(const QualifiedName& tagName, Document&);
Modified: trunk/Source/WebCore/mathml/MathMLPaddedElement.cpp (204778 => 204779)
--- trunk/Source/WebCore/mathml/MathMLPaddedElement.cpp 2016-08-23 08:23:31 UTC (rev 204778)
+++ trunk/Source/WebCore/mathml/MathMLPaddedElement.cpp 2016-08-23 08:28:07 UTC (rev 204779)
@@ -36,7 +36,7 @@
using namespace MathMLNames;
inline MathMLPaddedElement::MathMLPaddedElement(const QualifiedName& tagName, Document& document)
- : MathMLInlineContainerElement(tagName, document)
+ : MathMLRowElement(tagName, document)
{
}
Modified: trunk/Source/WebCore/mathml/MathMLPaddedElement.h (204778 => 204779)
--- trunk/Source/WebCore/mathml/MathMLPaddedElement.h 2016-08-23 08:23:31 UTC (rev 204778)
+++ trunk/Source/WebCore/mathml/MathMLPaddedElement.h 2016-08-23 08:28:07 UTC (rev 204779)
@@ -26,11 +26,11 @@
#pragma once
#if ENABLE(MATHML)
-#include "MathMLInlineContainerElement.h"
+#include "MathMLRowElement.h"
namespace WebCore {
-class MathMLPaddedElement final : public MathMLInlineContainerElement {
+class MathMLPaddedElement final : public MathMLRowElement {
public:
static Ref<MathMLPaddedElement> create(const QualifiedName& tagName, Document&);
// FIXME: Pseudo-units are not supported yet (https://bugs.webkit.org/show_bug.cgi?id=85730).
Copied: trunk/Source/WebCore/mathml/MathMLRowElement.cpp (from rev 204776, trunk/Source/WebCore/mathml/MathMLInlineContainerElement.cpp) (0 => 204779)
--- trunk/Source/WebCore/mathml/MathMLRowElement.cpp (rev 0)
+++ trunk/Source/WebCore/mathml/MathMLRowElement.cpp 2016-08-23 08:28:07 UTC (rev 204779)
@@ -0,0 +1,86 @@
+/*
+ * 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 "MathMLRowElement.h"
+
+#include "MathMLNames.h"
+#include "MathMLOperatorElement.h"
+#include "RenderMathMLFenced.h"
+#include "RenderMathMLMenclose.h"
+#include "RenderMathMLRoot.h"
+#include "RenderMathMLRow.h"
+
+namespace WebCore {
+
+using namespace MathMLNames;
+
+MathMLRowElement::MathMLRowElement(const QualifiedName& tagName, Document& document)
+ : MathMLInlineContainerElement(tagName, document)
+{
+}
+
+Ref<MathMLRowElement> MathMLRowElement::create(const QualifiedName& tagName, Document& document)
+{
+ return adoptRef(*new MathMLRowElement(tagName, document));
+}
+
+void MathMLRowElement::childrenChanged(const ChildChange& change)
+{
+ for (auto child = firstChild(); child; child = child->nextSibling()) {
+ if (child->hasTagName(moTag))
+ static_cast<MathMLOperatorElement*>(child)->setOperatorFormDirty();
+ }
+
+ MathMLInlineContainerElement::childrenChanged(change);
+}
+
+RenderPtr<RenderElement> MathMLRowElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&)
+{
+ if (hasTagName(msqrtTag) || hasTagName(mrootTag))
+ return createRenderer<RenderMathMLRoot>(*this, WTFMove(style));
+
+ if (hasTagName(mfencedTag))
+ return createRenderer<RenderMathMLFenced>(*this, WTFMove(style));
+
+ ASSERT(hasTagName(merrorTag) || hasTagName(mphantomTag) || hasTagName(mrowTag) || hasTagName(mstyleTag));
+ return createRenderer<RenderMathMLRow>(*this, WTFMove(style));
+}
+
+bool MathMLRowElement::acceptsDisplayStyleAttribute()
+{
+ return hasTagName(mstyleTag);
+}
+
+bool MathMLRowElement::acceptsMathVariantAttribute()
+{
+ return hasTagName(mstyleTag);
+}
+
+}
+
+#endif // ENABLE(MATHML)
Copied: trunk/Source/WebCore/mathml/MathMLRowElement.h (from rev 204776, trunk/Source/WebCore/mathml/MathMLInlineContainerElement.h) (0 => 204779)
--- trunk/Source/WebCore/mathml/MathMLRowElement.h (rev 0)
+++ trunk/Source/WebCore/mathml/MathMLRowElement.h 2016-08-23 08:28:07 UTC (rev 204779)
@@ -0,0 +1,50 @@
+/*
+ * 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 "MathMLInlineContainerElement.h"
+
+namespace WebCore {
+
+class MathMLRowElement : public MathMLInlineContainerElement {
+public:
+ static Ref<MathMLRowElement> create(const QualifiedName& tagName, Document&);
+
+protected:
+ MathMLRowElement(const QualifiedName& tagName, Document&);
+ void childrenChanged(const ChildChange&) override;
+
+ bool acceptsDisplayStyleAttribute() override;
+ bool acceptsMathVariantAttribute() override;
+
+private:
+ RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override;
+};
+
+}
+
+#endif // ENABLE(MATHML)
Modified: trunk/Source/WebCore/mathml/MathMLSelectElement.cpp (204778 => 204779)
--- trunk/Source/WebCore/mathml/MathMLSelectElement.cpp 2016-08-23 08:23:31 UTC (rev 204778)
+++ trunk/Source/WebCore/mathml/MathMLSelectElement.cpp 2016-08-23 08:28:07 UTC (rev 204779)
@@ -43,7 +43,7 @@
using namespace MathMLNames;
MathMLSelectElement::MathMLSelectElement(const QualifiedName& tagName, Document& document)
- : MathMLInlineContainerElement(tagName, document)
+ : MathMLRowElement(tagName, document)
, m_selectedChild(nullptr)
{
}
@@ -89,13 +89,13 @@
void MathMLSelectElement::finishParsingChildren()
{
updateSelectedChild();
- MathMLInlineContainerElement::finishParsingChildren();
+ MathMLRowElement::finishParsingChildren();
}
void MathMLSelectElement::childrenChanged(const ChildChange& change)
{
updateSelectedChild();
- MathMLInlineContainerElement::childrenChanged(change);
+ MathMLRowElement::childrenChanged(change);
}
void MathMLSelectElement::attributeChanged(const QualifiedName& name, const AtomicString& oldValue, const AtomicString& newValue, AttributeModificationReason reason)
@@ -103,7 +103,7 @@
if (hasTagName(mactionTag) && (name == MathMLNames::actiontypeAttr || name == MathMLNames::selectionAttr))
updateSelectedChild();
- MathMLInlineContainerElement::attributeChanged(name, oldValue, newValue, reason);
+ MathMLRowElement::attributeChanged(name, oldValue, newValue, reason);
}
int MathMLSelectElement::getSelectedActionChildAndIndex(Element*& selectedChild)
@@ -219,12 +219,12 @@
}
}
- MathMLInlineContainerElement::defaultEventHandler(event);
+ MathMLRowElement::defaultEventHandler(event);
}
bool MathMLSelectElement::willRespondToMouseClickEvents()
{
- return attributeWithoutSynchronization(MathMLNames::actiontypeAttr) == "toggle" || MathMLInlineContainerElement::willRespondToMouseClickEvents();
+ return attributeWithoutSynchronization(MathMLNames::actiontypeAttr) == "toggle" || MathMLRowElement::willRespondToMouseClickEvents();
}
void MathMLSelectElement::toggle()
Modified: trunk/Source/WebCore/mathml/MathMLSelectElement.h (204778 => 204779)
--- trunk/Source/WebCore/mathml/MathMLSelectElement.h 2016-08-23 08:23:31 UTC (rev 204778)
+++ trunk/Source/WebCore/mathml/MathMLSelectElement.h 2016-08-23 08:28:07 UTC (rev 204779)
@@ -26,11 +26,11 @@
#pragma once
#if ENABLE(MATHML)
-#include "MathMLInlineContainerElement.h"
+#include "MathMLRowElement.h"
namespace WebCore {
-class MathMLSelectElement final : public MathMLInlineContainerElement {
+class MathMLSelectElement final : public MathMLRowElement {
public:
static Ref<MathMLSelectElement> create(const QualifiedName& tagName, Document&);
static bool isMathMLEncoding(const AtomicString& value);
Modified: trunk/Source/WebCore/mathml/mathtags.in (204778 => 204779)
--- trunk/Source/WebCore/mathml/mathtags.in 2016-08-23 08:23:31 UTC (rev 204778)
+++ trunk/Source/WebCore/mathml/mathtags.in 2016-08-23 08:28:07 UTC (rev 204779)
@@ -8,18 +8,18 @@
maction interfaceName=MathMLSelectElement
math
mfrac interfaceName=MathMLFractionElement
-mfenced interfaceName=MathMLInlineContainerElement
+mfenced interfaceName=MathMLRowElement
msubsup interfaceName=MathMLScriptsElement
-merror interfaceName=MathMLInlineContainerElement
+merror interfaceName=MathMLRowElement
mpadded interfaceName=MathMLPaddedElement
-mphantom interfaceName=MathMLInlineContainerElement
-mrow interfaceName=MathMLInlineContainerElement
-mstyle interfaceName=MathMLInlineContainerElement
+mphantom interfaceName=MathMLRowElement
+mrow interfaceName=MathMLRowElement
+mstyle interfaceName=MathMLRowElement
mover interfaceName=MathMLUnderOverElement
munder interfaceName=MathMLUnderOverElement
munderover interfaceName=MathMLUnderOverElement
-msqrt interfaceName=MathMLInlineContainerElement
-mroot interfaceName=MathMLInlineContainerElement
+msqrt interfaceName=MathMLRowElement
+mroot interfaceName=MathMLRowElement
mi interfaceName=MathMLTokenElement
mn interfaceName=MathMLTokenElement
mo interfaceName=MathMLOperatorElement
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLFenced.cpp (204778 => 204779)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLFenced.cpp 2016-08-23 08:23:31 UTC (rev 204778)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLFenced.cpp 2016-08-23 08:28:07 UTC (rev 204779)
@@ -31,6 +31,7 @@
#include "FontSelector.h"
#include "MathMLNames.h"
+#include "MathMLRowElement.h"
#include "RenderInline.h"
#include "RenderMathMLFencedOperator.h"
#include "RenderText.h"
@@ -43,7 +44,7 @@
static const char* gOpeningBraceChar = "(";
static const char* gClosingBraceChar = ")";
-RenderMathMLFenced::RenderMathMLFenced(MathMLInlineContainerElement& element, RenderStyle&& style)
+RenderMathMLFenced::RenderMathMLFenced(MathMLRowElement& element, RenderStyle&& style)
: RenderMathMLRow(element, WTFMove(style))
, m_closeFenceRenderer(nullptr)
{
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLFenced.h (204778 => 204779)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLFenced.h 2016-08-23 08:23:31 UTC (rev 204778)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLFenced.h 2016-08-23 08:28:07 UTC (rev 204779)
@@ -27,16 +27,16 @@
#if ENABLE(MATHML)
-#include "MathMLInlineContainerElement.h"
#include "RenderMathMLFencedOperator.h"
#include "RenderMathMLRow.h"
namespace WebCore {
+class MathMLRowElement;
+
class RenderMathMLFenced final : public RenderMathMLRow {
public:
- RenderMathMLFenced(MathMLInlineContainerElement&, RenderStyle&&);
- MathMLInlineContainerElement& element() { return static_cast<MathMLInlineContainerElement&>(nodeForNonAnonymous()); }
+ RenderMathMLFenced(MathMLRowElement&, RenderStyle&&);
private:
bool isRenderMathMLFenced() const final { return true; }
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLMath.cpp (204778 => 204779)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLMath.cpp 2016-08-23 08:23:31 UTC (rev 204778)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLMath.cpp 2016-08-23 08:28:07 UTC (rev 204779)
@@ -30,12 +30,13 @@
#include "RenderMathMLMath.h"
#include "MathMLNames.h"
+#include "MathMLRowElement.h"
namespace WebCore {
using namespace MathMLNames;
-RenderMathMLMath::RenderMathMLMath(Element& element, RenderStyle&& style)
+RenderMathMLMath::RenderMathMLMath(MathMLRowElement& element, RenderStyle&& style)
: RenderMathMLRow(element, WTFMove(style))
{
}
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLMath.h (204778 => 204779)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLMath.h 2016-08-23 08:23:31 UTC (rev 204778)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLMath.h 2016-08-23 08:28:07 UTC (rev 204779)
@@ -31,9 +31,11 @@
namespace WebCore {
+class MathMLRowElement;
+
class RenderMathMLMath final : public RenderMathMLRow {
public:
- RenderMathMLMath(Element&, RenderStyle&&);
+ RenderMathMLMath(MathMLRowElement&, RenderStyle&&);
private:
bool isRenderMathMLMath() const final { return true; }
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLMenclose.cpp (204778 => 204779)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLMenclose.cpp 2016-08-23 08:23:31 UTC (rev 204778)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLMenclose.cpp 2016-08-23 08:28:07 UTC (rev 204779)
@@ -42,7 +42,7 @@
// For now, we use a Bezier curve and this somewhat arbitrary value.
const unsigned short longDivLeftSpace = 10;
-RenderMathMLMenclose::RenderMathMLMenclose(Element& element, RenderStyle&& style)
+RenderMathMLMenclose::RenderMathMLMenclose(MathMLMencloseElement& element, RenderStyle&& style)
: RenderMathMLRow(element, WTFMove(style))
, m_ascent(0)
{
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLMenclose.h (204778 => 204779)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLMenclose.h 2016-08-23 08:23:31 UTC (rev 204778)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLMenclose.h 2016-08-23 08:28:07 UTC (rev 204779)
@@ -34,7 +34,7 @@
class RenderMathMLMenclose final: public RenderMathMLRow {
public:
- RenderMathMLMenclose(Element&, RenderStyle&&);
+ RenderMathMLMenclose(MathMLMencloseElement&, RenderStyle&&);
private:
const char* renderName() const final { return "RenderMathMLMenclose"; }
@@ -44,7 +44,7 @@
void paint(PaintInfo&, const LayoutPoint&) final;
LayoutUnit ruleThickness() const;
- bool hasNotation(MathMLMencloseElement::MencloseNotationFlag notationFlag) const { return downcast<MathMLMencloseElement>(element())->hasNotation(notationFlag); }
+ bool hasNotation(MathMLMencloseElement::MencloseNotationFlag notationFlag) const { return downcast<MathMLMencloseElement>(element()).hasNotation(notationFlag); }
void getSpaceAroundContent(LayoutUnit contentWidth, LayoutUnit contentHeight, LayoutUnit& leftSpace, LayoutUnit& rightSpace, LayoutUnit& topSpace, LayoutUnit& bottomSpace) const;
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp (204778 => 204779)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp 2016-08-23 08:23:31 UTC (rev 204778)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp 2016-08-23 08:28:07 UTC (rev 204779)
@@ -34,6 +34,7 @@
#include "FontCache.h"
#include "GraphicsContext.h"
#include "MathMLNames.h"
+#include "MathMLRowElement.h"
#include "PaintInfo.h"
#include "RenderIterator.h"
#include "RenderMathMLMenclose.h"
@@ -43,7 +44,7 @@
namespace WebCore {
-RenderMathMLRoot::RenderMathMLRoot(Element& element, RenderStyle&& style)
+RenderMathMLRoot::RenderMathMLRoot(MathMLRowElement& element, RenderStyle&& style)
: RenderMathMLRow(element, WTFMove(style))
{
// Determine what kind of _expression_ we have by element name
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.h (204778 => 204779)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.h 2016-08-23 08:23:31 UTC (rev 204778)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.h 2016-08-23 08:28:07 UTC (rev 204779)
@@ -34,11 +34,13 @@
namespace WebCore {
+class MathMLRowElement;
+
// Render base^(1/index), or sqrt(base) using radical notation.
class RenderMathMLRoot final : public RenderMathMLRow {
public:
- RenderMathMLRoot(Element&, RenderStyle&&);
+ RenderMathMLRoot(MathMLRowElement&, RenderStyle&&);
void updateFromElement() final;
void updateStyle();
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp (204778 => 204779)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp 2016-08-23 08:23:31 UTC (rev 204778)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp 2016-08-23 08:28:07 UTC (rev 204779)
@@ -31,6 +31,7 @@
#include "RenderMathMLRow.h"
#include "MathMLNames.h"
+#include "MathMLRowElement.h"
#include "RenderIterator.h"
#include "RenderMathMLOperator.h"
#include "RenderMathMLRoot.h"
@@ -39,11 +40,16 @@
using namespace MathMLNames;
-RenderMathMLRow::RenderMathMLRow(Element& element, RenderStyle&& style)
+RenderMathMLRow::RenderMathMLRow(MathMLRowElement& element, RenderStyle&& style)
: RenderMathMLBlock(element, WTFMove(style))
{
}
+MathMLRowElement& RenderMathMLRow::element() const
+{
+ return static_cast<MathMLRowElement&>(nodeForNonAnonymous());
+}
+
Optional<int> RenderMathMLRow::firstLineBaseline() const
{
auto* baselineChild = firstChildBox();
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.h (204778 => 204779)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.h 2016-08-23 08:23:31 UTC (rev 204778)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.h 2016-08-23 08:28:07 UTC (rev 204779)
@@ -32,9 +32,12 @@
namespace WebCore {
+class MathMLRowElement;
+
class RenderMathMLRow : public RenderMathMLBlock {
public:
- RenderMathMLRow(Element&, RenderStyle&&);
+ RenderMathMLRow(MathMLRowElement&, RenderStyle&&);
+ MathMLRowElement& element() const;
protected:
void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) override;