Chromium Code Reviews| Index: Source/core/dom/shadow/ComposedTreeTraversal.cpp |
| diff --git a/Source/core/dom/shadow/ComposedTreeTraversal.cpp b/Source/core/dom/shadow/ComposedTreeTraversal.cpp |
| index 8966b8faf5431cd71aa70284474b6687d23da9be..ebb25a152ab51132c6f8ea2ed689da3bf0b91572 100644 |
| --- a/Source/core/dom/shadow/ComposedTreeTraversal.cpp |
| +++ b/Source/core/dom/shadow/ComposedTreeTraversal.cpp |
| @@ -241,4 +241,18 @@ unsigned ComposedTreeTraversal::countChildren(const Node& node) |
| return count; |
| } |
| +Node* ComposedTreeTraversal::lastWithin(const Node& current) |
| +{ |
|
hayato
2015/03/26 03:28:27
Could you insert assertions like other public func
hajimehoshi
2015/03/26 03:43:26
Done.
|
| + Node* descendant = lastChild(current); |
| + for (Node* child = descendant; child; child = lastChild(*child)) |
| + descendant = child; |
| + return descendant; |
| +} |
| + |
| +Node& ComposedTreeTraversal::lastWithinOrSelf(Node& current) |
| +{ |
| + Node* lastDescendant = ComposedTreeTraversal::lastWithin(current); |
| + return lastDescendant ? *lastDescendant : current; |
| +} |
| + |
| } // namespace |