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

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: Slight clean up 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') | Source/core/dom/ElementTraversal.h » ('J')
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 fa59758de580dea50ab555dffcddfbc70333931b..f78551a2d332baf5d98eff0e1c3d4fbb433a96ac 100644
--- a/Source/core/accessibility/AXNodeObject.cpp
+++ b/Source/core/accessibility/AXNodeObject.cpp
@@ -1480,13 +1480,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 isHTMLLabelElement(*node()) ? toHTMLLabelElement(node()) : Traversal<HTMLLabelElement>::firstAncestor(*node());
esprehn 2014/03/21 07:58:33 Can we use if statements here? I don't think all t
Inactive 2014/03/21 14:37:24 Done.
}
void AXNodeObject::setFocused(bool on)
« no previous file with comments | « no previous file | Source/core/dom/ElementTraversal.h » ('j') | Source/core/dom/ElementTraversal.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698