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

Unified Diff: Source/core/dom/shadow/ComposedTreeTraversal.h

Issue 1071863002: Prefer ComposedTreeTraversal to NodeRenderingTraversal. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 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
Index: Source/core/dom/shadow/ComposedTreeTraversal.h
diff --git a/Source/core/dom/shadow/ComposedTreeTraversal.h b/Source/core/dom/shadow/ComposedTreeTraversal.h
index ed4a9ad06a59c00fb3b1bf9e45133c252c081670..e75780cd848a7acaa2ccb81234ba74864601b929 100644
--- a/Source/core/dom/shadow/ComposedTreeTraversal.h
+++ b/Source/core/dom/shadow/ComposedTreeTraversal.h
@@ -84,6 +84,13 @@ public:
// false. If |other| is |node|, this function returns false.
static bool isDescendantOf(const Node& /*node*/, const Node& other);
+ static bool contains(const ContainerNode& container, const Node& node)
+ {
+ assertPrecondition(container);
+ assertPrecondition(node);
+ return container == node || isDescendantOf(node, container);
+ }
+
// Returns a common ancestor of |nodeA| and |nodeB| if exists, otherwise
// returns |nullptr|.
static Node* commonAncestor(const Node& nodeA, const Node& nodeB);

Powered by Google App Engine
This is Rietveld 408576698