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

Unified Diff: Source/core/dom/ContainerNode.h

Issue 182053002: Have Node::highestAncestor() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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/Node.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/ContainerNode.h
diff --git a/Source/core/dom/ContainerNode.h b/Source/core/dom/ContainerNode.h
index 65f0e04c65ed3f8dc91b8eae8fbf62c9b84ec52a..8c8e4a9fed3c8b56fec6917afea54da7a69e84b2 100644
--- a/Source/core/dom/ContainerNode.h
+++ b/Source/core/dom/ContainerNode.h
@@ -243,13 +243,14 @@ inline Node* Node::lastChild() const
return toContainerNode(this)->lastChild();
}
-inline Node* Node::highestAncestor() const
+inline Node& Node::highestAncestor() const
{
Node* node = const_cast<Node*>(this);
Node* highest = node;
for (; node; node = node->parentNode())
highest = node;
- return highest;
+ ASSERT(highest);
adamk 2014/02/26 20:37:23 This ASSERT is basically checking that the for loo
Inactive 2014/02/26 21:00:01 Done.
+ return *highest;
}
inline Node* Node::parentElementOrShadowRoot() const
« no previous file with comments | « no previous file | Source/core/dom/Node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698