Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: third_party/WebKit/Source/core/dom/AccessibleNode.h

Issue 2750533006: Initial skeleton of Accessibility Object Model Phase 1 (Closed)
Patch Set: Add comment about ugly AXObjectCache interface Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 enum class AOMStringProperty {
esprehn 2017/03/22 03:40:31 What is an AOMStringProperty? Can you ad comments
dmazzoni 2017/03/23 03:36:40 Done.
19 None,
esprehn 2017/03/22 03:40:32 We've been prefixing with k for new ones.
dmazzoni 2017/03/23 03:36:40 Done.
20 Role,
21 Label,
22 };
23
24 struct AOMStringPropertyHashTraits : WTF::GenericHashTraits<AOMStringProperty> {
esprehn 2017/03/22 03:40:32 Can you explain why you need a custom hash config?
dmazzoni 2017/03/23 03:36:40 No longer needed as I switched to an array, as sug
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 CORE_EXPORT AccessibleNode
39 : public GarbageCollectedFinalized<AccessibleNode>,
40 public ScriptWrappable {
41 DEFINE_WRAPPERTYPEINFO();
42
43 public:
44 AccessibleNode(Element*);
45 virtual ~AccessibleNode();
46
47 const AtomicString& getProperty(AOMStringProperty) const;
48
49 String role() const;
50 void setRole(const String&);
51
52 String label() const;
53 void setLabel(const String&);
54
55 DECLARE_VIRTUAL_TRACE();
56
57 private:
58 HashMap<AOMStringProperty,
59 AtomicString,
60 WTF::IntHash<AOMStringProperty>,
61 AOMStringPropertyHashTraits>
62 m_stringProperties;
63
64 // This object's owner Element.
65 WeakMember<Element> m_element;
66 };
67
68 } // namespace blink
69
70 #endif // AccessibleNode_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698