Chromium Code Reviews| 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 "modules/ModulesExport.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 AXObject; | |
| 17 | |
| 18 enum class AomStringProperty { | |
|
aboxhall
2017/03/16 05:49:34
I think the standard style is to capitalise all of
dmazzoni
2017/03/16 20:43:16
Changed throughout
| |
| 19 None, | |
| 20 Role, | |
| 21 Label, | |
| 22 }; | |
| 23 | |
| 24 struct AomStringPropertyHashTraits : WTF::GenericHashTraits<AomStringProperty> { | |
| 25 static const bool emptyValueIsZero = false; | |
| 26 static AomStringProperty emptyValue() { return AomStringProperty::None; }; | |
| 27 static void constructDeletedValue(AomStringProperty& slot, bool) { | |
| 28 slot = AomStringProperty::None; | |
| 29 } | |
| 30 static bool isDeletedValue(AomStringProperty value) { | |
| 31 return value == AomStringProperty::None; | |
| 32 } | |
| 33 }; | |
| 34 | |
| 35 // Accessibility Object Model node | |
| 36 // Explainer: https://github.com/WICG/aom/blob/master/explainer.md | |
| 37 // Spec: https://wicg.github.io/aom/spec/ | |
| 38 class MODULES_EXPORT AccessibleNode | |
| 39 : public GarbageCollectedFinalized<AccessibleNode>, | |
| 40 public ScriptWrappable { | |
| 41 DEFINE_WRAPPERTYPEINFO(); | |
| 42 | |
| 43 public: | |
| 44 AccessibleNode(AXObject*); | |
| 45 virtual ~AccessibleNode(); | |
| 46 | |
| 47 const AtomicString& getProperty(AomStringProperty) const; | |
| 48 | |
| 49 AXObject* getAXObject() { return m_axObject.get(); } | |
| 50 | |
| 51 String role() const; | |
| 52 void setRole(const String&); | |
| 53 | |
| 54 String label() const; | |
| 55 void setLabel(const String&); | |
| 56 | |
| 57 DECLARE_VIRTUAL_TRACE(); | |
| 58 | |
| 59 private: | |
| 60 HashMap<AomStringProperty, | |
| 61 AtomicString, | |
| 62 WTF::IntHash<AomStringProperty>, | |
| 63 AomStringPropertyHashTraits> | |
| 64 m_stringProperties; | |
| 65 | |
| 66 Member<AXObject> m_axObject; | |
| 67 }; | |
| 68 | |
| 69 } // namespace blink | |
| 70 | |
| 71 #endif // AccessibleNode_h | |
| OLD | NEW |