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

Unified Diff: third_party/WebKit/Source/core/dom/AccessibleNode.h

Issue 2750533006: Initial skeleton of Accessibility Object Model Phase 1 (Closed)
Patch Set: Address feedback 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..c82fc80fe57fccfc19af2cbb0b3165ea3e99ba6b
--- /dev/null
+++ b/third_party/WebKit/Source/core/dom/AccessibleNode.h
@@ -0,0 +1,60 @@
+// 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;
+
+// All of the properties of AccessibleNode that have type "string".
+// TODO(dmazzoni): Add similar enums for all of the properties with
+// type bool, float, reference, and reference list.
+enum class AOMStringProperty { kFirst, kRole = kFirst, kLabel, kCount };
+
+const unsigned kAOMStringPropertyCount =
+ static_cast<unsigned>(AOMStringProperty::kCount);
+
+// 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:
+ explicit AccessibleNode(Element*);
+ virtual ~AccessibleNode();
+
+ // Returns the given string property if the Element has an AccessibleNode,
+ // otherwise returns the equivalent ARIA attribute.
+ static const AtomicString& getProperty(Element*, AOMStringProperty);
+
+ AtomicString role() const;
+ void setRole(const AtomicString&);
+
+ AtomicString label() const;
+ void setLabel(const AtomicString&);
+
+ DECLARE_VIRTUAL_TRACE();
+
+ private:
+ AtomicString m_stringProperties[kAOMStringPropertyCount];
esprehn 2017/03/24 01:59:39 fwiw I was actually suggesting using a Vector of p
dmazzoni 2017/03/24 17:51:12 Oh good, I like that better. Do you see anyone el
+ bool m_stringPropertyDirty[kAOMStringPropertyCount] = {false};
esprehn 2017/03/24 01:59:39 I think you want a std::bitset ? I don't think yo
aboxhall 2017/03/24 02:17:51 We want this to work equivalently to value, where
dmazzoni 2017/03/24 17:51:12 Now that I'm using a vector of pairs, we can simpl
+
+ // This object's owner Element.
+ WeakMember<Element> m_element;
+};
+
+} // namespace blink
+
+#endif // AccessibleNode_h

Powered by Google App Engine
This is Rietveld 408576698