Index: Source/core/dom/NodeTraversal.cpp |
diff --git a/Source/core/dom/NodeTraversal.cpp b/Source/core/dom/NodeTraversal.cpp |
index 0f4a9f16a088c5522ada0984c9f3606287d37b00..a4fe5dd9ed7d0c5d56ede20e6a61cb4b493d9536 100644 |
--- a/Source/core/dom/NodeTraversal.cpp |
+++ b/Source/core/dom/NodeTraversal.cpp |
@@ -111,7 +111,7 @@ Node* NodeTraversal::previous(const Node& current, const Node* stayWithin) |
if (current.previousSibling()) { |
Node* previous = current.previousSibling(); |
while (previous->lastChild()) |
esprehn
2014/06/02 19:03:37
This is silly, don't call it twice.
while (Node*
Inactive
2014/06/02 20:46:25
Done.
|
- previous = previous->lastChild(); |
+ previous = toContainerNode(previous)->lastChild(); |
return previous; |
} |
return current.parentNode(); |
@@ -140,7 +140,7 @@ Node* NodeTraversal::nextPostOrder(const Node& current, const Node* stayWithin) |
return current.parentNode(); |
Node* next = current.nextSibling(); |
while (next->firstChild()) |
- next = next->firstChild(); |
+ next = toContainerNode(next)->firstChild(); |
esprehn
2014/06/02 19:03:37
dito.
Inactive
2014/06/02 20:46:25
Done.
|
return next; |
} |
@@ -158,8 +158,8 @@ static Node* previousAncestorSiblingPostOrder(const Node& current, const Node* s |
Node* NodeTraversal::previousPostOrder(const Node& current, const Node* stayWithin) |
{ |
- if (current.lastChild()) |
- return current.lastChild(); |
+ if (Node* lastChild = current.lastChild()) |
+ return lastChild; |
if (current == stayWithin) |
return 0; |
if (current.previousSibling()) |