| 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
|
| index 709f7876498957ca8b236e5ce3b1c0458f396f88..aacad2d363c01a88171aae06b3158e517a137a50 100644
|
| --- a/third_party/WebKit/Source/core/dom/AccessibleNode.h
|
| +++ b/third_party/WebKit/Source/core/dom/AccessibleNode.h
|
| @@ -6,8 +6,10 @@
|
| #define AccessibleNode_h
|
|
|
| #include "core/CoreExport.h"
|
| +#include "core/dom/QualifiedName.h"
|
| #include "platform/bindings/ScriptWrappable.h"
|
| #include "platform/wtf/HashMap.h"
|
| +#include "platform/wtf/HashSet.h"
|
| #include "platform/wtf/text/AtomicString.h"
|
| #include "platform/wtf/text/AtomicStringHash.h"
|
|
|
| @@ -18,8 +20,6 @@ class Element;
|
| class QualifiedName;
|
|
|
| // 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 {
|
| kAutocomplete,
|
| kChecked,
|
| @@ -63,6 +63,12 @@ enum class AOMUIntProperty {
|
| kRowSpan,
|
| };
|
|
|
| +enum class AOMRelationProperty {
|
| + kActiveDescendant,
|
| + kDetails,
|
| + kErrorMessage,
|
| +};
|
| +
|
| // All of the properties of AccessibleNode that have a signed integer type.
|
| // (These all allow the value -1.)
|
| enum class AOMIntProperty { kColCount, kRowCount, kSetSize };
|
| @@ -70,6 +76,19 @@ enum class AOMIntProperty { kColCount, kRowCount, kSetSize };
|
| // All of the properties of AccessibleNode that have a floating-point type.
|
| enum class AOMFloatProperty { kValueMax, kValueMin, kValueNow };
|
|
|
| +class AccessibleNode;
|
| +
|
| +class CORE_EXPORT AOMPropertyClient {
|
| + public:
|
| + virtual void AddStringProperty(AOMStringProperty, const String&) = 0;
|
| + virtual void AddBooleanProperty(AOMBooleanProperty, bool) = 0;
|
| + virtual void AddIntProperty(AOMIntProperty, int32_t) = 0;
|
| + virtual void AddUIntProperty(AOMUIntProperty, uint32_t) = 0;
|
| + virtual void AddFloatProperty(AOMFloatProperty, float) = 0;
|
| + virtual void AddRelationProperty(AOMRelationProperty,
|
| + const AccessibleNode&) = 0;
|
| +};
|
| +
|
| // Accessibility Object Model node
|
| // Explainer: https://github.com/WICG/aom/blob/master/explainer.md
|
| // Spec: https://wicg.github.io/aom/spec/
|
| @@ -82,9 +101,15 @@ class CORE_EXPORT AccessibleNode
|
| explicit AccessibleNode(Element*);
|
| virtual ~AccessibleNode();
|
|
|
| + // Gets the associated element, if any.
|
| + Element* element() const { return element_; }
|
| +
|
| // Returns the given string property if the Element has an AccessibleNode.
|
| static const AtomicString& GetProperty(Element*, AOMStringProperty);
|
|
|
| + // Returns the given relation property if the Element has an AccessibleNode.
|
| + static AccessibleNode* GetProperty(Element*, AOMRelationProperty);
|
| +
|
| // Returns the value of the given property if the
|
| // Element has an AccessibleNode. Sets |isNull| if the property and
|
| // attribute are not present.
|
| @@ -99,6 +124,11 @@ class CORE_EXPORT AccessibleNode
|
| static const AtomicString& GetPropertyOrARIAAttribute(Element*,
|
| AOMStringProperty);
|
|
|
| + // Returns the given relation property if the Element has an AccessibleNode,
|
| + // otherwise returns the equivalent ARIA attribute.
|
| + static AccessibleNode* GetPropertyOrARIAAttribute(Element*,
|
| + AOMRelationProperty);
|
| +
|
| // Returns the value of the given property if the
|
| // Element has an AccessibleNode, otherwise returns the equivalent
|
| // ARIA attribute. Sets |isNull| if the property and attribute are not
|
| @@ -116,6 +146,18 @@ class CORE_EXPORT AccessibleNode
|
| AOMUIntProperty,
|
| bool& is_null);
|
|
|
| + // Iterates over all AOM properties. For each one, calls AOMPropertyClient
|
| + // with the value of the AOM property if set. Updates
|
| + // |shadowed_aria_attributes| to contain a list of the ARIA attributes that
|
| + // would be shadowed by these AOM properties.
|
| + static void GetAllAOMProperties(
|
| + Element*,
|
| + AOMPropertyClient*,
|
| + HashSet<QualifiedName>& shadowed_aria_attributes);
|
| +
|
| + AccessibleNode* activeDescendant() const;
|
| + void setActiveDescendant(AccessibleNode*);
|
| +
|
| bool atomic(bool& is_null) const;
|
| void setAtomic(bool, bool is_null);
|
|
|
| @@ -140,9 +182,15 @@ class CORE_EXPORT AccessibleNode
|
| AtomicString current() const;
|
| void setCurrent(const AtomicString&);
|
|
|
| + AccessibleNode* details() const;
|
| + void setDetails(AccessibleNode*);
|
| +
|
| bool disabled(bool& is_null) const;
|
| void setDisabled(bool, bool is_null);
|
|
|
| + AccessibleNode* errorMessage() const;
|
| + void setErrorMessage(AccessibleNode*);
|
| +
|
| bool expanded(bool& is_null) const;
|
| void setExpanded(bool, bool is_null);
|
|
|
| @@ -234,6 +282,7 @@ class CORE_EXPORT AccessibleNode
|
|
|
| private:
|
| void SetStringProperty(AOMStringProperty, const AtomicString&);
|
| + void SetRelationProperty(AOMRelationProperty, AccessibleNode*);
|
| void SetBooleanProperty(AOMBooleanProperty, bool value, bool is_null);
|
| void SetFloatProperty(AOMFloatProperty, float value, bool is_null);
|
| void SetUIntProperty(AOMUIntProperty, uint32_t value, bool is_null);
|
| @@ -246,6 +295,8 @@ class CORE_EXPORT AccessibleNode
|
| Vector<std::pair<AOMFloatProperty, float>> float_properties_;
|
| Vector<std::pair<AOMIntProperty, int32_t>> int_properties_;
|
| Vector<std::pair<AOMUIntProperty, uint32_t>> uint_properties_;
|
| + HeapVector<std::pair<AOMRelationProperty, Member<AccessibleNode>>>
|
| + relation_properties_;
|
|
|
| // This object's owner Element.
|
| Member<Element> element_;
|
|
|