| Index: third_party/WebKit/Source/core/dom/AccessibleNode.cpp
|
| diff --git a/third_party/WebKit/Source/core/dom/AccessibleNode.cpp b/third_party/WebKit/Source/core/dom/AccessibleNode.cpp
|
| index 307d73fd1cb62ed5fcc906778643c6f6f9e1b6b0..ed11e656f4e392f99efb7b3ac623ea4b8bb26d51 100644
|
| --- a/third_party/WebKit/Source/core/dom/AccessibleNode.cpp
|
| +++ b/third_party/WebKit/Source/core/dom/AccessibleNode.cpp
|
| @@ -11,6 +11,8 @@
|
|
|
| namespace blink {
|
|
|
| +using namespace HTMLNames;
|
| +
|
| AccessibleNode::AccessibleNode(Element* element) : m_element(element) {
|
| DCHECK(RuntimeEnabledFeatures::accessibilityObjectModelEnabled());
|
| }
|
| @@ -32,27 +34,85 @@ const AtomicString& AccessibleNode::getProperty(Element* element,
|
|
|
| // Fall back on the equivalent ARIA attribute.
|
| switch (property) {
|
| - case AOMStringProperty::kRole:
|
| - return element->getAttribute(HTMLNames::roleAttr);
|
| + case AOMStringProperty::kAutocomplete:
|
| + return element->getAttribute(aria_autocompleteAttr);
|
| + case AOMStringProperty::kChecked:
|
| + return element->getAttribute(aria_checkedAttr);
|
| + case AOMStringProperty::kCurrent:
|
| + return element->getAttribute(aria_currentAttr);
|
| + case AOMStringProperty::kInvalid:
|
| + return element->getAttribute(aria_invalidAttr);
|
| + case AOMStringProperty::kKeyShortcuts:
|
| + return element->getAttribute(aria_keyshortcutsAttr);
|
| case AOMStringProperty::kLabel:
|
| - return element->getAttribute(HTMLNames::aria_labelAttr);
|
| - default:
|
| - NOTREACHED();
|
| - return nullAtom;
|
| + return element->getAttribute(aria_labelAttr);
|
| + case AOMStringProperty::kLive:
|
| + return element->getAttribute(aria_liveAttr);
|
| + case AOMStringProperty::kOrientation:
|
| + return element->getAttribute(aria_orientationAttr);
|
| + case AOMStringProperty::kPlaceholder:
|
| + return element->getAttribute(aria_placeholderAttr);
|
| + case AOMStringProperty::kRelevant:
|
| + return element->getAttribute(aria_relevantAttr);
|
| + case AOMStringProperty::kRole:
|
| + return element->getAttribute(roleAttr);
|
| + case AOMStringProperty::kRoleDescription:
|
| + return element->getAttribute(aria_roledescriptionAttr);
|
| + case AOMStringProperty::kSort:
|
| + return element->getAttribute(aria_sortAttr);
|
| + case AOMStringProperty::kValueText:
|
| + return element->getAttribute(aria_valuetextAttr);
|
| }
|
| +
|
| + NOTREACHED();
|
| + return nullAtom;
|
| }
|
|
|
| -AtomicString AccessibleNode::role() const {
|
| - return getProperty(m_element, AOMStringProperty::kRole);
|
| +AtomicString AccessibleNode::autocomplete() const {
|
| + return getProperty(m_element, AOMStringProperty::kAutocomplete);
|
| }
|
|
|
| -void AccessibleNode::setRole(const AtomicString& role) {
|
| - setStringProperty(AOMStringProperty::kRole, role);
|
| +void AccessibleNode::setAutocomplete(const AtomicString& autocomplete) {
|
| + setStringProperty(AOMStringProperty::kAutocomplete, autocomplete);
|
| + notifyAttributeChanged(aria_autocompleteAttr);
|
| +}
|
|
|
| - // TODO(dmazzoni): Make a cleaner API for this rather than pretending
|
| - // the DOM attribute changed.
|
| - if (AXObjectCache* cache = m_element->document().axObjectCache())
|
| - cache->handleAttributeChanged(HTMLNames::roleAttr, m_element);
|
| +AtomicString AccessibleNode::checked() const {
|
| + return getProperty(m_element, AOMStringProperty::kChecked);
|
| +}
|
| +
|
| +void AccessibleNode::setChecked(const AtomicString& checked) {
|
| + setStringProperty(AOMStringProperty::kChecked, checked);
|
| + notifyAttributeChanged(aria_checkedAttr);
|
| +}
|
| +
|
| +AtomicString AccessibleNode::current() const {
|
| + return getProperty(m_element, AOMStringProperty::kCurrent);
|
| +}
|
| +
|
| +void AccessibleNode::setCurrent(const AtomicString& current) {
|
| + setStringProperty(AOMStringProperty::kCurrent, current);
|
| +
|
| + if (AXObjectCache* cache = m_element->document().existingAXObjectCache())
|
| + cache->handleAttributeChanged(aria_currentAttr, m_element);
|
| +}
|
| +
|
| +AtomicString AccessibleNode::invalid() const {
|
| + return getProperty(m_element, AOMStringProperty::kInvalid);
|
| +}
|
| +
|
| +void AccessibleNode::setInvalid(const AtomicString& invalid) {
|
| + setStringProperty(AOMStringProperty::kInvalid, invalid);
|
| + notifyAttributeChanged(aria_invalidAttr);
|
| +}
|
| +
|
| +AtomicString AccessibleNode::keyShortcuts() const {
|
| + return getProperty(m_element, AOMStringProperty::kKeyShortcuts);
|
| +}
|
| +
|
| +void AccessibleNode::setKeyShortcuts(const AtomicString& keyShortcuts) {
|
| + setStringProperty(AOMStringProperty::kKeyShortcuts, keyShortcuts);
|
| + notifyAttributeChanged(aria_keyshortcutsAttr);
|
| }
|
|
|
| AtomicString AccessibleNode::label() const {
|
| @@ -61,9 +121,79 @@ AtomicString AccessibleNode::label() const {
|
|
|
| void AccessibleNode::setLabel(const AtomicString& label) {
|
| setStringProperty(AOMStringProperty::kLabel, label);
|
| + notifyAttributeChanged(aria_labelAttr);
|
| +}
|
| +
|
| +AtomicString AccessibleNode::live() const {
|
| + return getProperty(m_element, AOMStringProperty::kLive);
|
| +}
|
| +
|
| +void AccessibleNode::setLive(const AtomicString& live) {
|
| + setStringProperty(AOMStringProperty::kLive, live);
|
| + notifyAttributeChanged(aria_liveAttr);
|
| +}
|
| +
|
| +AtomicString AccessibleNode::orientation() const {
|
| + return getProperty(m_element, AOMStringProperty::kOrientation);
|
| +}
|
|
|
| - if (AXObjectCache* cache = m_element->document().axObjectCache())
|
| - cache->handleAttributeChanged(HTMLNames::aria_labelAttr, m_element);
|
| +void AccessibleNode::setOrientation(const AtomicString& orientation) {
|
| + setStringProperty(AOMStringProperty::kOrientation, orientation);
|
| + notifyAttributeChanged(aria_orientationAttr);
|
| +}
|
| +
|
| +AtomicString AccessibleNode::placeholder() const {
|
| + return getProperty(m_element, AOMStringProperty::kPlaceholder);
|
| +}
|
| +
|
| +void AccessibleNode::setPlaceholder(const AtomicString& placeholder) {
|
| + setStringProperty(AOMStringProperty::kPlaceholder, placeholder);
|
| + notifyAttributeChanged(aria_placeholderAttr);
|
| +}
|
| +
|
| +AtomicString AccessibleNode::relevant() const {
|
| + return getProperty(m_element, AOMStringProperty::kRelevant);
|
| +}
|
| +
|
| +void AccessibleNode::setRelevant(const AtomicString& relevant) {
|
| + setStringProperty(AOMStringProperty::kRelevant, relevant);
|
| + notifyAttributeChanged(aria_relevantAttr);
|
| +}
|
| +
|
| +AtomicString AccessibleNode::role() const {
|
| + return getProperty(m_element, AOMStringProperty::kRole);
|
| +}
|
| +
|
| +void AccessibleNode::setRole(const AtomicString& role) {
|
| + setStringProperty(AOMStringProperty::kRole, role);
|
| + notifyAttributeChanged(roleAttr);
|
| +}
|
| +
|
| +AtomicString AccessibleNode::roleDescription() const {
|
| + return getProperty(m_element, AOMStringProperty::kRoleDescription);
|
| +}
|
| +
|
| +void AccessibleNode::setRoleDescription(const AtomicString& roleDescription) {
|
| + setStringProperty(AOMStringProperty::kRoleDescription, roleDescription);
|
| + notifyAttributeChanged(aria_roledescriptionAttr);
|
| +}
|
| +
|
| +AtomicString AccessibleNode::sort() const {
|
| + return getProperty(m_element, AOMStringProperty::kSort);
|
| +}
|
| +
|
| +void AccessibleNode::setSort(const AtomicString& sort) {
|
| + setStringProperty(AOMStringProperty::kSort, sort);
|
| + notifyAttributeChanged(aria_sortAttr);
|
| +}
|
| +
|
| +AtomicString AccessibleNode::valueText() const {
|
| + return getProperty(m_element, AOMStringProperty::kValueText);
|
| +}
|
| +
|
| +void AccessibleNode::setValueText(const AtomicString& valueText) {
|
| + setStringProperty(AOMStringProperty::kValueText, valueText);
|
| + notifyAttributeChanged(aria_valuetextAttr);
|
| }
|
|
|
| void AccessibleNode::setStringProperty(AOMStringProperty property,
|
| @@ -78,6 +208,18 @@ void AccessibleNode::setStringProperty(AOMStringProperty property,
|
| m_stringProperties.push_back(std::make_pair(property, value));
|
| }
|
|
|
| +void AccessibleNode::notifyAttributeChanged(
|
| + const blink::QualifiedName& attribute) {
|
| + // TODO(dmazzoni): Make a cleaner API for this rather than pretending
|
| + // the DOM attribute changed.
|
| + if (AXObjectCache* cache = getAXObjectCache())
|
| + cache->handleAttributeChanged(attribute, m_element);
|
| +}
|
| +
|
| +AXObjectCache* AccessibleNode::getAXObjectCache() {
|
| + return m_element->document().existingAXObjectCache();
|
| +}
|
| +
|
| DEFINE_TRACE(AccessibleNode) {
|
| visitor->trace(m_element);
|
| }
|
|
|