Chromium Code Reviews| Index: third_party/WebKit/Source/modules/accessibility/AccessibleNode.h |
| diff --git a/third_party/WebKit/Source/modules/accessibility/AccessibleNode.h b/third_party/WebKit/Source/modules/accessibility/AccessibleNode.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6f457a7374fe7a4e18f4223c447e5d8d0f30940a |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/modules/accessibility/AccessibleNode.h |
| @@ -0,0 +1,71 @@ |
| +// 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 "modules/ModulesExport.h" |
| +#include "wtf/HashMap.h" |
| +#include "wtf/text/AtomicString.h" |
| +#include "wtf/text/AtomicStringHash.h" |
| + |
| +namespace blink { |
| + |
| +class AXObject; |
| + |
| +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
|
| + None, |
| + Role, |
| + Label, |
| +}; |
| + |
| +struct AomStringPropertyHashTraits : WTF::GenericHashTraits<AomStringProperty> { |
| + 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 MODULES_EXPORT AccessibleNode |
| + : public GarbageCollectedFinalized<AccessibleNode>, |
| + public ScriptWrappable { |
| + DEFINE_WRAPPERTYPEINFO(); |
| + |
| + public: |
| + AccessibleNode(AXObject*); |
| + virtual ~AccessibleNode(); |
| + |
| + const AtomicString& getProperty(AomStringProperty) const; |
| + |
| + AXObject* getAXObject() { return m_axObject.get(); } |
| + |
| + 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; |
| + |
| + Member<AXObject> m_axObject; |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // AccessibleNode_h |