Title: [134470] branches/safari-536.28-branch

Diff

Modified: branches/safari-536.28-branch/LayoutTests/ChangeLog (134469 => 134470)


--- branches/safari-536.28-branch/LayoutTests/ChangeLog	2012-11-13 20:54:46 UTC (rev 134469)
+++ branches/safari-536.28-branch/LayoutTests/ChangeLog	2012-11-13 21:04:25 UTC (rev 134470)
@@ -1,3 +1,7 @@
+2012-11-13  Lucas Forschler  <[email protected]>
+
+        Rollout r133090
+
 2012-11-12  Lucas Forschler  <[email protected]>
 
         Merge r129440

Deleted: branches/safari-536.28-branch/LayoutTests/fast/forms/label/labels-owner-node-adopted-expected.txt (134469 => 134470)


--- branches/safari-536.28-branch/LayoutTests/fast/forms/label/labels-owner-node-adopted-expected.txt	2012-11-13 20:54:46 UTC (rev 134469)
+++ branches/safari-536.28-branch/LayoutTests/fast/forms/label/labels-owner-node-adopted-expected.txt	2012-11-13 21:04:25 UTC (rev 134470)
@@ -1,13 +0,0 @@
-This tests moving a node with labels property from one document to another. The labels node list should be updated when labels are modified in the new document.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-The input element initially have two label elements #label1 and #label2.
-PASS labels = input.labels; labels.length is 2
-PASS label0 = labels[0]; label1 = labels[1]; iframe.contentDocument.body.appendChild(form); labels.length; label1.parentNode.removeChild(label1); labels.length is 1
-PASS labels[0] is label0
-PASS label0.parentNode.appendChild(label1); labels.length is 2
-PASS labels[0] is label0
-PASS labels[1] is label1
-

Deleted: branches/safari-536.28-branch/LayoutTests/fast/forms/label/labels-owner-node-adopted.html (134469 => 134470)


--- branches/safari-536.28-branch/LayoutTests/fast/forms/label/labels-owner-node-adopted.html	2012-11-13 20:54:46 UTC (rev 134469)
+++ branches/safari-536.28-branch/LayoutTests/fast/forms/label/labels-owner-node-adopted.html	2012-11-13 21:04:25 UTC (rev 134470)
@@ -1,36 +0,0 @@
-<!DOCTYPE html>
-<html>
-<body>
-<form>
-<label id="label1" for=""
-<label id="label2" for=""
-<input id="input" type="text">
-</form>
-<script src=""
-<script>
-
-var form = document.querySelector('form');
-var input = document.querySelector('input');
-
-var iframe = document.createElement('iframe');
-document.body.appendChild(iframe);
-var labels, label0, label1;
-
-description("This tests moving a node with labels property from one document to another.\n"
-    + "The labels node list should be updated when labels are modified in the new document.")
-
-debug('The input element initially have two label elements #label1 and #label2.');
-shouldBe("labels = input.labels; labels.length", "2");
-shouldBe("label0 = labels[0]; label1 = labels[1]; iframe.contentDocument.body.appendChild(form); labels.length; label1.parentNode.removeChild(label1); labels.length", "1");
-shouldBe("labels[0]", "label0");
-shouldBe("label0.parentNode.appendChild(label1); labels.length", "2");
-shouldBe("labels[0]", "label0");
-shouldBe("labels[1]", "label1");
-
-form.style.display = 'none';
-
-var successfullyParsed = true;
-
-</script>
-</body>
-</html>

Modified: branches/safari-536.28-branch/Source/WebCore/ChangeLog (134469 => 134470)


--- branches/safari-536.28-branch/Source/WebCore/ChangeLog	2012-11-13 20:54:46 UTC (rev 134469)
+++ branches/safari-536.28-branch/Source/WebCore/ChangeLog	2012-11-13 21:04:25 UTC (rev 134470)
@@ -1,3 +1,7 @@
+2012-11-13  Lucas Forschler  <[email protected]>
+
+        Rollout r133090
+
 2012-11-12  Lucas Forschler  <[email protected]>
 
         Merge r133469

