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

Unified Diff: Source/core/html/HTMLLegendElement.cpp

Issue 476273004: Use Traversal<>::firstAncestor() API more in the code base (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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 | « Source/core/html/HTMLAreaElement.cpp ('k') | Source/core/html/HTMLMetaElement-in.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLLegendElement.cpp
diff --git a/Source/core/html/HTMLLegendElement.cpp b/Source/core/html/HTMLLegendElement.cpp
index 0fb130d61405fed4135eabe8b68322a3064c8578..086f3381df45947cb40c2a5ed673539736311936 100644
--- a/Source/core/html/HTMLLegendElement.cpp
+++ b/Source/core/html/HTMLLegendElement.cpp
@@ -46,9 +46,7 @@ DEFINE_NODE_FACTORY(HTMLLegendElement)
HTMLFormControlElement* HTMLLegendElement::associatedControl()
{
// Check if there's a fieldset belonging to this legend.
- Element* fieldset = parentElement();
- while (fieldset && !isHTMLFieldSetElement(*fieldset))
- fieldset = fieldset->parentElement();
+ HTMLFieldSetElement* fieldset = Traversal<HTMLFieldSetElement>::firstAncestor(*this);
if (!fieldset)
return 0;
« no previous file with comments | « Source/core/html/HTMLAreaElement.cpp ('k') | Source/core/html/HTMLMetaElement-in.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698