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

Unified Diff: Source/core/dom/LiveNodeList.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/dom/Document.cpp ('k') | Source/core/dom/LiveNodeListBase.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/LiveNodeList.h
diff --git a/Source/core/dom/LiveNodeList.h b/Source/core/dom/LiveNodeList.h
index bdc6e64e650328080aa1907ba2df083bc873f23a..c819db15357c6957c22186643753ead2a5cd6fce 100644
--- a/Source/core/dom/LiveNodeList.h
+++ b/Source/core/dom/LiveNodeList.h
@@ -45,7 +45,9 @@ public:
virtual Node* item(unsigned offset) const OVERRIDE FINAL { return m_collectionIndexCache.nodeAt(*this, offset); }
virtual bool elementMatches(const Element&) const = 0;
- virtual void invalidateCache(Document* oldDocument) const OVERRIDE FINAL;
+ virtual void invalidateCache(Document* oldDocument = 0) const OVERRIDE FINAL;
+ void invalidateCacheForAttribute(const QualifiedName*) const;
+
bool shouldOnlyIncludeDirectChildren() const { return false; }
// Collection IndexCache API.
@@ -61,6 +63,14 @@ private:
mutable CollectionIndexCache<LiveNodeList, Element> m_collectionIndexCache;
};
+DEFINE_TYPE_CASTS(LiveNodeList, LiveNodeListBase, list, isLiveNodeListType(list->type()), isLiveNodeListType(list.type()));
+
+inline void LiveNodeList::invalidateCacheForAttribute(const QualifiedName* attrName) const
+{
+ if (!attrName || shouldInvalidateTypeOnAttributeChange(invalidationType(), *attrName))
+ invalidateCache();
+}
+
} // namespace WebCore
#endif // LiveNodeList_h
« no previous file with comments | « Source/core/dom/Document.cpp ('k') | Source/core/dom/LiveNodeListBase.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698