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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/AccessibleNode.h
diff --git a/third_party/WebKit/Source/core/dom/AccessibleNode.h b/third_party/WebKit/Source/core/dom/AccessibleNode.h
new file mode 100644
index 0000000000000000000000000000000000000000..794c09da8281b17a70f5532ec801328e3109a20d
--- /dev/null
+++ b/third_party/WebKit/Source/core/dom/AccessibleNode.h
@@ -0,0 +1,70 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef AccessibleNode_h
+#define AccessibleNode_h
+
+#include "bindings/core/v8/ScriptWrappable.h"
+#include "core/CoreExport.h"
+#include "wtf/HashMap.h"
+#include "wtf/text/AtomicString.h"
+#include "wtf/text/AtomicStringHash.h"
+
+namespace blink {
+
+class Element;
+
+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.
+ 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.
+ Role,
+ Label,
+};
+
+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
+ static const bool emptyValueIsZero = false;
+ static AOMStringProperty emptyValue() { return AOMStringProperty::None; };
+ static void constructDeletedValue(AOMStringProperty& slot, bool) {
+ slot = AOMStringProperty::None;
+ }
+ static bool isDeletedValue(AOMStringProperty value) {
+ return value == AOMStringProperty::None;
+ }
+};
+
+// Accessibility Object Model node
+// Explainer: https://github.com/WICG/aom/blob/master/explainer.md
+// Spec: https://wicg.github.io/aom/spec/
+class CORE_EXPORT AccessibleNode
+ : public GarbageCollectedFinalized<AccessibleNode>,
+ public ScriptWrappable {
+ DEFINE_WRAPPERTYPEINFO();
+
+ public:
+ AccessibleNode(Element*);
+ virtual ~AccessibleNode();
+
+ const AtomicString& getProperty(AOMStringProperty) const;
+
+ String role() const;
+ void setRole(const String&);
+
+ String label() const;
+ void setLabel(const String&);
+
+ DECLARE_VIRTUAL_TRACE();
+
+ private:
+ HashMap<AOMStringProperty,
+ AtomicString,
+ WTF::IntHash<AOMStringProperty>,
+ AOMStringPropertyHashTraits>
+ m_stringProperties;
+
+ // This object's owner Element.
+ WeakMember<Element> m_element;
+};
+
+} // namespace blink
+
+#endif // AccessibleNode_h

Powered by Google App Engine
This is Rietveld 408576698