OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef AccessibleNode_h | 5 #ifndef AccessibleNode_h |
6 #define AccessibleNode_h | 6 #define AccessibleNode_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptWrappable.h" | 8 #include "bindings/core/v8/ScriptWrappable.h" |
9 #include "core/CoreExport.h" | 9 #include "core/CoreExport.h" |
10 #include "wtf/HashMap.h" | 10 #include "wtf/HashMap.h" |
(...skipping 19 matching lines...) Expand all Loading... | |
30 kLive, | 30 kLive, |
31 kOrientation, | 31 kOrientation, |
32 kPlaceholder, | 32 kPlaceholder, |
33 kRelevant, | 33 kRelevant, |
34 kRole, | 34 kRole, |
35 kRoleDescription, | 35 kRoleDescription, |
36 kSort, | 36 kSort, |
37 kValueText | 37 kValueText |
38 }; | 38 }; |
39 | 39 |
40 // All of the properties of AccessibleNode that have type "boolean". | |
41 enum class AOMBooleanProperty { | |
42 kAtomic, | |
43 kBusy, | |
44 kDisabled, | |
45 kExpanded, | |
46 kHidden, | |
47 kModal, | |
48 kMultiline, | |
49 kMultiselectable, | |
50 kReadOnly, | |
51 kRequired, | |
52 kSelected | |
53 }; | |
54 | |
40 // Accessibility Object Model node | 55 // Accessibility Object Model node |
41 // Explainer: https://github.com/WICG/aom/blob/master/explainer.md | 56 // Explainer: https://github.com/WICG/aom/blob/master/explainer.md |
42 // Spec: https://wicg.github.io/aom/spec/ | 57 // Spec: https://wicg.github.io/aom/spec/ |
43 class CORE_EXPORT AccessibleNode | 58 class CORE_EXPORT AccessibleNode |
44 : public GarbageCollectedFinalized<AccessibleNode>, | 59 : public GarbageCollectedFinalized<AccessibleNode>, |
45 public ScriptWrappable { | 60 public ScriptWrappable { |
46 DEFINE_WRAPPERTYPEINFO(); | 61 DEFINE_WRAPPERTYPEINFO(); |
47 | 62 |
48 public: | 63 public: |
49 explicit AccessibleNode(Element*); | 64 explicit AccessibleNode(Element*); |
50 virtual ~AccessibleNode(); | 65 virtual ~AccessibleNode(); |
51 | 66 |
52 // Returns the given string property if the Element has an AccessibleNode, | 67 // Returns the given string property if the Element has an AccessibleNode, |
53 // otherwise returns the equivalent ARIA attribute. | 68 // otherwise returns the equivalent ARIA attribute. |
54 static const AtomicString& getProperty(Element*, AOMStringProperty); | 69 static const AtomicString& getProperty(Element*, AOMStringProperty); |
55 | 70 |
71 // Returns the alue of the given boolean property if the | |
aboxhall
2017/04/07 05:22:35
typo "alue"
dmazzoni
2017/04/21 07:11:37
Done.
| |
72 // Element has an AccessibleNode, otherwise returns the equivalent | |
73 // ARIA attribute. Sets |isNull| if the property and attribute are not | |
74 // present. | |
75 static bool getProperty(Element*, AOMBooleanProperty, bool& isNull); | |
76 | |
77 bool atomic(bool&) const; | |
78 void setAtomic(bool); | |
79 | |
56 AtomicString autocomplete() const; | 80 AtomicString autocomplete() const; |
57 void setAutocomplete(const AtomicString&); | 81 void setAutocomplete(const AtomicString&); |
58 | 82 |
83 bool busy(bool&) const; | |
84 void setBusy(bool); | |
85 | |
59 AtomicString checked() const; | 86 AtomicString checked() const; |
60 void setChecked(const AtomicString&); | 87 void setChecked(const AtomicString&); |
61 | 88 |
62 AtomicString current() const; | 89 AtomicString current() const; |
63 void setCurrent(const AtomicString&); | 90 void setCurrent(const AtomicString&); |
64 | 91 |
92 bool disabled(bool&) const; | |
93 void setDisabled(bool); | |
94 | |
95 bool expanded(bool&) const; | |
96 void setExpanded(bool); | |
97 | |
98 bool hidden(bool&) const; | |
99 void setHidden(bool); | |
100 | |
65 AtomicString invalid() const; | 101 AtomicString invalid() const; |
66 void setInvalid(const AtomicString&); | 102 void setInvalid(const AtomicString&); |
67 | 103 |
68 AtomicString keyShortcuts() const; | 104 AtomicString keyShortcuts() const; |
69 void setKeyShortcuts(const AtomicString&); | 105 void setKeyShortcuts(const AtomicString&); |
70 | 106 |
71 AtomicString label() const; | 107 AtomicString label() const; |
72 void setLabel(const AtomicString&); | 108 void setLabel(const AtomicString&); |
73 | 109 |
74 AtomicString live() const; | 110 AtomicString live() const; |
75 void setLive(const AtomicString&); | 111 void setLive(const AtomicString&); |
76 | 112 |
113 bool modal(bool&) const; | |
114 void setModal(bool); | |
115 | |
116 bool multiline(bool&) const; | |
117 void setMultiline(bool); | |
118 | |
119 bool multiselectable(bool&) const; | |
120 void setMultiselectable(bool); | |
121 | |
77 AtomicString orientation() const; | 122 AtomicString orientation() const; |
78 void setOrientation(const AtomicString&); | 123 void setOrientation(const AtomicString&); |
79 | 124 |
80 AtomicString placeholder() const; | 125 AtomicString placeholder() const; |
81 void setPlaceholder(const AtomicString&); | 126 void setPlaceholder(const AtomicString&); |
82 | 127 |
128 bool readOnly(bool&) const; | |
129 void setReadOnly(bool); | |
130 | |
83 AtomicString relevant() const; | 131 AtomicString relevant() const; |
84 void setRelevant(const AtomicString&); | 132 void setRelevant(const AtomicString&); |
85 | 133 |
134 bool required(bool&) const; | |
135 void setRequired(bool); | |
136 | |
86 AtomicString role() const; | 137 AtomicString role() const; |
87 void setRole(const AtomicString&); | 138 void setRole(const AtomicString&); |
88 | 139 |
89 AtomicString roleDescription() const; | 140 AtomicString roleDescription() const; |
90 void setRoleDescription(const AtomicString&); | 141 void setRoleDescription(const AtomicString&); |
91 | 142 |
143 bool selected(bool&) const; | |
144 void setSelected(bool); | |
145 | |
92 AtomicString sort() const; | 146 AtomicString sort() const; |
93 void setSort(const AtomicString&); | 147 void setSort(const AtomicString&); |
94 | 148 |
95 AtomicString valueText() const; | 149 AtomicString valueText() const; |
96 void setValueText(const AtomicString&); | 150 void setValueText(const AtomicString&); |
97 | 151 |
98 DECLARE_VIRTUAL_TRACE(); | 152 DECLARE_VIRTUAL_TRACE(); |
99 | 153 |
100 private: | 154 private: |
101 void setStringProperty(AOMStringProperty, const AtomicString&); | 155 void setStringProperty(AOMStringProperty, const AtomicString&); |
156 void setBooleanProperty(AOMBooleanProperty, bool); | |
102 void notifyAttributeChanged(const blink::QualifiedName&); | 157 void notifyAttributeChanged(const blink::QualifiedName&); |
103 AXObjectCache* getAXObjectCache(); | 158 AXObjectCache* getAXObjectCache(); |
104 | 159 |
105 Vector<std::pair<AOMStringProperty, AtomicString>> m_stringProperties; | 160 Vector<std::pair<AOMStringProperty, AtomicString>> m_stringProperties; |
161 Vector<std::pair<AOMBooleanProperty, bool>> m_booleanProperties; | |
106 | 162 |
107 // This object's owner Element. | 163 // This object's owner Element. |
108 Member<Element> m_element; | 164 Member<Element> m_element; |
109 }; | 165 }; |
110 | 166 |
111 } // namespace blink | 167 } // namespace blink |
112 | 168 |
113 #endif // AccessibleNode_h | 169 #endif // AccessibleNode_h |
OLD | NEW |