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

Unified Diff: Source/core/accessibility/AXNodeObject.cpp

Issue 201293002: Add Traversal<*Element>::firstAncestor() API (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add firstAncestorOrSelf() Created 6 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
« no previous file with comments | « no previous file | Source/core/dom/ElementTraversal.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/accessibility/AXNodeObject.cpp
diff --git a/Source/core/accessibility/AXNodeObject.cpp b/Source/core/accessibility/AXNodeObject.cpp
index 76381e162810bd626d81db51b243b4e1d33209e3..02577cdc208e00d7afab565f26c6247c7cfe63c3 100644
--- a/Source/core/accessibility/AXNodeObject.cpp
+++ b/Source/core/accessibility/AXNodeObject.cpp
@@ -1467,13 +1467,8 @@ HTMLLabelElement* AXNodeObject::labelElementContainer() const
if (isControl())
return 0;
- // find if this has a parent that is a label
- for (Node* parentNode = node(); parentNode; parentNode = parentNode->parentNode()) {
- if (isHTMLLabelElement(*parentNode))
- return toHTMLLabelElement(parentNode);
- }
-
- return 0;
+ // find if this has a ancestor that is a label
+ return Traversal<HTMLLabelElement>::firstAncestorOrSelf(*node());
}
void AXNodeObject::setFocused(bool on)
« no previous file with comments | « no previous file | Source/core/dom/ElementTraversal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698