Modified: branches/safari-536.28-branch/Source/WebCore/bindings/js/JSNodeListCustom.cpp (134469 => 134470)


--- branches/safari-536.28-branch/Source/WebCore/bindings/js/JSNodeListCustom.cpp	2012-11-13 20:54:46 UTC (rev 134469)
+++ branches/safari-536.28-branch/Source/WebCore/bindings/js/JSNodeListCustom.cpp	2012-11-13 21:04:25 UTC (rev 134470)
@@ -43,7 +43,7 @@
         return false;
     if (!jsNodeList->impl()->isDynamicNodeList())
         return false;
-    return visitor.containsOpaqueRoot(root(static_cast<DynamicNodeList*>(jsNodeList->impl())->ownerNode()));
+    return visitor.containsOpaqueRoot(root(static_cast<DynamicNodeList*>(jsNodeList->impl())->node()));
 }
 
 bool JSNodeList::canGetItemsForName(ExecState*, NodeList* impl, const Identifier& propertyName)

Modified: branches/safari-536.28-branch/Source/WebCore/dom/ChildNodeList.cpp (134469 => 134470)


--- branches/safari-536.28-branch/Source/WebCore/dom/ChildNodeList.cpp	2012-11-13 20:54:46 UTC (rev 134469)
+++ branches/safari-536.28-branch/Source/WebCore/dom/ChildNodeList.cpp	2012-11-13 21:04:25 UTC (rev 134470)
@@ -34,7 +34,7 @@
 
 ChildNodeList::~ChildNodeList()
 {
-    ownerNode()->removeCachedChildNodeList();
+    node()->removeCachedChildNodeList();
 }
 
 unsigned ChildNodeList::length() const
@@ -43,7 +43,7 @@
         return m_caches.cachedLength;
 
     unsigned len = 0;
-    for (Node* n = rootNode()->firstChild(); n; n = n->nextSibling())
+    for (Node* n = node()->firstChild(); n; n = n->nextSibling())
         len++;
 
     m_caches.cachedLength = len;
@@ -55,7 +55,7 @@
 Node* ChildNodeList::item(unsigned index) const
 {
     unsigned int pos = 0;
-    Node* n = rootNode()->firstChild();
+    Node* n = node()->firstChild();
 
     if (m_caches.isItemCacheValid) {
         if (index == m_caches.lastItemOffset)
@@ -76,7 +76,7 @@
         int diff = index - pos;
         unsigned dist = abs(diff);
         if (dist > m_caches.cachedLength - 1 - index) {
-            n = rootNode()->lastChild();
+            n = node()->lastChild();
             pos = m_caches.cachedLength - 1;
         }
     }
@@ -108,7 +108,7 @@
     // Note: Due to the overrides of the length and item functions above,
     // this function will be called only by DynamicNodeList::itemWithName,
     // for an element that was located with getElementById.
-    return testNode->parentNode() == rootNode();
+    return testNode->parentNode() == node();
 }
 
 } // namespace WebCore

Modified: branches/safari-536.28-branch/Source/WebCore/dom/ClassNodeList.cpp (134469 => 134470)


--- branches/safari-536.28-branch/Source/WebCore/dom/ClassNodeList.cpp	2012-11-13 20:54:46 UTC (rev 134469)
+++ branches/safari-536.28-branch/Source/WebCore/dom/ClassNodeList.cpp	2012-11-13 21:04:25 UTC (rev 134470)
@@ -37,14 +37,14 @@
 
 ClassNodeList::ClassNodeList(PassRefPtr<Node> rootNode, const String& classNames)
     : DynamicSubtreeNodeList(rootNode)
-    , m_classNames(classNames, document()->inQuirksMode())
+    , m_classNames(classNames, node()->document()->inQuirksMode())
     , m_originalClassNames(classNames)
 {
 }
 
 ClassNodeList::~ClassNodeList()
 {
-    ownerNode()->removeCachedClassNodeList(this, m_originalClassNames);
+    rootNode()->removeCachedClassNodeList(this, m_originalClassNames);
 } 
 
 bool ClassNodeList::nodeMatches(Element* testNode) const

