| 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 { kFirst, kRole = kFirst, kLabel, kCount }; |
| 22 |
| 23 const unsigned kAOMStringPropertyCount = |
| 24 static_cast<unsigned>(AOMStringProperty::kCount); |
| 25 |
| 26 // Accessibility Object Model node |
| 27 // Explainer: https://github.com/WICG/aom/blob/master/explainer.md |
| 28 // Spec: https://wicg.github.io/aom/spec/ |
| 29 class CORE_EXPORT AccessibleNode |
| 30 : public GarbageCollectedFinalized<AccessibleNode>, |
| 31 public ScriptWrappable { |
| 32 DEFINE_WRAPPERTYPEINFO(); |
| 33 |
| 34 public: |
| 35 explicit AccessibleNode(Element*); |
| 36 virtual ~AccessibleNode(); |
| 37 |
| 38 // Returns the given string property if the Element has an AccessibleNode, |
| 39 // otherwise returns the equivalent ARIA attribute. |
| 40 static const AtomicString& getProperty(Element*, AOMStringProperty); |
| 41 |
| 42 AtomicString role() const; |
| 43 void setRole(const AtomicString&); |
| 44 |
| 45 AtomicString label() const; |
| 46 void setLabel(const AtomicString&); |
| 47 |
| 48 DECLARE_VIRTUAL_TRACE(); |
| 49 |
| 50 private: |
| 51 void setStringProperty(AOMStringProperty, const AtomicString&); |
| 52 |
| 53 Vector<std::pair<AOMStringProperty, AtomicString>> m_stringProperties; |
| 54 |
| 55 // This object's owner Element. |
| 56 WeakMember<Element> m_element; |
| 57 }; |
| 58 |
| 59 } // namespace blink |
| 60 |
| 61 #endif // AccessibleNode_h |
| OLD | NEW |