Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / html / CollectionIndexCache.h
index 2f039ef..ba7843d 100644 (file)
@@ -67,10 +67,7 @@ public:
         visitor->trace(m_currentNode);
     }
 
-private:
-    NodeType* nodeBeforeCachedNode(const Collection&, unsigned index);
-    NodeType* nodeAfterCachedNode(const Collection&, unsigned index);
-
+protected:
     ALWAYS_INLINE NodeType* cachedNode() const { return m_currentNode; }
     ALWAYS_INLINE unsigned cachedNodeIndex() const { ASSERT(cachedNode()); return m_cachedNodeIndex; }
     ALWAYS_INLINE void setCachedNode(NodeType* node, unsigned index)
@@ -88,6 +85,10 @@ private:
         m_isLengthCacheValid = true;
     }
 
+private:
+    NodeType* nodeBeforeCachedNode(const Collection&, unsigned index);
+    NodeType* nodeAfterCachedNode(const Collection&, unsigned index);
+
     RawPtrWillBeMember<NodeType> m_currentNode;
     unsigned m_cachedNodeCount;
     unsigned m_cachedNodeIndex : 31;
@@ -138,7 +139,7 @@ inline NodeType* CollectionIndexCache<Collection, NodeType>::nodeAt(const Collec
 
     // No valid cache yet, let's find the first matching element.
     ASSERT(!isCachedNodeCountValid());
-    NodeType* firstNode = collection.traverseToFirstElement();
+    NodeType* firstNode = collection.traverseToFirst();
     if (!firstNode) {
         // The collection is empty.
         setCachedNodeCount(0);
@@ -158,7 +159,7 @@ inline NodeType* CollectionIndexCache<Collection, NodeType>::nodeBeforeCachedNod
     // Determine if we should traverse from the beginning of the collection instead of the cached node.
     bool firstIsCloser = index < currentIndex - index;
     if (firstIsCloser || !collection.canTraverseBackward()) {
-        NodeType* firstNode = collection.traverseToFirstElement();
+        NodeType* firstNode = collection.traverseToFirst();
         ASSERT(firstNode);
         setCachedNode(firstNode, 0);
         return index ? nodeAfterCachedNode(collection, index) : firstNode;
@@ -182,7 +183,7 @@ inline NodeType* CollectionIndexCache<Collection, NodeType>::nodeAfterCachedNode
     // Determine if we should traverse from the end of the collection instead of the cached node.
     bool lastIsCloser = isCachedNodeCountValid() && cachedNodeCount() - index < index - currentIndex;
     if (lastIsCloser && collection.canTraverseBackward()) {
-        NodeType* lastItem = collection.traverseToLastElement();
+        NodeType* lastItem = collection.traverseToLast();
         ASSERT(lastItem);
         setCachedNode(lastItem, cachedNodeCount() - 1);
         if (index < cachedNodeCount() - 1)