Modified: branches/safari-536.28-branch/Source/WebCore/dom/Document.cpp (134469 => 134470)


--- branches/safari-536.28-branch/Source/WebCore/dom/Document.cpp	2012-11-13 20:54:46 UTC (rev 134469)
+++ branches/safari-536.28-branch/Source/WebCore/dom/Document.cpp	2012-11-13 21:04:25 UTC (rev 134470)
@@ -113,7 +113,6 @@
 #include "NewXMLDocumentParser.h"
 #include "NodeFilter.h"
 #include "NodeIterator.h"
-#include "NodeRareData.h"
 #include "NodeWithIndex.h"
 #include "Page.h"
 #include "PageGroup.h"
@@ -3784,18 +3783,6 @@
         n->setNeedsStyleRecalc();
 }
 
-void Document::registerDynamicSubtreeNodeList(DynamicSubtreeNodeList* list)
-{
-    ensureRareData()->ensureNodeLists(this)->m_listsInvalidatedAtDocument.add(list);
-}
-
-void Document::unregisterDynamicSubtreeNodeList(DynamicSubtreeNodeList* list)
-{
-    ASSERT(hasRareData());
-    ASSERT(rareData()->nodeLists());
-    rareData()->nodeLists()->m_listsInvalidatedAtDocument.remove(list);
-}
-
 void Document::attachNodeIterator(NodeIterator* ni)
 {
     m_nodeIterators.add(ni);

Modified: branches/safari-536.28-branch/Source/WebCore/dom/Document.h (134469 => 134470)


--- branches/safari-536.28-branch/Source/WebCore/dom/Document.h	2012-11-13 20:54:46 UTC (rev 134469)
+++ branches/safari-536.28-branch/Source/WebCore/dom/Document.h	2012-11-13 21:04:25 UTC (rev 134470)
@@ -755,9 +755,6 @@
     bool isPendingStyleRecalc() const;
     void styleRecalcTimerFired(Timer<Document>*);
 
-    void registerDynamicSubtreeNodeList(DynamicSubtreeNodeList*);
-    void unregisterDynamicSubtreeNodeList(DynamicSubtreeNodeList*);
-
     void attachNodeIterator(NodeIterator*);
     void detachNodeIterator(NodeIterator*);
     void moveNodeIteratorsToNewDocument(Node*, Document*);

Modified: branches/safari-536.28-branch/Source/WebCore/dom/DynamicNodeList.cpp (134469 => 134470)


--- branches/safari-536.28-branch/Source/WebCore/dom/DynamicNodeList.cpp	2012-11-13 20:54:46 UTC (rev 134469)
+++ branches/safari-536.28-branch/Source/WebCore/dom/DynamicNodeList.cpp	2012-11-13 21:04:25 UTC (rev 134470)
@@ -28,8 +28,8 @@
 
 namespace WebCore {
 
-DynamicSubtreeNodeList::DynamicSubtreeNodeList(PassRefPtr<Node> node, RootType rootType)
-    : DynamicNodeList(node, rootType)
+DynamicSubtreeNodeList::DynamicSubtreeNodeList(PassRefPtr<Node> node)
+    : DynamicNodeList(node)
 {
 }
 
@@ -43,9 +43,8 @@
         return m_caches.cachedLength;
 
     unsigned length = 0;
-    Node* rootNode = this->rootNode();
 
-    for (Node* n = rootNode->firstChild(); n; n = n->traverseNextNode(rootNode))
+    for (Node* n = node()->firstChild(); n; n = n->traverseNextNode(rootNode()))
         length += n->isElementNode() && nodeMatches(static_cast<Element*>(n));
 
     m_caches.cachedLength = length;
@@ -57,8 +56,7 @@
 Node* DynamicSubtreeNodeList::itemForwardsFromCurrent(Node* start, unsigned offset, int remainingOffset) const
 {
     ASSERT(remainingOffset >= 0);
-    Node* rootNode = this->rootNode();
-    for (Node* n = start; n; n = n->traverseNextNode(rootNode)) {
+    for (Node* n = start; n; n = n->traverseNextNode(rootNode())) {
         if (n->isElementNode() && nodeMatches(static_cast<Element*>(n))) {
             if (!remainingOffset) {
                 m_caches.lastItem = n;
@@ -76,8 +74,7 @@
 Node* DynamicSubtreeNodeList::itemBackwardsFromCurrent(Node* start, unsigned offset, int remainingOffset) const
 {
     ASSERT(remainingOffset < 0);
-    Node* rootNode = this->rootNode();
-    for (Node* n = start; n; n = n->traversePreviousNode(rootNode)) {
+    for (Node* n = start; n; n = n->traversePreviousNode(rootNode())) {
         if (n->isElementNode() && nodeMatches(static_cast<Element*>(n))) {
             if (!remainingOffset) {
                 m_caches.lastItem = n;
@@ -95,7 +92,7 @@
 Node* DynamicSubtreeNodeList::item(unsigned offset) const
 {
     int remainingOffset = offset;
-    Node* start = rootNode()->firstChild();
+    Node* start = node()->firstChild();
     if (m_caches.isItemCacheValid) {
         if (offset == m_caches.lastItemOffset)
             return m_caches.lastItem;
@@ -112,13 +109,11 @@
 
 Node* DynamicNodeList::itemWithName(const AtomicString& elementId) const
 {
-    Node* rootNode = this->rootNode();
-
-    if (rootNode->inDocument()) {
-        Element* element = rootNode->treeScope()->getElementById(elementId);
-        if (element && nodeMatches(element) && element->isDescendantOf(rootNode))
-            return element;
-        if (!element)
+    if (node()->isDocumentNode() || node()->inDocument()) {
+        Element* node = this->node()->treeScope()->getElementById(elementId);
+        if (node && nodeMatches(node) && node->isDescendantOf(this->node()))
+            return node;
+        if (!node)
             return 0;
         // In the case of multiple nodes with the same name, just fall through.
     }

Modified: branches/safari-536.28-branch/Source/WebCore/dom/DynamicNodeList.h (134469 => 134470)


--- branches/safari-536.28-branch/Source/WebCore/dom/DynamicNodeList.h	2012-11-13 20:54:46 UTC (rev 134469)
+++ branches/safari-536.28-branch/Source/WebCore/dom/DynamicNodeList.h	2012-11-13 21:04:25 UTC (rev 134470)
@@ -24,7 +24,6 @@
 #ifndef DynamicNodeList_h
 #define DynamicNodeList_h
 
-#include "Document.h"
 #include "NodeList.h"
 #include <wtf/Forward.h>
 #include <wtf/RefPtr.h>
@@ -36,14 +35,8 @@
 
 class DynamicNodeList : public NodeList {
 public:
-    enum RootType {
-        RootedAtNode,
-        RootedAtDocument,
-    };
-
-    DynamicNodeList(PassRefPtr<Node> ownerNode, RootType rootType = RootedAtNode)
-        : m_ownerNode(ownerNode)
-        , m_caches(rootType)
+    DynamicNodeList(PassRefPtr<Node> node)
+        : m_node(node)
     { }
     virtual ~DynamicNodeList() { }
 
@@ -53,28 +46,15 @@
     virtual Node* itemWithName(const AtomicString&) const;
 
     // Other methods (not part of DOM)
-    Node* ownerNode() const { return m_ownerNode.get(); }
-    bool isRootedAtDocument() const { return m_caches.rootedAtDocument; }
+    Node* node() const { return m_node.get(); }
 
     void invalidateCache() { m_caches.reset(); }
 
 protected:
-    Node* rootNode() const
-    {
-        if (m_caches.rootedAtDocument && m_ownerNode->inDocument())
-            return m_ownerNode->document();
-        return m_ownerNode.get();
-    }
-    Document* document() const { return m_ownerNode->document(); }
     virtual bool nodeMatches(Element*) const = 0;
 
     struct Caches {
-        Caches(RootType rootType)
-            : rootedAtDocument(rootType == RootedAtDocument)
-        {
-            reset();
-        }
-
+        Caches() { reset(); }
         void reset()
         {
             lastItem = 0;
@@ -84,14 +64,13 @@
 
         Node* lastItem;
         unsigned cachedLength;
-        unsigned lastItemOffset : 29; // Borrow 3-bits for bit fields
-        unsigned isLengthCacheValid : 1;
-        unsigned isItemCacheValid : 1;
-        unsigned rootedAtDocument : 1;
+        unsigned lastItemOffset;
+        bool isLengthCacheValid : 1;
+        bool isItemCacheValid : 1;
     };
 
-    RefPtr<Node> m_ownerNode;
     mutable Caches m_caches;
+    RefPtr<Node> m_node;
 
 private:
     virtual bool isDynamicNodeList() const OVERRIDE { return true; }
@@ -102,9 +81,10 @@
     virtual ~DynamicSubtreeNodeList();
     virtual unsigned length() const OVERRIDE;
     virtual Node* item(unsigned index) const OVERRIDE;
+    Node* rootNode() const { return node(); }
 
 protected:
-    DynamicSubtreeNodeList(PassRefPtr<Node>, RootType = RootedAtNode);
+    DynamicSubtreeNodeList(PassRefPtr<Node> rootNode);
 
 private:
     using DynamicNodeList::invalidateCache;

Modified: branches/safari-536.28-branch/Source/WebCore/dom/NameNodeList.cpp (134469 => 134470)


--- branches/safari-536.28-branch/Source/WebCore/dom/NameNodeList.cpp	2012-11-13 20:54:46 UTC (rev 134469)
+++ branches/safari-536.28-branch/Source/WebCore/dom/NameNodeList.cpp	2012-11-13 21:04:25 UTC (rev 134470)
@@ -39,7 +39,7 @@
 
 NameNodeList::~NameNodeList()
 {
-    ownerNode()->removeCachedNameNodeList(this, m_nodeName);
+    rootNode()->removeCachedNameNodeList(this, m_nodeName);
 } 
 
 bool NameNodeList::nodeMatches(Element* testNode) const

Modified: branches/safari-536.28-branch/Source/WebCore/dom/Node.cpp (134469 => 134470)


--- branches/safari-536.28-branch/Source/WebCore/dom/Node.cpp	2012-11-13 20:54:46 UTC (rev 134469)
+++ branches/safari-536.28-branch/Source/WebCore/dom/Node.cpp	2012-11-13 21:04:25 UTC (rev 134470)
@@ -949,6 +949,33 @@
     return count;
 }
 
+static void removeNodeListCacheIfPossible(Node* node, NodeRareData* data)
+{
+    if (!data->nodeLists()->isEmpty())
+        return;
+    data->clearNodeLists();
+    node->treeScope()->removeNodeListCache();
+}
+
+// FIXME: Move this function to Document
+void Node::registerDynamicSubtreeNodeList(DynamicSubtreeNodeList* list)
+{
+    ASSERT(isDocumentNode());
+    NodeRareData* data = ""
+    data->ensureNodeLists(this)->m_listsInvalidatedAtDocument.add(list);
+}
+
+// FIXME: Move this function to Document
+void Node::unregisterDynamicSubtreeNodeList(DynamicSubtreeNodeList* list)
+{
+    ASSERT(isDocumentNode());
+    ASSERT(hasRareData());
+    ASSERT(rareData()->nodeLists());
+    NodeRareData* data = ""
+    data->nodeLists()->m_listsInvalidatedAtDocument.remove(list);
+    removeNodeListCacheIfPossible(this, data);
+}
+
 void Node::invalidateNodeListsCacheAfterAttributeChanged(const QualifiedName& attrName)
 {
     if (hasRareData() && isAttributeNode()) {
@@ -968,11 +995,6 @@
         && attrName != forAttr)
         return;
 
-    if (document()->hasRareData()) {
-        if (NodeListsNodeData* nodeLists = document()->rareData()->nodeLists())
-            nodeLists->invalidateCachesForDocument();
-    }
-
     if (!treeScope()->hasNodeListCaches())
         return;
 
@@ -993,11 +1015,6 @@
     if (hasRareData())
         rareData()->clearChildNodeListCache();
 
-    if (document()->hasRareData()) {
-        if (NodeListsNodeData* nodeLists = document()->rareData()->nodeLists())
-            nodeLists->invalidateCachesForDocument();
-    }
-
     if (!treeScope()->hasNodeListCaches())
         return;
     for (Node* node = this; node; node = node->parentNode()) {
@@ -2290,15 +2307,13 @@
     invalidateCachesThatDependOnAttributes();
 }
 
-void NodeListsNodeData::invalidateCachesForDocument()
+void NodeListsNodeData::invalidateCachesThatDependOnAttributes()
 {
+    // Used by labels and region node lists on document.
     NodeListsNodeData::NodeListSet::iterator end = m_listsInvalidatedAtDocument.end();
     for (NodeListsNodeData::NodeListSet::iterator it = m_listsInvalidatedAtDocument.begin(); it != end; ++it)
         (*it)->invalidateCache();
-}
 
-void NodeListsNodeData::invalidateCachesThatDependOnAttributes()
-{
     ClassNodeListCache::iterator classCacheEnd = m_classNodeListCache.end();
     for (ClassNodeListCache::iterator it = m_classNodeListCache.begin(); it != classCacheEnd; ++it)
         it->second->invalidateCache();

Modified: branches/safari-536.28-branch/Source/WebCore/dom/Node.h (134469 => 134470)


--- branches/safari-536.28-branch/Source/WebCore/dom/Node.h	2012-11-13 20:54:46 UTC (rev 134469)
+++ branches/safari-536.28-branch/Source/WebCore/dom/Node.h	2012-11-13 21:04:25 UTC (rev 134470)
@@ -551,6 +551,8 @@
     void showTreeForThisAcrossFrame() const;
 #endif
 
+    void registerDynamicSubtreeNodeList(DynamicSubtreeNodeList*);
+    void unregisterDynamicSubtreeNodeList(DynamicSubtreeNodeList*);
     void invalidateNodeListsCacheAfterAttributeChanged(const QualifiedName&);
     void invalidateNodeListsCacheAfterChildrenChanged();
     void removeCachedClassNodeList(ClassNodeList*, const String&);

Modified: branches/safari-536.28-branch/Source/WebCore/dom/NodeRareData.h (134469 => 134470)


--- branches/safari-536.28-branch/Source/WebCore/dom/NodeRareData.h	2012-11-13 20:54:46 UTC (rev 134469)
+++ branches/safari-536.28-branch/Source/WebCore/dom/NodeRareData.h	2012-11-13 21:04:25 UTC (rev 134470)
@@ -26,7 +26,6 @@
 #include "ClassNodeList.h"
 #include "DOMSettableTokenList.h"
 #include "DynamicNodeList.h"
-#include "LabelsNodeList.h"
 #include "MutationObserverRegistration.h"
 #include "NameNodeList.h"
 #include "QualifiedName.h"
@@ -79,25 +78,10 @@
     }
 
     void invalidateCaches();
-    void invalidateCachesForDocument();
     void invalidateCachesThatDependOnAttributes();
 
     bool isEmpty() const;
 
-    void adoptTreeScope(TreeScope* oldTreeScope, TreeScope* newTreeScope, Document* oldDocument, Document* newDocument)
-    {
-        invalidateCaches();
-
-        if (oldDocument != newDocument) {
-            oldDocument->unregisterDynamicSubtreeNodeList(m_labelsNodeListCache);
-            newDocument->registerDynamicSubtreeNodeList(m_labelsNodeListCache);
-        }
-
-        if (oldTreeScope)
-            oldTreeScope->removeNodeListCache();
-        newTreeScope->addNodeListCache();
-    }
-
 private:
     NodeListsNodeData() : m_labelsNodeListCache(0) {}
 };

Modified: branches/safari-536.28-branch/Source/WebCore/dom/TagNodeList.cpp (134469 => 134470)


--- branches/safari-536.28-branch/Source/WebCore/dom/TagNodeList.cpp	2012-11-13 20:54:46 UTC (rev 134469)
+++ branches/safari-536.28-branch/Source/WebCore/dom/TagNodeList.cpp	2012-11-13 21:04:25 UTC (rev 134470)
@@ -40,9 +40,9 @@
 TagNodeList::~TagNodeList()
 {
     if (m_namespaceURI == starAtom)
-        ownerNode()->removeCachedTagNodeList(this, m_localName);
+        rootNode()->removeCachedTagNodeList(this, m_localName);
     else
-        ownerNode()->removeCachedTagNodeList(this, QualifiedName(nullAtom, m_localName, m_namespaceURI));
+        rootNode()->removeCachedTagNodeList(this, QualifiedName(nullAtom, m_localName, m_namespaceURI));
 }
 
 bool TagNodeList::nodeMatches(Element* testNode) const

Modified: branches/safari-536.28-branch/Source/WebCore/dom/TreeScopeAdopter.cpp (134469 => 134470)


--- branches/safari-536.28-branch/Source/WebCore/dom/TreeScopeAdopter.cpp	2012-11-13 20:54:46 UTC (rev 134469)
+++ branches/safari-536.28-branch/Source/WebCore/dom/TreeScopeAdopter.cpp	2012-11-13 21:04:25 UTC (rev 134470)
@@ -53,8 +53,12 @@
 
     for (Node* node = root; node; node = node->traverseNextNode(root)) {
         NodeRareData* rareData = node->setTreeScope(newDocument == m_newScope ? 0 : m_newScope);
-        if (rareData && rareData->nodeLists())
-            rareData->nodeLists()->adoptTreeScope(m_oldScope, m_newScope, oldDocument, newDocument);
+        if (rareData && rareData->nodeLists()) {
+            rareData->nodeLists()->invalidateCaches();
+            if (m_oldScope)
+                m_oldScope->removeNodeListCache();
+            m_newScope->addNodeListCache();
+        }
 
         if (willMoveToNewDocument)
             moveNodeToNewDocument(node, oldDocument, newDocument);

Modified: branches/safari-536.28-branch/Source/WebCore/html/LabelsNodeList.cpp (134469 => 134470)


--- branches/safari-536.28-branch/Source/WebCore/html/LabelsNodeList.cpp	2012-11-13 20:54:46 UTC (rev 134469)
+++ branches/safari-536.28-branch/Source/WebCore/html/LabelsNodeList.cpp	2012-11-13 21:04:25 UTC (rev 134470)
@@ -32,22 +32,21 @@
 
 using namespace HTMLNames;
 
-LabelsNodeList::LabelsNodeList(Node* forNode)
-    : DynamicSubtreeNodeList(forNode, RootedAtDocument)
-    , m_forNode(forNode)
+LabelsNodeList::LabelsNodeList(Node* forNode )
+    : DynamicSubtreeNodeList(forNode->document()) , m_forNode(forNode)
 {
     m_forNode->document()->registerDynamicSubtreeNodeList(this);
 }
 
 LabelsNodeList::~LabelsNodeList()
 {
-    ownerNode()->removeCachedLabelsNodeList(this);
-    ownerNode()->document()->unregisterDynamicSubtreeNodeList(this);
+    m_forNode->removeCachedLabelsNodeList(this);
+    m_forNode->document()->unregisterDynamicSubtreeNodeList(this);
 } 
     
 bool LabelsNodeList::nodeMatches(Element* testNode) const
 {
-    return testNode->hasTagName(labelTag) && static_cast<HTMLLabelElement*>(testNode)->control() == ownerNode();
+    return testNode->hasTagName(labelTag) && static_cast<HTMLLabelElement*>(testNode)->control() == m_forNode;
 }
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to