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

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

Issue 1642503002: Implement Node.treeRoot (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change return type and clean up the layout test Created 4 years, 11 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 | « third_party/WebKit/Source/core/dom/Node.h ('k') | third_party/WebKit/Source/core/dom/Node.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/Node.cpp
diff --git a/third_party/WebKit/Source/core/dom/Node.cpp b/third_party/WebKit/Source/core/dom/Node.cpp
index ef638aba3918401364295269158db10e2b3a95d0..89d93e27a4d7a683966ad0258792e67e9d3c0e92 100644
--- a/third_party/WebKit/Source/core/dom/Node.cpp
+++ b/third_party/WebKit/Source/core/dom/Node.cpp
@@ -450,6 +450,16 @@ Node* Node::pseudoAwareLastChild() const
return lastChild();
}
+Node& Node::treeRoot() const
+{
+ if (isInTreeScope())
+ return treeScope().rootNode();
+ const Node* node = this;
+ while (node->parentNode())
+ node = node->parentNode();
+ return const_cast<Node&>(*node);
+}
+
PassRefPtrWillBeRawPtr<Node> Node::insertBefore(PassRefPtrWillBeRawPtr<Node> newChild, Node* refChild, ExceptionState& exceptionState)
{
if (isContainerNode())
« no previous file with comments | « third_party/WebKit/Source/core/dom/Node.h ('k') | third_party/WebKit/Source/core/dom/Node.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698