- a/Source/WebCore/ChangeLog +28 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2016-08-26  Frederic Wang  <fwang@igalia.com>
2
3
        Make MathMLSpaceElement and MathMLTokenElement inherit from MathMLPresentationElement
4
        https://bugs.webkit.org/show_bug.cgi?id=161232
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        The mrow-like features of MathMLPresentationElement are now moved into RenderMathMLRow.
9
        Hence we make MathMLSpaceElement and MathMLTokenElement inherit from the generic class
10
        MathMLPresentationElement for presentation MathML elements.
11
12
        No new tests, already covered by existing tests.
13
14
        * mathml/MathMLSpaceElement.cpp:
15
        (WebCore::MathMLSpaceElement::MathMLSpaceElement): Derive from MathMLPresentationElement.
16
        (WebCore::MathMLSpaceElement::parseAttribute): Ditto.
17
        * mathml/MathMLSpaceElement.h: Ditto. Override acceptsDisplayStyleAttribute as a small
18
        optimization. isPresentationMathML is no longer needed.
19
        * mathml/MathMLTokenElement.cpp:
20
        (WebCore::MathMLTokenElement::MathMLTokenElement): Derive from MathMLPresentationElement.
21
        (WebCore::MathMLTokenElement::didAttachRenderers): Ditto.
22
        (WebCore::MathMLTokenElement::childrenChanged): Ditto.
23
        (WebCore::MathMLTokenElement::parseAttribute): Deleted. No need to override this function
24
        any more since it's already implemented in MathMLPresentationElement.
25
        * mathml/MathMLTokenElement.h: Derive from MathMLPresentationElement. Override
26
        acceptsDisplayStyleAttribute as a small optimization. isPresentationMathML is no longer
27
        needed.
28
1
2016-08-25  Carlos Garcia Campos  <cgarcia@igalia.com>
29
2016-08-25  Carlos Garcia Campos  <cgarcia@igalia.com>
2
30
3
        Unreviewed. Fix GTK+ build after r204986 and r204996.
31
        Unreviewed. Fix GTK+ build after r204986 and r204996.
