 Chromium Code Reviews
 Chromium Code Reviews Issue 159503003:
  Do not cause unnecessary node lists invalidation on id/name attribute change  (Closed) 
  Base URL: svn://svn.chromium.org/blink/trunk
    
  
    Issue 159503003:
  Do not cause unnecessary node lists invalidation on id/name attribute change  (Closed) 
  Base URL: svn://svn.chromium.org/blink/trunk| Index: Source/core/dom/NodeRareData.h | 
| diff --git a/Source/core/dom/NodeRareData.h b/Source/core/dom/NodeRareData.h | 
| index b1474b90d435f31238f6ea728ea6715cdaa3cfeb..d7a2fb60b19132106f3b2ae69100537cd8b21a8f 100644 | 
| --- a/Source/core/dom/NodeRareData.h | 
| +++ b/Source/core/dom/NodeRareData.h | 
| @@ -173,23 +173,22 @@ public: | 
| void adoptDocument(Document& oldDocument, Document& newDocument) | 
| { | 
| - invalidateCaches(); | 
| + if (oldDocument == newDocument) { | 
| 
eseidel
2014/02/12 01:55:24
Really?  This seems like an odd case?
 
Inactive
2014/02/12 02:21:41
Right, I need to check the callers to see if this
 
Inactive
2014/02/12 02:38:48
After a quick check, it looks like all the callers
 | 
| + invalidateCaches(); | 
| + return; | 
| + | 
| + } | 
| + NodeListAtomicNameCacheMap::const_iterator atomicNameCacheEnd = m_atomicNameCaches.end(); | 
| + for (NodeListAtomicNameCacheMap::const_iterator it = m_atomicNameCaches.begin(); it != atomicNameCacheEnd; ++it) { | 
| + LiveNodeListBase* list = it->value; | 
| + list->didMoveToDocument(oldDocument, newDocument); | 
| + } | 
| - if (oldDocument != newDocument) { | 
| - NodeListAtomicNameCacheMap::const_iterator atomicNameCacheEnd = m_atomicNameCaches.end(); | 
| - for (NodeListAtomicNameCacheMap::const_iterator it = m_atomicNameCaches.begin(); it != atomicNameCacheEnd; ++it) { | 
| - LiveNodeListBase* list = it->value; | 
| - oldDocument.unregisterNodeList(list); | 
| - newDocument.registerNodeList(list); | 
| - } | 
| - | 
| - TagCollectionCacheNS::const_iterator tagEnd = m_tagCollectionCacheNS.end(); | 
| - for (TagCollectionCacheNS::const_iterator it = m_tagCollectionCacheNS.begin(); it != tagEnd; ++it) { | 
| - LiveNodeListBase* list = it->value; | 
| - ASSERT(!list->isRootedAtDocument()); | 
| - oldDocument.unregisterNodeList(list); | 
| - newDocument.registerNodeList(list); | 
| - } | 
| + TagCollectionCacheNS::const_iterator tagEnd = m_tagCollectionCacheNS.end(); | 
| + for (TagCollectionCacheNS::const_iterator it = m_tagCollectionCacheNS.begin(); it != tagEnd; ++it) { | 
| + LiveNodeListBase* list = it->value; | 
| + ASSERT(!list->isRootedAtDocument()); | 
| + list->didMoveToDocument(oldDocument, newDocument); | 
| } | 
| } |