| Index: Source/core/dom/Document.cpp
|
| diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
|
| index adc9ddbfad6e22b4e84c40189b27cca8ad6b7c3c..4379ec77dd7f70eab1993fa18392e0a4715f8ef7 100644
|
| --- a/Source/core/dom/Document.cpp
|
| +++ b/Source/core/dom/Document.cpp
|
| @@ -5455,4 +5455,38 @@ void Document::defaultEventHandler(Event* event)
|
| Node::defaultEventHandler(event);
|
| }
|
|
|
| +template<unsigned type>
|
| +bool shouldInvalidateNodeListCachesForAttr(const unsigned nodeListCounts[], const QualifiedName& attrName)
|
| +{
|
| + if (nodeListCounts[type] && LiveNodeListBase::shouldInvalidateTypeOnAttributeChange(static_cast<NodeListInvalidationType>(type), attrName))
|
| + return true;
|
| + return shouldInvalidateNodeListCachesForAttr<type + 1>(nodeListCounts, attrName);
|
| +}
|
| +
|
| +template<>
|
| +bool shouldInvalidateNodeListCachesForAttr<numNodeListInvalidationTypes>(const unsigned[], const QualifiedName&)
|
| +{
|
| + return false;
|
| +}
|
| +
|
| +bool Document::shouldInvalidateNodeListCaches(const QualifiedName* attrName) const
|
| +{
|
| + if (attrName)
|
| + return shouldInvalidateNodeListCachesForAttr<DoNotInvalidateOnAttributeChanges + 1>(m_nodeListCounts, *attrName);
|
| +
|
| + for (int type = 0; type < numNodeListInvalidationTypes; type++) {
|
| + if (m_nodeListCounts[type])
|
| + return true;
|
| + }
|
| +
|
| + return false;
|
| +}
|
| +
|
| +void Document::invalidateNodeListCaches(const QualifiedName* attrName)
|
| +{
|
| + HashSet<LiveNodeListBase*>::iterator end = m_listsInvalidatedAtDocument.end();
|
| + for (HashSet<LiveNodeListBase*>::iterator it = m_listsInvalidatedAtDocument.begin(); it != end; ++it)
|
| + (*it)->invalidateCache(attrName);
|
| +}
|
| +
|
| } // namespace WebCore
|
|
|