Index: Source/core/dom/NodeTraversal.cpp |
diff --git a/Source/core/dom/NodeTraversal.cpp b/Source/core/dom/NodeTraversal.cpp |
index 6d9665043222502bead551e439ed25f25ad139cb..b68752da7526b08734a85322d392e226ae9ddaef 100644 |
--- a/Source/core/dom/NodeTraversal.cpp |
+++ b/Source/core/dom/NodeTraversal.cpp |
@@ -104,6 +104,12 @@ Node* NodeTraversal::lastWithin(const ContainerNode& current) |
return descendant; |
} |
+Node& NodeTraversal::lastWithinOrSelf(Node& current) |
+{ |
+ Node* lastDescendant = current.isContainerNode() ? NodeTraversal::lastWithin(toContainerNode(current)) : 0; |
+ return lastDescendant ? *lastDescendant : current; |
+} |
+ |
Node* NodeTraversal::previous(const Node& current, const Node* stayWithin) |
{ |
if (current == stayWithin) |