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

Unified Diff: Source/core/dom/ContainerNode.h

Issue 15871005: Avoid N^2 walk placing renderers when building the render tree (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Reversing the snapshotting logic to fix a bug, and updating test expectations. Created 7 years, 6 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/ContainerNode.h
diff --git a/Source/core/dom/ContainerNode.h b/Source/core/dom/ContainerNode.h
index 55c3bf4f55456da9294cc103f6e702a8001ec93c..c9b2030c2fba97489a122df59a3a324942689816 100644
--- a/Source/core/dom/ContainerNode.h
+++ b/Source/core/dom/ContainerNode.h
@@ -284,7 +284,7 @@ class ChildNodesLazySnapshot {
WTF_MAKE_FAST_ALLOCATED;
public:
explicit ChildNodesLazySnapshot(Node* parentNode)
- : m_currentNode(parentNode->firstChild())
+ : m_currentNode(parentNode->lastChild())
, m_currentIndex(0)
{
m_nextSnapshot = latestSnapshot;
@@ -297,12 +297,12 @@ public:
}
// Returns 0 if there is no next Node.
esprehn 2013/06/05 00:12:26 is no previous node?
- PassRefPtr<Node> nextNode()
+ PassRefPtr<Node> previousNode()
{
if (LIKELY(!hasSnapshot())) {
RefPtr<Node> node = m_currentNode;
if (node)
- m_currentNode = node->nextSibling();
+ m_currentNode = node->previousSibling();
return node.release();
}
Vector<RefPtr<Node> >& nodeVector = *m_childNodes;
@@ -319,7 +319,7 @@ public:
Node* node = m_currentNode.get();
while (node) {
m_childNodes->append(node);
- node = node->nextSibling();
+ node = node->previousSibling();
}
}

Powered by Google App Engine
This is Rietveld 408576698