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

Unified Diff: Source/core/html/HTMLCollection.cpp

Issue 136833002: Remove redundant m_isItemCacheValid flag from LiveNodeListBase (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/html/HTMLCollection.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLCollection.cpp
diff --git a/Source/core/html/HTMLCollection.cpp b/Source/core/html/HTMLCollection.cpp
index 58cb3273027204ee8ae560e1c6e87e179562c1c5..3ba2592ceffa0ee022c8683904c8e429d8332a68 100644
--- a/Source/core/html/HTMLCollection.cpp
+++ b/Source/core/html/HTMLCollection.cpp
@@ -391,7 +391,7 @@ bool ALWAYS_INLINE LiveNodeListBase::isLastItemCloserThanLastOrCachedItem(unsign
{
ASSERT(isLengthCacheValid());
unsigned distanceFromLastItem = cachedLength() - offset;
- if (!isItemCacheValid())
+ if (!cachedItem())
return distanceFromLastItem < offset;
return cachedItemOffset() < offset && distanceFromLastItem < offset - cachedItemOffset();
@@ -399,7 +399,6 @@ bool ALWAYS_INLINE LiveNodeListBase::isLastItemCloserThanLastOrCachedItem(unsign
bool ALWAYS_INLINE LiveNodeListBase::isFirstItemCloserThanCachedItem(unsigned offset) const
{
- ASSERT(isItemCacheValid());
if (cachedItemOffset() < offset)
return false;
@@ -421,7 +420,7 @@ unsigned LiveNodeListBase::length() const
// FIXME: It is silly that these functions are in HTMLCollection.cpp.
Node* LiveNodeListBase::item(unsigned offset) const
{
- if (isItemCacheValid() && cachedItemOffset() == offset)
+ if (cachedItem() && cachedItemOffset() == offset)
return cachedItem();
if (isLengthCacheValid() && cachedLength() <= offset)
@@ -438,7 +437,7 @@ Node* LiveNodeListBase::item(unsigned offset) const
Node* lastItem = itemBefore(0);
ASSERT(lastItem);
setItemCache(lastItem, cachedLength() - 1);
- } else if (!isItemCacheValid() || isFirstItemCloserThanCachedItem(offset) || (overridesItemAfter() && offset < cachedItemOffset())) {
+ } else if (!cachedItem() || isFirstItemCloserThanCachedItem(offset) || (overridesItemAfter() && offset < cachedItemOffset())) {
Node* firstItem;
if (isLiveNodeListType(type()))
firstItem = static_cast<const LiveNodeList*>(this)->traverseToFirstElement(*root);
« no previous file with comments | « Source/core/html/HTMLCollection.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698