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

Unified Diff: Source/core/dom/Node.cpp

Issue 54803003: Have Node::lastDescendant() return a reference (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Kill firstDescendant()! Created 7 years, 2 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/dom/Node.h ('k') | Source/core/editing/DeleteSelectionCommand.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Node.cpp
diff --git a/Source/core/dom/Node.cpp b/Source/core/dom/Node.cpp
index 89f80b54a0abb8e03fe2d50d433194f6fae29cd6..523f80ecbbd9ad62532a2b85058ff76ee876b3b2 100644
--- a/Source/core/dom/Node.cpp
+++ b/Source/core/dom/Node.cpp
@@ -383,20 +383,13 @@ PassRefPtr<NodeList> Node::childNodes()
return ensureRareData().ensureNodeLists().ensureChildNodeList(this);
}
-Node *Node::lastDescendant() const
+Node& Node::lastDescendant() const
{
- Node *n = const_cast<Node *>(this);
+ Node* n = const_cast<Node*>(this);
while (n && n->lastChild())
n = n->lastChild();
- return n;
-}
-
-Node* Node::firstDescendant() const
-{
- Node *n = const_cast<Node *>(this);
- while (n && n->firstChild())
- n = n->firstChild();
- return n;
+ ASSERT(n);
+ return *n;
}
Node* Node::pseudoAwarePreviousSibling() const
« no previous file with comments | « Source/core/dom/Node.h ('k') | Source/core/editing/DeleteSelectionCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698