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

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

Issue 247263008: LiveNodeListBase code should not need to worry about id/name cache invalidation (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Bug fix Created 6 years, 8 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/CollectionType.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.h
diff --git a/Source/core/html/HTMLCollection.h b/Source/core/html/HTMLCollection.h
index 16b57382f8e5be98a31994a0ccd104b91dfb8436..4f6d52a467a501c0402f0784c8d0a8aa38677569 100644
--- a/Source/core/html/HTMLCollection.h
+++ b/Source/core/html/HTMLCollection.h
@@ -43,6 +43,7 @@ public:
static PassRefPtr<HTMLCollection> create(ContainerNode& base, CollectionType);
virtual ~HTMLCollection();
virtual void invalidateCache(Document* oldDocument = 0) const OVERRIDE;
+ void invalidateCacheForAttribute(const QualifiedName*) const;
// DOM API
unsigned length() const { return m_collectionIndexCache.nodeCount(*this); }
@@ -140,10 +141,18 @@ private:
const unsigned m_shouldOnlyIncludeDirectChildren : 1;
mutable OwnPtr<NamedItemCache> m_namedItemCache;
mutable CollectionIndexCache<HTMLCollection, Element> m_collectionIndexCache;
-
- friend class LiveNodeListBase;
};
+DEFINE_TYPE_CASTS(HTMLCollection, LiveNodeListBase, collection, isHTMLCollectionType(collection->type()), isHTMLCollectionType(collection.type()));
+
+inline void HTMLCollection::invalidateCacheForAttribute(const QualifiedName* attrName) const
+{
+ if (!attrName || shouldInvalidateTypeOnAttributeChange(invalidationType(), *attrName))
+ invalidateCache();
+ else if (*attrName == HTMLNames::idAttr || *attrName == HTMLNames::nameAttr)
+ invalidateIdNameCacheMaps();
+}
+
} // namespace
#endif
« no previous file with comments | « Source/core/html/CollectionType.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698