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" |
11 #include "wtf/text/AtomicString.h" | 11 #include "wtf/text/AtomicString.h" |
12 #include "wtf/text/AtomicStringHash.h" | 12 #include "wtf/text/AtomicStringHash.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 class Element; | 16 class Element; |
17 | 17 |
18 // All of the properties of AccessibleNode that have type "string". | 18 // All of the properties of AccessibleNode that have type "string". |
19 // TODO(dmazzoni): Add similar enums for all of the properties with | 19 // TODO(dmazzoni): Add similar enums for all of the properties with |
20 // type bool, float, reference, and reference list. | 20 // type bool, float, reference, and reference list. |
21 enum class AOMStringProperty { kRole, kLabel }; | 21 enum class AOMStringProperty { |
| 22 kAutocomplete, |
| 23 kChecked, |
| 24 kCurrent, |
| 25 kInvalid, |
| 26 kKeyShortcuts, |
| 27 kLabel, |
| 28 kLive, |
| 29 kOrientation, |
| 30 kPlaceholder, |
| 31 kRelevant, |
| 32 kRole, |
| 33 kRoleDescription, |
| 34 kSort, |
| 35 kValueText |
| 36 }; |
22 | 37 |
23 // Accessibility Object Model node | 38 // Accessibility Object Model node |
24 // Explainer: https://github.com/WICG/aom/blob/master/explainer.md | 39 // Explainer: https://github.com/WICG/aom/blob/master/explainer.md |
25 // Spec: https://wicg.github.io/aom/spec/ | 40 // Spec: https://wicg.github.io/aom/spec/ |
26 class CORE_EXPORT AccessibleNode | 41 class CORE_EXPORT AccessibleNode |
27 : public GarbageCollectedFinalized<AccessibleNode>, | 42 : public GarbageCollectedFinalized<AccessibleNode>, |
28 public ScriptWrappable { | 43 public ScriptWrappable { |
29 DEFINE_WRAPPERTYPEINFO(); | 44 DEFINE_WRAPPERTYPEINFO(); |
30 | 45 |
31 public: | 46 public: |
32 explicit AccessibleNode(Element*); | 47 explicit AccessibleNode(Element*); |
33 virtual ~AccessibleNode(); | 48 virtual ~AccessibleNode(); |
34 | 49 |
35 // Returns the given string property if the Element has an AccessibleNode, | 50 // Returns the given string property if the Element has an AccessibleNode, |
36 // otherwise returns the equivalent ARIA attribute. | 51 // otherwise returns the equivalent ARIA attribute. |
37 static const AtomicString& getProperty(Element*, AOMStringProperty); | 52 static const AtomicString& getProperty(Element*, AOMStringProperty); |
38 | 53 |
| 54 AtomicString autocomplete() const; |
| 55 void setAutocomplete(const AtomicString&); |
| 56 |
| 57 AtomicString checked() const; |
| 58 void setChecked(const AtomicString&); |
| 59 |
| 60 AtomicString current() const; |
| 61 void setCurrent(const AtomicString&); |
| 62 |
| 63 AtomicString invalid() const; |
| 64 void setInvalid(const AtomicString&); |
| 65 |
| 66 AtomicString keyShortcuts() const; |
| 67 void setKeyShortcuts(const AtomicString&); |
| 68 |
| 69 AtomicString label() const; |
| 70 void setLabel(const AtomicString&); |
| 71 |
| 72 AtomicString live() const; |
| 73 void setLive(const AtomicString&); |
| 74 |
| 75 AtomicString orientation() const; |
| 76 void setOrientation(const AtomicString&); |
| 77 |
| 78 AtomicString placeholder() const; |
| 79 void setPlaceholder(const AtomicString&); |
| 80 |
| 81 AtomicString relevant() const; |
| 82 void setRelevant(const AtomicString&); |
| 83 |
39 AtomicString role() const; | 84 AtomicString role() const; |
40 void setRole(const AtomicString&); | 85 void setRole(const AtomicString&); |
41 | 86 |
42 AtomicString label() const; | 87 AtomicString roleDescription() const; |
43 void setLabel(const AtomicString&); | 88 void setRoleDescription(const AtomicString&); |
| 89 |
| 90 AtomicString sort() const; |
| 91 void setSort(const AtomicString&); |
| 92 |
| 93 AtomicString valueText() const; |
| 94 void setValueText(const AtomicString&); |
44 | 95 |
45 DECLARE_VIRTUAL_TRACE(); | 96 DECLARE_VIRTUAL_TRACE(); |
46 | 97 |
47 private: | 98 private: |
48 void setStringProperty(AOMStringProperty, const AtomicString&); | 99 void setStringProperty(AOMStringProperty, const AtomicString&); |
49 | 100 |
50 Vector<std::pair<AOMStringProperty, AtomicString>> m_stringProperties; | 101 Vector<std::pair<AOMStringProperty, AtomicString>> m_stringProperties; |
51 | 102 |
52 // This object's owner Element. | 103 // This object's owner Element. |
53 Member<Element> m_element; | 104 Member<Element> m_element; |
54 }; | 105 }; |
55 | 106 |
56 } // namespace blink | 107 } // namespace blink |
57 | 108 |
58 #endif // AccessibleNode_h | 109 #endif // AccessibleNode_h |
OLD | NEW |