- a/Source/WebCore/mathml/MathMLSpaceElement.cpp -2 / +2 lines
Lines 36-42 namespace WebCore { a/Source/WebCore/mathml/MathMLSpaceElement.cpp_sec1
36
using namespace MathMLNames;
36
using namespace MathMLNames;
37
37
38
MathMLSpaceElement::MathMLSpaceElement(const QualifiedName& tagName, Document& document)
38
MathMLSpaceElement::MathMLSpaceElement(const QualifiedName& tagName, Document& document)
39
    : MathMLElement(tagName, document)
39
    : MathMLPresentationElement(tagName, document)
40
{
40
{
41
}
41
}
42
42
Lines 69-75 void MathMLSpaceElement::parseAttribute(const QualifiedName& name, const AtomicS a/Source/WebCore/mathml/MathMLSpaceElement.cpp_sec2
69
    else if (name == depthAttr)
69
    else if (name == depthAttr)
70
        m_depth = Nullopt;
70
        m_depth = Nullopt;
71
71
72
    MathMLElement::parseAttribute(name, value);
72
    MathMLPresentationElement::parseAttribute(name, value);
73
}
73
}
74
74
75
RenderPtr<RenderElement> MathMLSpaceElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&)
75
RenderPtr<RenderElement> MathMLSpaceElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&)
- a/Source/WebCore/mathml/MathMLSpaceElement.h -3 / +4 lines
Lines 27-37 a/Source/WebCore/mathml/MathMLSpaceElement.h_sec1
27
27
28
#if ENABLE(MATHML)
28
#if ENABLE(MATHML)
29
29
30
#include "MathMLElement.h"
30
#include "MathMLPresentationElement.h"
31
31
32
namespace WebCore {
32
namespace WebCore {
33
33
34
class MathMLSpaceElement final : public MathMLElement {
34
class MathMLSpaceElement final : public MathMLPresentationElement {
35
public:
35
public:
36
    static Ref<MathMLSpaceElement> create(const QualifiedName& tagName, Document&);
36
    static Ref<MathMLSpaceElement> create(const QualifiedName& tagName, Document&);
37
    const Length& width();
37
    const Length& width();
Lines 39-48 public: a/Source/WebCore/mathml/MathMLSpaceElement.h_sec2
39
    const Length& depth();
39
    const Length& depth();
40
private:
40
private:
41
    MathMLSpaceElement(const QualifiedName& tagName, Document&);
41
    MathMLSpaceElement(const QualifiedName& tagName, Document&);
42
    bool isPresentationMathML() const final { return true; }
43
    RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final;
42
    RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final;
44
    void parseAttribute(const QualifiedName&, const AtomicString&) final;
43
    void parseAttribute(const QualifiedName&, const AtomicString&) final;
45
44
45
    bool acceptsDisplayStyleAttribute() final { return false; }
46
46
    Optional<Length> m_width;
47
    Optional<Length> m_width;
47
    Optional<Length> m_height;
48
    Optional<Length> m_height;
48
    Optional<Length> m_depth;
49
    Optional<Length> m_depth;
- a/Source/WebCore/mathml/MathMLTokenElement.cpp -14 / +3 lines
Lines 38-44 namespace WebCore { a/Source/WebCore/mathml/MathMLTokenElement.cpp_sec1
38
using namespace MathMLNames;
38
using namespace MathMLNames;
39
39
40
MathMLTokenElement::MathMLTokenElement(const QualifiedName& tagName, Document& document)
40
MathMLTokenElement::MathMLTokenElement(const QualifiedName& tagName, Document& document)
41
    : MathMLElement(tagName, document)
41
    : MathMLPresentationElement(tagName, document)
42
{
42
{
43
    setHasCustomStyleResolveCallbacks();
43
    setHasCustomStyleResolveCallbacks();
44
}
44
}
Lines 50-56 Ref<MathMLTokenElement> MathMLTokenElement::create(const QualifiedName& tagName, a/Source/WebCore/mathml/MathMLTokenElement.cpp_sec2
50
50
51
void MathMLTokenElement::didAttachRenderers()
51
void MathMLTokenElement::didAttachRenderers()
52
{
52
{
53
    MathMLElement::didAttachRenderers();
53
    MathMLPresentationElement::didAttachRenderers();
54
    auto* mathmlRenderer = renderer();
54
    auto* mathmlRenderer = renderer();
55
    if (is<RenderMathMLToken>(mathmlRenderer))
55
    if (is<RenderMathMLToken>(mathmlRenderer))
56
        downcast<RenderMathMLToken>(*mathmlRenderer).updateTokenContent();
56
        downcast<RenderMathMLToken>(*mathmlRenderer).updateTokenContent();
Lines 58-80 void MathMLTokenElement::didAttachRenderers() a/Source/WebCore/mathml/MathMLTokenElement.cpp_sec3
58
58
59
void MathMLTokenElement::childrenChanged(const ChildChange& change)
59
void MathMLTokenElement::childrenChanged(const ChildChange& change)
60
{
60
{
61
    MathMLElement::childrenChanged(change);
61
    MathMLPresentationElement::childrenChanged(change);
62
    auto* mathmlRenderer = renderer();
62
    auto* mathmlRenderer = renderer();
63
    if (is<RenderMathMLToken>(mathmlRenderer))
63
    if (is<RenderMathMLToken>(mathmlRenderer))
64
        downcast<RenderMathMLToken>(*mathmlRenderer).updateTokenContent();
64
        downcast<RenderMathMLToken>(*mathmlRenderer).updateTokenContent();
65
}
65
}
66
66
67
void MathMLTokenElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
68
{
69
    if (name == mathvariantAttr) {
70
        m_mathVariant = Nullopt;
71
        if (renderer())
72
            MathMLStyle::resolveMathMLStyleTree(renderer());
73
    }
74
75
    MathMLElement::parseAttribute(name, value);
76
}
77
78
RenderPtr<RenderElement> MathMLTokenElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&)
67
RenderPtr<RenderElement> MathMLTokenElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&)
79
{
68
{
80
    ASSERT(hasTagName(MathMLNames::miTag) || hasTagName(MathMLNames::mnTag) || hasTagName(MathMLNames::msTag) || hasTagName(MathMLNames::mtextTag));
69
    ASSERT(hasTagName(MathMLNames::miTag) || hasTagName(MathMLNames::mnTag) || hasTagName(MathMLNames::msTag) || hasTagName(MathMLNames::mtextTag));
- a/Source/WebCore/mathml/MathMLTokenElement.h -4 / +3 lines
Lines 29-39 a/Source/WebCore/mathml/MathMLTokenElement.h_sec1
29
29
30
#if ENABLE(MATHML)
30
#if ENABLE(MATHML)
31
31
32
#include "MathMLElement.h"
32
#include "MathMLPresentationElement.h"
33
33
34
namespace WebCore {
34
namespace WebCore {
35
35
36
class MathMLTokenElement : public MathMLElement {
36
class MathMLTokenElement : public MathMLPresentationElement {
37
public:
37
public:
38
    static Ref<MathMLTokenElement> create(const QualifiedName& tagName, Document&);
38
    static Ref<MathMLTokenElement> create(const QualifiedName& tagName, Document&);
39
39
Lines 42-48 public: a/Source/WebCore/mathml/MathMLTokenElement.h_sec2
42
protected:
42
protected:
43
    MathMLTokenElement(const QualifiedName& tagName, Document&);
43
    MathMLTokenElement(const QualifiedName& tagName, Document&);
44
    void childrenChanged(const ChildChange&) override;
44
    void childrenChanged(const ChildChange&) override;
45
    void parseAttribute(const QualifiedName&, const AtomicString&) override;
46
45
47
private:
46
private:
48
    RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override;
47
    RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override;
Lines 51-58 private: a/Source/WebCore/mathml/MathMLTokenElement.h_sec3
51
    void didAttachRenderers() final;
50
    void didAttachRenderers() final;
52
51
53
    bool isMathMLToken() const final { return true; }
52
    bool isMathMLToken() const final { return true; }
54
    bool isPresentationMathML() const final { return true; }
55
    bool acceptsMathVariantAttribute() final { return true; }
53
    bool acceptsMathVariantAttribute() final { return true; }
54
    bool acceptsDisplayStyleAttribute() final { return false; }
56
};
55
};
57
56
58
}
57
}

Return to Bug 161232