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 "platform/wtf/HashMap.h" | 10 #include "platform/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 value of the given boolean property if the |
| 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& is_null); |
| 76 |
| 77 bool atomic(bool&) const; |
| 78 void setAtomic(bool, bool is_null); |
| 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, bool is_null); |
| 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, bool is_null); |
| 94 |
| 95 bool expanded(bool&) const; |
| 96 void setExpanded(bool, bool is_null); |
| 97 |
| 98 bool hidden(bool&) const; |
| 99 void setHidden(bool, bool is_null); |
| 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, bool is_null); |
| 115 |
| 116 bool multiline(bool&) const; |
| 117 void setMultiline(bool, bool is_null); |
| 118 |
| 119 bool multiselectable(bool&) const; |
| 120 void setMultiselectable(bool, bool is_null); |
| 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, bool is_null); |
| 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, bool is_null); |
| 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, bool is_null); |
| 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>> string_properties_; | 160 Vector<std::pair<AOMStringProperty, AtomicString>> string_properties_; |
| 161 Vector<std::pair<AOMBooleanProperty, bool>> boolean_properties_; |
106 | 162 |
107 // This object's owner Element. | 163 // This object's owner Element. |
108 Member<Element> element_; | 164 Member<Element> element_; |
109 }; | 165 }; |
110 | 166 |
111 } // namespace blink | 167 } // namespace blink |
112 | 168 |
113 #endif // AccessibleNode_h | 169 #endif // AccessibleNode_h |
OLD | NEW |