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

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

Issue 2791943002: Re-land: Initial skeleton of Accessibility Object Model Phase 1 (Closed)
Patch Set: Fix for crash with test Created 3 years, 9 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/AXObject.cpp
diff --git a/third_party/WebKit/Source/modules/accessibility/AXObject.cpp b/third_party/WebKit/Source/modules/accessibility/AXObject.cpp
index 1671402dcd5fb2400ead7a92e9c4bf9a26b00e83..ace38e51f555c17a2f21657d599dc3c88ddebcbb 100644
--- a/third_party/WebKit/Source/modules/accessibility/AXObject.cpp
+++ b/third_party/WebKit/Source/modules/accessibility/AXObject.cpp
@@ -30,6 +30,7 @@
#include "SkMatrix44.h"
#include "core/css/resolver/StyleResolver.h"
+#include "core/dom/AccessibleNode.h"
#include "core/dom/DocumentUserGestureToken.h"
#include "core/editing/EditingUtilities.h"
#include "core/editing/VisibleUnits.h"
@@ -378,6 +379,15 @@ bool AXObject::isDetached() const {
return !m_axObjectCache;
}
+const AtomicString& AXObject::getAOMPropertyOrARIAAttribute(
+ AOMStringProperty property) const {
+ Node* node = this->getNode();
+ if (!node || !node->isElementNode())
+ return nullAtom;
+
+ return AccessibleNode::getProperty(toElement(node), property);
+}
+
bool AXObject::isARIATextControl() const {
return ariaRoleAttribute() == TextFieldRole ||
ariaRoleAttribute() == SearchBoxRole ||
@@ -803,7 +813,8 @@ String AXObject::ariaTextAlternative(bool recursive,
nameSources->push_back(NameSource(*foundTextAlternative, aria_labelAttr));
nameSources->back().type = nameFrom;
}
- const AtomicString& ariaLabel = getAttribute(aria_labelAttr);
+ const AtomicString& ariaLabel =
+ getAOMPropertyOrARIAAttribute(AOMStringProperty::kLabel);
if (!ariaLabel.isEmpty()) {
textAlternative = ariaLabel;

Powered by Google App Engine
This is Rietveld 408576698