Title: [140740] branches/chromium/1364/Source/WebCore/dom
Revision
140740
Author
[email protected]
Date
2013-01-24 15:41:14 -0800 (Thu, 24 Jan 2013)

Log Message

Merge 140103
BUG=170240
Review URL: https://codereview.chromium.org/12052069

Modified Paths

Diff

Modified: branches/chromium/1364/Source/WebCore/dom/NodeRareData.h (140739 => 140740)


--- branches/chromium/1364/Source/WebCore/dom/NodeRareData.h	2013-01-24 23:36:25 UTC (rev 140739)
+++ branches/chromium/1364/Source/WebCore/dom/NodeRareData.h	2013-01-24 23:41:14 UTC (rev 140740)
@@ -169,10 +169,15 @@
         return m_atomicNameCaches.isEmpty() && m_nameCaches.isEmpty() && m_tagNodeListCacheNS.isEmpty();
     }
 
-    void adoptTreeScope(Document* oldDocument, Document* newDocument)
+    void adoptTreeScope()
     {
         invalidateCaches();
+    }
 
+    void adoptDocument(Document* oldDocument, Document* newDocument)
+    {
+        invalidateCaches();
+
         if (oldDocument != newDocument) {
             NodeListAtomicNameCacheMap::const_iterator atomicNameCacheEnd = m_atomicNameCaches.end();
             for (NodeListAtomicNameCacheMap::const_iterator it = m_atomicNameCaches.begin(); it != atomicNameCacheEnd; ++it) {

Modified: branches/chromium/1364/Source/WebCore/dom/TreeScopeAdopter.cpp (140739 => 140740)


--- branches/chromium/1364/Source/WebCore/dom/TreeScopeAdopter.cpp	2013-01-24 23:36:25 UTC (rev 140739)
+++ branches/chromium/1364/Source/WebCore/dom/TreeScopeAdopter.cpp	2013-01-24 23:41:14 UTC (rev 140740)
@@ -51,15 +51,14 @@
 
     for (Node* node = root; node; node = NodeTraversal::next(node, root)) {
         node->setTreeScope(m_newScope);
-        if (node->hasRareData()) {
+        if (willMoveToNewDocument)
+            moveNodeToNewDocument(node, oldDocument, newDocument);
+        else if (node->hasRareData()) {
             NodeRareData* rareData = node->rareData();
             if (rareData->nodeLists())
-                rareData->nodeLists()->adoptTreeScope(oldDocument, newDocument);
+                rareData->nodeLists()->adoptTreeScope();
         }
 
-        if (willMoveToNewDocument)
-            moveNodeToNewDocument(node, oldDocument, newDocument);
-
         for (ShadowRoot* shadow = node->youngestShadowRoot(); shadow; shadow = shadow->olderShadowRoot()) {
             shadow->setParentTreeScope(m_newScope);
             if (willMoveToNewDocument)
@@ -93,6 +92,12 @@
 {
     ASSERT(!node->inDocument() || oldDocument != newDocument);
 
+    if (node->hasRareData()) {
+        NodeRareData* rareData = node->rareData();
+        if (rareData->nodeLists())
+            rareData->nodeLists()->adoptDocument(oldDocument, newDocument);
+    }
+
     newDocument->guardRef();
     if (oldDocument)
         oldDocument->moveNodeIteratorsToNewDocument(node, newDocument);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to