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

Unified Diff: Source/core/html/HTMLEmbedElement.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/HTMLElement.cpp ('k') | Source/core/html/HTMLFormControlElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLEmbedElement.cpp
diff --git a/Source/core/html/HTMLEmbedElement.cpp b/Source/core/html/HTMLEmbedElement.cpp
index 7a66dd00275a430490dd1c6a4bc4166c52982fa9..0a9cf575e3513864e2081891aca2b891f125de94 100644
--- a/Source/core/html/HTMLEmbedElement.cpp
+++ b/Source/core/html/HTMLEmbedElement.cpp
@@ -54,11 +54,8 @@ PassRefPtr<HTMLEmbedElement> HTMLEmbedElement::create(Document& document, bool c
static inline RenderWidget* findWidgetRenderer(const Node* n)
{
- if (!n->renderer()) {
- do {
- n = n->parentNode();
- } while (n && !isHTMLObjectElement(*n));
- }
+ if (!n->renderer())
+ n = Traversal<HTMLObjectElement>::firstAncestor(*n);
if (n && n->renderer() && n->renderer()->isWidget())
return toRenderWidget(n->renderer());
@@ -199,8 +196,8 @@ bool HTMLEmbedElement::isInteractiveContent() const
bool HTMLEmbedElement::isExposed() const
{
// http://www.whatwg.org/specs/web-apps/current-work/#exposed
- for (Node* ancestor = parentNode(); ancestor; ancestor = ancestor->parentNode()) {
- if (isHTMLObjectElement(*ancestor) && toHTMLObjectElement(*ancestor).isExposed())
+ for (HTMLObjectElement* object = Traversal<HTMLObjectElement>::firstAncestor(*this); object; object = Traversal<HTMLObjectElement>::firstAncestor(*object)) {
+ if (object->isExposed())
return false;
}
return true;
« no previous file with comments | « Source/core/html/HTMLElement.cpp ('k') | Source/core/html/HTMLFormControlElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698