| 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 ed11e656f4e392f99efb7b3ac623ea4b8bb26d51..577ea77b80be864e915a3ce5328d715d38d90521 100644
|
| --- a/third_party/WebKit/Source/core/dom/AccessibleNode.cpp
|
| +++ b/third_party/WebKit/Source/core/dom/AccessibleNode.cpp
|
| @@ -35,39 +35,110 @@ const AtomicString& AccessibleNode::getProperty(Element* element,
|
| // Fall back on the equivalent ARIA attribute.
|
| switch (property) {
|
| case AOMStringProperty::kAutocomplete:
|
| - return element->getAttribute(aria_autocompleteAttr);
|
| + return element->fastGetAttribute(aria_autocompleteAttr);
|
| case AOMStringProperty::kChecked:
|
| - return element->getAttribute(aria_checkedAttr);
|
| + return element->fastGetAttribute(aria_checkedAttr);
|
| case AOMStringProperty::kCurrent:
|
| - return element->getAttribute(aria_currentAttr);
|
| + return element->fastGetAttribute(aria_currentAttr);
|
| case AOMStringProperty::kInvalid:
|
| - return element->getAttribute(aria_invalidAttr);
|
| + return element->fastGetAttribute(aria_invalidAttr);
|
| case AOMStringProperty::kKeyShortcuts:
|
| - return element->getAttribute(aria_keyshortcutsAttr);
|
| + return element->fastGetAttribute(aria_keyshortcutsAttr);
|
| case AOMStringProperty::kLabel:
|
| - return element->getAttribute(aria_labelAttr);
|
| + return element->fastGetAttribute(aria_labelAttr);
|
| case AOMStringProperty::kLive:
|
| - return element->getAttribute(aria_liveAttr);
|
| + return element->fastGetAttribute(aria_liveAttr);
|
| case AOMStringProperty::kOrientation:
|
| - return element->getAttribute(aria_orientationAttr);
|
| + return element->fastGetAttribute(aria_orientationAttr);
|
| case AOMStringProperty::kPlaceholder:
|
| - return element->getAttribute(aria_placeholderAttr);
|
| + return element->fastGetAttribute(aria_placeholderAttr);
|
| case AOMStringProperty::kRelevant:
|
| - return element->getAttribute(aria_relevantAttr);
|
| + return element->fastGetAttribute(aria_relevantAttr);
|
| case AOMStringProperty::kRole:
|
| - return element->getAttribute(roleAttr);
|
| + return element->fastGetAttribute(roleAttr);
|
| case AOMStringProperty::kRoleDescription:
|
| - return element->getAttribute(aria_roledescriptionAttr);
|
| + return element->fastGetAttribute(aria_roledescriptionAttr);
|
| case AOMStringProperty::kSort:
|
| - return element->getAttribute(aria_sortAttr);
|
| + return element->fastGetAttribute(aria_sortAttr);
|
| case AOMStringProperty::kValueText:
|
| - return element->getAttribute(aria_valuetextAttr);
|
| + return element->fastGetAttribute(aria_valuetextAttr);
|
| }
|
|
|
| NOTREACHED();
|
| return nullAtom;
|
| }
|
|
|
| +// static
|
| +bool AccessibleNode::getProperty(Element* element,
|
| + AOMBooleanProperty property,
|
| + bool& isNull) {
|
| + isNull = true;
|
| + if (!element)
|
| + return false;
|
| +
|
| + if (AccessibleNode* accessibleNode = element->existingAccessibleNode()) {
|
| + for (const auto& item : accessibleNode->m_booleanProperties) {
|
| + if (item.first == property) {
|
| + isNull = false;
|
| + return item.second;
|
| + }
|
| + }
|
| + }
|
| +
|
| + // Fall back on the equivalent ARIA attribute.
|
| + AtomicString attrValue;
|
| + switch (property) {
|
| + case AOMBooleanProperty::kAtomic:
|
| + attrValue = element->fastGetAttribute(aria_atomicAttr);
|
| + break;
|
| + case AOMBooleanProperty::kBusy:
|
| + attrValue = element->fastGetAttribute(aria_busyAttr);
|
| + break;
|
| + case AOMBooleanProperty::kDisabled:
|
| + attrValue = element->fastGetAttribute(aria_disabledAttr);
|
| + break;
|
| + case AOMBooleanProperty::kExpanded:
|
| + attrValue = element->fastGetAttribute(aria_expandedAttr);
|
| + break;
|
| + case AOMBooleanProperty::kHidden:
|
| + attrValue = element->fastGetAttribute(aria_hiddenAttr);
|
| + break;
|
| + case AOMBooleanProperty::kModal:
|
| + attrValue = element->fastGetAttribute(aria_modalAttr);
|
| + break;
|
| + case AOMBooleanProperty::kMultiline:
|
| + attrValue = element->fastGetAttribute(aria_multilineAttr);
|
| + break;
|
| + case AOMBooleanProperty::kMultiselectable:
|
| + attrValue = element->fastGetAttribute(aria_multiselectableAttr);
|
| + break;
|
| + case AOMBooleanProperty::kReadOnly:
|
| + attrValue = element->fastGetAttribute(aria_readonlyAttr);
|
| + break;
|
| + case AOMBooleanProperty::kRequired:
|
| + attrValue = element->fastGetAttribute(aria_requiredAttr);
|
| + break;
|
| + case AOMBooleanProperty::kSelected:
|
| + attrValue = element->fastGetAttribute(aria_selectedAttr);
|
| + break;
|
| + }
|
| +
|
| + if (attrValue.isNull())
|
| + return false;
|
| +
|
| + isNull = false;
|
| + return equalIgnoringASCIICase(attrValue, "true");
|
| +}
|
| +
|
| +bool AccessibleNode::atomic(bool& isNull) const {
|
| + return getProperty(m_element, AOMBooleanProperty::kAtomic, isNull);
|
| +}
|
| +
|
| +void AccessibleNode::setAtomic(bool atomic) {
|
| + setBooleanProperty(AOMBooleanProperty::kAtomic, atomic);
|
| + notifyAttributeChanged(aria_atomicAttr);
|
| +}
|
| +
|
| AtomicString AccessibleNode::autocomplete() const {
|
| return getProperty(m_element, AOMStringProperty::kAutocomplete);
|
| }
|
| @@ -77,6 +148,15 @@ void AccessibleNode::setAutocomplete(const AtomicString& autocomplete) {
|
| notifyAttributeChanged(aria_autocompleteAttr);
|
| }
|
|
|
| +bool AccessibleNode::busy(bool& isNull) const {
|
| + return getProperty(m_element, AOMBooleanProperty::kBusy, isNull);
|
| +}
|
| +
|
| +void AccessibleNode::setBusy(bool busy) {
|
| + setBooleanProperty(AOMBooleanProperty::kBusy, busy);
|
| + notifyAttributeChanged(aria_busyAttr);
|
| +}
|
| +
|
| AtomicString AccessibleNode::checked() const {
|
| return getProperty(m_element, AOMStringProperty::kChecked);
|
| }
|
| @@ -97,6 +177,33 @@ void AccessibleNode::setCurrent(const AtomicString& current) {
|
| cache->handleAttributeChanged(aria_currentAttr, m_element);
|
| }
|
|
|
| +bool AccessibleNode::disabled(bool& isNull) const {
|
| + return getProperty(m_element, AOMBooleanProperty::kDisabled, isNull);
|
| +}
|
| +
|
| +void AccessibleNode::setDisabled(bool disabled) {
|
| + setBooleanProperty(AOMBooleanProperty::kDisabled, disabled);
|
| + notifyAttributeChanged(aria_disabledAttr);
|
| +}
|
| +
|
| +bool AccessibleNode::expanded(bool& isNull) const {
|
| + return getProperty(m_element, AOMBooleanProperty::kExpanded, isNull);
|
| +}
|
| +
|
| +void AccessibleNode::setExpanded(bool expanded) {
|
| + setBooleanProperty(AOMBooleanProperty::kExpanded, expanded);
|
| + notifyAttributeChanged(aria_expandedAttr);
|
| +}
|
| +
|
| +bool AccessibleNode::hidden(bool& isNull) const {
|
| + return getProperty(m_element, AOMBooleanProperty::kHidden, isNull);
|
| +}
|
| +
|
| +void AccessibleNode::setHidden(bool hidden) {
|
| + setBooleanProperty(AOMBooleanProperty::kHidden, hidden);
|
| + notifyAttributeChanged(aria_hiddenAttr);
|
| +}
|
| +
|
| AtomicString AccessibleNode::invalid() const {
|
| return getProperty(m_element, AOMStringProperty::kInvalid);
|
| }
|
| @@ -133,6 +240,33 @@ void AccessibleNode::setLive(const AtomicString& live) {
|
| notifyAttributeChanged(aria_liveAttr);
|
| }
|
|
|
| +bool AccessibleNode::modal(bool& isNull) const {
|
| + return getProperty(m_element, AOMBooleanProperty::kModal, isNull);
|
| +}
|
| +
|
| +void AccessibleNode::setModal(bool modal) {
|
| + setBooleanProperty(AOMBooleanProperty::kModal, modal);
|
| + notifyAttributeChanged(aria_modalAttr);
|
| +}
|
| +
|
| +bool AccessibleNode::multiline(bool& isNull) const {
|
| + return getProperty(m_element, AOMBooleanProperty::kMultiline, isNull);
|
| +}
|
| +
|
| +void AccessibleNode::setMultiline(bool multiline) {
|
| + setBooleanProperty(AOMBooleanProperty::kMultiline, multiline);
|
| + notifyAttributeChanged(aria_multilineAttr);
|
| +}
|
| +
|
| +bool AccessibleNode::multiselectable(bool& isNull) const {
|
| + return getProperty(m_element, AOMBooleanProperty::kMultiselectable, isNull);
|
| +}
|
| +
|
| +void AccessibleNode::setMultiselectable(bool multiselectable) {
|
| + setBooleanProperty(AOMBooleanProperty::kMultiselectable, multiselectable);
|
| + notifyAttributeChanged(aria_multiselectableAttr);
|
| +}
|
| +
|
| AtomicString AccessibleNode::orientation() const {
|
| return getProperty(m_element, AOMStringProperty::kOrientation);
|
| }
|
| @@ -151,6 +285,15 @@ void AccessibleNode::setPlaceholder(const AtomicString& placeholder) {
|
| notifyAttributeChanged(aria_placeholderAttr);
|
| }
|
|
|
| +bool AccessibleNode::readOnly(bool& isNull) const {
|
| + return getProperty(m_element, AOMBooleanProperty::kReadOnly, isNull);
|
| +}
|
| +
|
| +void AccessibleNode::setReadOnly(bool readOnly) {
|
| + setBooleanProperty(AOMBooleanProperty::kReadOnly, readOnly);
|
| + notifyAttributeChanged(aria_readonlyAttr);
|
| +}
|
| +
|
| AtomicString AccessibleNode::relevant() const {
|
| return getProperty(m_element, AOMStringProperty::kRelevant);
|
| }
|
| @@ -160,6 +303,15 @@ void AccessibleNode::setRelevant(const AtomicString& relevant) {
|
| notifyAttributeChanged(aria_relevantAttr);
|
| }
|
|
|
| +bool AccessibleNode::required(bool& isNull) const {
|
| + return getProperty(m_element, AOMBooleanProperty::kRequired, isNull);
|
| +}
|
| +
|
| +void AccessibleNode::setRequired(bool required) {
|
| + setBooleanProperty(AOMBooleanProperty::kRequired, required);
|
| + notifyAttributeChanged(aria_requiredAttr);
|
| +}
|
| +
|
| AtomicString AccessibleNode::role() const {
|
| return getProperty(m_element, AOMStringProperty::kRole);
|
| }
|
| @@ -178,6 +330,15 @@ void AccessibleNode::setRoleDescription(const AtomicString& roleDescription) {
|
| notifyAttributeChanged(aria_roledescriptionAttr);
|
| }
|
|
|
| +bool AccessibleNode::selected(bool& isNull) const {
|
| + return getProperty(m_element, AOMBooleanProperty::kSelected, isNull);
|
| +}
|
| +
|
| +void AccessibleNode::setSelected(bool selected) {
|
| + setBooleanProperty(AOMBooleanProperty::kSelected, selected);
|
| + notifyAttributeChanged(aria_selectedAttr);
|
| +}
|
| +
|
| AtomicString AccessibleNode::sort() const {
|
| return getProperty(m_element, AOMStringProperty::kSort);
|
| }
|
| @@ -208,6 +369,18 @@ void AccessibleNode::setStringProperty(AOMStringProperty property,
|
| m_stringProperties.push_back(std::make_pair(property, value));
|
| }
|
|
|
| +void AccessibleNode::setBooleanProperty(AOMBooleanProperty property,
|
| + bool value) {
|
| + for (auto& item : m_booleanProperties) {
|
| + if (item.first == property) {
|
| + item.second = value;
|
| + return;
|
| + }
|
| + }
|
| +
|
| + m_booleanProperties.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
|
|
|