1/*
2 * Copyright (C) 2016 Igalia, S.L.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#pragma once
29
30#if ENABLE(MATHML)
31
32#include "AccessibilityRenderObject.h"
33#include "RenderMathMLBlock.h"
34#include "RenderMathMLFraction.h"
35#include "RenderMathMLMath.h"
36#include "RenderMathMLOperator.h"
37#include "RenderMathMLRoot.h"
38
39namespace WebCore {
40
41class AccessibilityMathMLElement : public AccessibilityRenderObject {
42
43public:
44 static Ref<AccessibilityMathMLElement> create(RenderObject*, bool isAnonymousOperator);
45 virtual ~AccessibilityMathMLElement();
46
47protected:
48 explicit AccessibilityMathMLElement(RenderObject*, bool isAnonymousOperator);
49
50private:
51 AccessibilityRole determineAccessibilityRole() final;
52 String textUnderElement(AccessibilityTextUnderElementMode = AccessibilityTextUnderElementMode()) const override;
53 String stringValue() const override;
54 bool isIgnoredElementWithinMathTree() const final;
55
56 bool isMathElement() const final { return true; }
57
58 bool isMathFraction() const override;
59 bool isMathFenced() const override;
60 bool isMathSubscriptSuperscript() const override;
61 bool isMathRow() const override;
62 bool isMathUnderOver() const override;
63 bool isMathRoot() const override;
64 bool isMathSquareRoot() const override;
65 bool isMathText() const override;
66 bool isMathNumber() const override;
67 bool isMathOperator() const override;
68 bool isMathFenceOperator() const override;
69 bool isMathSeparatorOperator() const override;
70 bool isMathIdentifier() const override;
71 bool isMathTable() const override;
72 bool isMathTableRow() const override;
73 bool isMathTableCell() const override;
74 bool isMathMultiscript() const override;
75 bool isMathToken() const override;
76 bool isMathScriptObject(AccessibilityMathScriptObjectType) const override;
77 bool isMathMultiscriptObject(AccessibilityMathMultiscriptObjectType) const override;
78
79 // Generic components.
80 AccessibilityObject* mathBaseObject() override;
81
82 // Root components.
83 AccessibilityObject* mathRadicandObject() override;
84 AccessibilityObject* mathRootIndexObject() override;
85
86 // Fraction components.
87 AccessibilityObject* mathNumeratorObject() override;
88 AccessibilityObject* mathDenominatorObject() override;
89
90 // Under over components.
91 AccessibilityObject* mathUnderObject() override;
92 AccessibilityObject* mathOverObject() override;
93
94 // Subscript/superscript components.
95 AccessibilityObject* mathSubscriptObject() override;
96 AccessibilityObject* mathSuperscriptObject() override;
97
98 // Fenced components.
99 String mathFencedOpenString() const override;
100 String mathFencedCloseString() const override;
101 int mathLineThickness() const override;
102 bool isAnonymousMathOperator() const override;
103
104 // Multiscripts components.
105 void mathPrescripts(AccessibilityMathMultiscriptPairs&) override;
106 void mathPostscripts(AccessibilityMathMultiscriptPairs&) override;
107
108 bool m_isAnonymousOperator;
109};
110
111} // namespace WebCore
112
113SPECIALIZE_TYPE_TRAITS_ACCESSIBILITY(AccessibilityMathMLElement, isMathElement())
114
115#endif // ENABLE(MATHML)
116