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

Unified Diff: Source/core/html/CollectionIndexCache.h

Issue 152903002: Move m_overridesItemAfter member from LiveNodeListBase to HTMLCollection (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: No change Created 6 years, 11 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
« no previous file with comments | « Source/core/dom/LiveNodeList.h ('k') | Source/core/html/HTMLCollection.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/CollectionIndexCache.h
diff --git a/Source/core/html/CollectionIndexCache.h b/Source/core/html/CollectionIndexCache.h
index ad2a4cfb01c85b5857f23fc6a11c1697a2349af7..efd4aa9475d1f18ca1bfe8d2aea0d0b9df8a2465 100644
--- a/Source/core/html/CollectionIndexCache.h
+++ b/Source/core/html/CollectionIndexCache.h
@@ -130,11 +130,11 @@ inline Node* CollectionIndexCache<Collection>::nodeAt(const Collection& collecti
return 0;
ContainerNode& root = collection.rootNode();
- if (isCachedNodeCountValid() && !collection.overridesItemAfter() && isLastNodeCloserThanLastOrCachedNode(index)) {
+ if (isCachedNodeCountValid() && collection.canTraverseBackward() && isLastNodeCloserThanLastOrCachedNode(index)) {
Node* lastNode = collection.itemBefore(0);
ASSERT(lastNode);
setCachedNode(lastNode, cachedNodeCount() - 1);
- } else if (!cachedNode() || isFirstNodeCloserThanCachedNode(index) || (collection.overridesItemAfter() && index < cachedNodeIndex())) {
+ } else if (!cachedNode() || isFirstNodeCloserThanCachedNode(index) || (!collection.canTraverseBackward() && index < cachedNodeIndex())) {
Node* firstNode = collection.traverseToFirstElement(root);
if (!firstNode) {
setCachedNodeCount(0);
@@ -159,7 +159,7 @@ inline Node* CollectionIndexCache<Collection>::nodeBeforeOrAfterCachedNode(const
ASSERT(currentIndex != index);
if (index < cachedNodeIndex()) {
- ASSERT(!collection.overridesItemAfter());
+ ASSERT(collection.canTraverseBackward());
while ((currentNode = collection.itemBefore(currentNode))) {
ASSERT(currentIndex);
currentIndex--;
« no previous file with comments | « Source/core/dom/LiveNodeList.h ('k') | Source/core/html/HTMLCollection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698