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