X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fthird_party%2FWebKit%2FSource%2Fcore%2Fhtml%2FCollectionIndexCache.h;h=ba7843d9b6b294d0fb8587a8f9320cd57bfdc8a7;hb=3545e9f2671f595d2a2f3ee75ca0393b01e35ef6;hp=2f039efd65b22a3c144aa6089df81dfff127af2e;hpb=7d210d4c7e9ba36e635eabc5b5780495f8a63292;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/third_party/WebKit/Source/core/html/CollectionIndexCache.h b/src/third_party/WebKit/Source/core/html/CollectionIndexCache.h index 2f039ef..ba7843d 100644 --- a/src/third_party/WebKit/Source/core/html/CollectionIndexCache.h +++ b/src/third_party/WebKit/Source/core/html/CollectionIndexCache.h @@ -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 m_currentNode; unsigned m_cachedNodeCount; unsigned m_cachedNodeIndex : 31; @@ -138,7 +139,7 @@ inline NodeType* CollectionIndexCache::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::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::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)