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

Unified Diff: third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp

Issue 2805493002: Boolean properties for Accessibility Object Model Phase 1 (Closed)
Patch Set: Created 3 years, 8 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/modules/accessibility/AXNodeObject.cpp
diff --git a/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp b/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp
index 26298b2f98b7badcdcd664b7aff30e60428daf91..029e1989e8b14db502afd4b21dd8f8e24f2babb2 100644
--- a/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp
+++ b/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp
@@ -300,7 +300,7 @@ bool AXNodeObject::computeAccessibilityIsIgnored(
Element* element = getNode()->isElementNode() ? toElement(getNode())
: getNode()->parentElement();
if (!getLayoutObject() && (!element || !element->isInCanvasSubtree()) &&
- !equalIgnoringASCIICase(getAttribute(aria_hiddenAttr), "false")) {
+ !AOMPropertyOrARIAAttributeIsFalse(AOMBooleanProperty::kHidden)) {
if (ignoredReasons)
ignoredReasons->push_back(IgnoredReason(AXNotRendered));
return true;
@@ -1042,12 +1042,11 @@ bool AXNodeObject::isMeter() const {
}
bool AXNodeObject::isMultiSelectable() const {
- const AtomicString& ariaMultiSelectable =
- getAttribute(aria_multiselectableAttr);
- if (equalIgnoringASCIICase(ariaMultiSelectable, "true"))
- return true;
- if (equalIgnoringASCIICase(ariaMultiSelectable, "false"))
- return false;
+ bool multiselectable = false;
+ if (getAOMPropertyOrARIAAttribute(AOMBooleanProperty::kMultiselectable,
+ multiselectable)) {
+ return multiselectable;
+ }
return isHTMLSelectElement(getNode()) &&
toHTMLSelectElement(*getNode()).isMultiple();
@@ -1210,11 +1209,10 @@ AccessibilityExpanded AXNodeObject::isExpanded() const {
: ExpandedCollapsed;
}
- const AtomicString& expanded = getAttribute(aria_expandedAttr);
- if (equalIgnoringASCIICase(expanded, "true"))
- return ExpandedExpanded;
- if (equalIgnoringASCIICase(expanded, "false"))
- return ExpandedCollapsed;
+ bool expanded = false;
+ if (getAOMPropertyOrARIAAttribute(AOMBooleanProperty::kExpanded, expanded)) {
+ return expanded ? ExpandedExpanded : ExpandedCollapsed;
+ }
return ExpandedUndefined;
}
@@ -1223,13 +1221,9 @@ bool AXNodeObject::isModal() const {
if (roleValue() != DialogRole && roleValue() != AlertDialogRole)
return false;
- if (hasAttribute(aria_modalAttr)) {
- const AtomicString& modal = getAttribute(aria_modalAttr);
- if (equalIgnoringASCIICase(modal, "true"))
- return true;
- if (equalIgnoringASCIICase(modal, "false"))
- return false;
- }
+ bool modal = false;
+ if (getAOMPropertyOrARIAAttribute(AOMBooleanProperty::kModal, modal))
+ return modal;
if (getNode() && isHTMLDialogElement(*getNode()))
return toElement(getNode())->isInTopLayer();
@@ -1280,7 +1274,7 @@ bool AXNodeObject::isRequired() const {
hasAttribute(requiredAttr))
return toHTMLFormControlElement(n)->isRequired();
- if (equalIgnoringASCIICase(getAttribute(aria_requiredAttr), "true"))
+ if (AOMPropertyOrARIAAttributeIsTrue(AOMBooleanProperty::kRequired))
return true;
return false;
@@ -1310,7 +1304,7 @@ bool AXNodeObject::canSetFocusAttribute() const {
}
bool AXNodeObject::canSetValueAttribute() const {
- if (equalIgnoringASCIICase(getAttribute(aria_readonlyAttr), "true"))
+ if (AOMPropertyOrARIAAttributeIsTrue(AOMBooleanProperty::kReadOnly))
return false;
if (isProgressIndicator() || isSlider())
@@ -1997,7 +1991,7 @@ String AXNodeObject::textFromDescendants(AXObjectSet& visited,
// true if any ancestor is hidden, but we need to be able to compute the
// accessible name of object inside hidden subtrees (for example, if
// aria-labelledby points to an object that's hidden).
- if (equalIgnoringASCIICase(child->getAttribute(aria_hiddenAttr), "true"))
+ if (child->AOMPropertyOrARIAAttributeIsTrue(AOMBooleanProperty::kHidden))
continue;
// If we're going between two layoutObjects that are in separate

Powered by Google App Engine
This is Rietveld 408576698