| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef AccessibleNode_h | |
| 6 #define AccessibleNode_h | |
| 7 | |
| 8 #include "bindings/core/v8/ScriptWrappable.h" | |
| 9 #include "core/CoreExport.h" | |
| 10 #include "wtf/HashMap.h" | |
| 11 #include "wtf/text/AtomicString.h" | |
| 12 #include "wtf/text/AtomicStringHash.h" | |
| 13 | |
| 14 namespace blink { | |
| 15 | |
| 16 class Element; | |
| 17 | |
| 18 // All of the properties of AccessibleNode that have type "string". | |
| 19 // TODO(dmazzoni): Add similar enums for all of the properties with | |
| 20 // type bool, float, reference, and reference list. | |
| 21 enum class AOMStringProperty { kRole, kLabel }; | |
| 22 | |
| 23 // Accessibility Object Model node | |
| 24 // Explainer: https://github.com/WICG/aom/blob/master/explainer.md | |
| 25 // Spec: https://wicg.github.io/aom/spec/ | |
| 26 class CORE_EXPORT AccessibleNode | |
| 27 : public GarbageCollectedFinalized<AccessibleNode>, | |
| 28 public ScriptWrappable { | |
| 29 DEFINE_WRAPPERTYPEINFO(); | |
| 30 | |
| 31 public: | |
| 32 explicit AccessibleNode(Element*); | |
| 33 virtual ~AccessibleNode(); | |
| 34 | |
| 35 // Returns the given string property if the Element has an AccessibleNode, | |
| 36 // otherwise returns the equivalent ARIA attribute. | |
| 37 static const AtomicString& getProperty(Element*, AOMStringProperty); | |
| 38 | |
| 39 AtomicString role() const; | |
| 40 void setRole(const AtomicString&); | |
| 41 | |
| 42 AtomicString label() const; | |
| 43 void setLabel(const AtomicString&); | |
| 44 | |
| 45 DECLARE_VIRTUAL_TRACE(); | |
| 46 | |
| 47 private: | |
| 48 void setStringProperty(AOMStringProperty, const AtomicString&); | |
| 49 | |
| 50 Vector<std::pair<AOMStringProperty, AtomicString>> m_stringProperties; | |
| 51 | |
| 52 // This object's owner Element. | |
| 53 Member<Element> m_element; | |
| 54 }; | |
| 55 | |
| 56 } // namespace blink | |
| 57 | |
| 58 #endif // AccessibleNode_h | |
| OLD | NEW |