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

Unified Diff: Source/core/html/HTMLOptionElement.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 | « Source/core/html/HTMLOptGroupElement.cpp ('k') | Source/core/html/parser/HTMLTreeBuilder.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLOptionElement.cpp
diff --git a/Source/core/html/HTMLOptionElement.cpp b/Source/core/html/HTMLOptionElement.cpp
index c0b02f12ef71b46fdeb0ba02b6d1e17bed4813ba..abeb8577912a63d3971ce0dbd0ded390cc7e47b7 100644
--- a/Source/core/html/HTMLOptionElement.cpp
+++ b/Source/core/html/HTMLOptionElement.cpp
@@ -259,23 +259,12 @@ void HTMLOptionElement::childrenChanged(bool changedByParser, Node* beforeChange
HTMLDataListElement* HTMLOptionElement::ownerDataListElement() const
{
- for (ContainerNode* parent = parentNode(); parent ; parent = parent->parentNode()) {
- if (isHTMLDataListElement(*parent))
- return toHTMLDataListElement(parent);
- }
- return 0;
+ return Traversal<HTMLDataListElement>::firstAncestor(*this);
}
HTMLSelectElement* HTMLOptionElement::ownerSelectElement() const
{
- ContainerNode* select = parentNode();
- while (select && !isHTMLSelectElement(*select))
- select = select->parentNode();
-
- if (!select)
- return 0;
-
- return toHTMLSelectElement(select);
+ return Traversal<HTMLSelectElement>::firstAncestor(*this);
}
String HTMLOptionElement::label() const
« no previous file with comments | « Source/core/html/HTMLOptGroupElement.cpp ('k') | Source/core/html/parser/HTMLTreeBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698