[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

dglazkov at chromium.org dglazkov at chromium.org
Sun Feb 20 22:55:54 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit dbe91107fbf287d17df02198a1d5db2a550f6c1c
Author: dglazkov at chromium.org <dglazkov at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 13 23:38:32 2011 +0000

    2011-01-13  Dimitri Glazkov  <dglazkov at chromium.org>
    
            Reviewed by Darin Adler.
    
            Transferring nodes between documents should be aware of the shadow DOM.
            https://bugs.webkit.org/show_bug.cgi?id=52399
    
            No visible change in behavior at the moment.
    
            Once https://bugs.webkit.org/show_bug.cgi?id=52317 lands, the following
            tests should no longer crash:
            * fast/css/pseudo-in-range-invalid-value.html
            * fast/css/pseudo-in-range.html
            * fast/forms/form-collection-elements.html
            * fast/forms/range-keyoperation.html
    
            * dom/Document.cpp:
            (WebCore::Document::adoptNode): Changed to use Node::setDocumentRecursively.
            * dom/Node.cpp:
            (WebCore::Node::setDocumentRecursively): Added new method, taking existing
                logic and adding shadow DOM traversal.
            (WebCore::Node::traverseNextNode): Style fix.
            (WebCore::Node::traverseNextSibling): Ditto.
            (WebCore::Node::traversePreviousNode): Ditto.
            (WebCore::Node::traversePreviousNodePostOrder): Ditto.
            (WebCore::Node::checkReplaceChild): Changed to use setDocumentRecursively.
            (WebCore::Node::checkAddChild): Ditto.
            * dom/Node.h: Added def.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75746 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 99b84b5..f13aed8 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,32 @@
+2011-01-13  Dimitri Glazkov  <dglazkov at chromium.org>
+
+        Reviewed by Darin Adler.
+
+        Transferring nodes between documents should be aware of the shadow DOM.
+        https://bugs.webkit.org/show_bug.cgi?id=52399
+
+        No visible change in behavior at the moment.
+
+        Once https://bugs.webkit.org/show_bug.cgi?id=52317 lands, the following
+        tests should no longer crash:
+        * fast/css/pseudo-in-range-invalid-value.html
+        * fast/css/pseudo-in-range.html
+        * fast/forms/form-collection-elements.html
+        * fast/forms/range-keyoperation.html
+
+        * dom/Document.cpp:
+        (WebCore::Document::adoptNode): Changed to use Node::setDocumentRecursively.
+        * dom/Node.cpp:
+        (WebCore::Node::setDocumentRecursively): Added new method, taking existing
+            logic and adding shadow DOM traversal.
+        (WebCore::Node::traverseNextNode): Style fix.
+        (WebCore::Node::traverseNextSibling): Ditto.
+        (WebCore::Node::traversePreviousNode): Ditto.
+        (WebCore::Node::traversePreviousNodePostOrder): Ditto.
+        (WebCore::Node::checkReplaceChild): Changed to use setDocumentRecursively.
+        (WebCore::Node::checkAddChild): Ditto.
+        * dom/Node.h: Added def.
+
 2011-01-12  Enrica Casucci  <enrica at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp
index 42a6868..ed7909c 100644
--- a/Source/WebCore/dom/Document.cpp
+++ b/Source/WebCore/dom/Document.cpp
@@ -909,9 +909,8 @@ PassRefPtr<Node> Document::adoptNode(PassRefPtr<Node> source, ExceptionCode& ec)
         if (source->parentNode())
             source->parentNode()->removeChild(source.get(), ec);
     }
-                
-    for (Node* node = source.get(); node; node = node->traverseNextNode(source.get()))
-        node->setDocument(this);
+
+    source->setDocumentRecursively(this);
 
     return source;
 }
diff --git a/Source/WebCore/dom/Node.cpp b/Source/WebCore/dom/Node.cpp
index 4d50ef2..7837707 100644
--- a/Source/WebCore/dom/Node.cpp
+++ b/Source/WebCore/dom/Node.cpp
@@ -751,6 +751,21 @@ bool Node::hasNonEmptyBoundingBox() const
     return false;
 }
 
+void Node::setDocumentRecursively(Document* document)
+{
+    // FIXME: To match Gecko, we should do this for nodes that are already in the document as well.
+    if (this->document() == document || this->inDocument())
+        return;
+
+    for (Node* node = this; node; node = node->traverseNextNode(this)) {
+        node->setDocument(document);
+        if (!node->isElementNode())
+            continue;
+        if (Node* shadow = toElement(node)->shadowRoot())
+            shadow->setDocumentRecursively(document);
+    }
+}
+
 inline void Node::setStyleChange(StyleChangeType changeType)
 {
     m_nodeFlags = (m_nodeFlags & ~StyleChangeMask) | changeType;
@@ -993,7 +1008,7 @@ void Node::removeCachedLabelsNodeList(DynamicNodeList* list)
     data->m_labelsNodeListCache = 0;
 }
 
-Node *Node::traverseNextNode(const Node *stayWithin) const
+Node* Node::traverseNextNode(const Node* stayWithin) const
 {
     if (firstChild())
         return firstChild();
@@ -1009,7 +1024,7 @@ Node *Node::traverseNextNode(const Node *stayWithin) const
     return 0;
 }
 
-Node *Node::traverseNextSibling(const Node *stayWithin) const
+Node* Node::traverseNextSibling(const Node* stayWithin) const
 {
     if (this == stayWithin)
         return 0;
@@ -1033,7 +1048,7 @@ Node* Node::traverseNextNodePostOrder() const
     return next;
 }
 
-Node *Node::traversePreviousNode(const Node *stayWithin) const
+Node* Node::traversePreviousNode(const Node* stayWithin) const
 {
     if (this == stayWithin)
         return 0;
@@ -1046,7 +1061,7 @@ Node *Node::traversePreviousNode(const Node *stayWithin) const
     return parentNode();
 }
 
-Node *Node::traversePreviousNodePostOrder(const Node *stayWithin) const
+Node* Node::traversePreviousNodePostOrder(const Node* stayWithin) const
 {
     if (lastChild())
         return lastChild();
@@ -1158,15 +1173,6 @@ static void checkAcceptChild(Node* newParent, Node* newChild, ExceptionCode& ec)
     }
 }
 
-static void transferOwnerDocument(Document* newDocument, Node* root)
-{
-    // FIXME: To match Gecko, we should do this for nodes that are already in the document as well.
-    if (root->document() != newDocument && !root->inDocument()) {
-        for (Node* node = root; node; node = node->traverseNextNode(root))
-            node->setDocument(newDocument);
-    }
-}
-
 void Node::checkReplaceChild(Node* newChild, Node* oldChild, ExceptionCode& ec)
 {
     checkAcceptChild(this, newChild, ec);
@@ -1178,7 +1184,7 @@ void Node::checkReplaceChild(Node* newChild, Node* oldChild, ExceptionCode& ec)
         return;
     }
 
-    transferOwnerDocument(document(), newChild);
+    newChild->setDocumentRecursively(document());
 }
 
 void Node::checkAddChild(Node *newChild, ExceptionCode& ec)
@@ -1192,7 +1198,7 @@ void Node::checkAddChild(Node *newChild, ExceptionCode& ec)
         return;
     }
 
-    transferOwnerDocument(document(), newChild);
+    newChild->setDocumentRecursively(document());
 }
 
 bool Node::isDescendantOf(const Node *other) const
diff --git a/Source/WebCore/dom/Node.h b/Source/WebCore/dom/Node.h
index 92ba9d3..7c88f0f 100644
--- a/Source/WebCore/dom/Node.h
+++ b/Source/WebCore/dom/Node.h
@@ -372,7 +372,7 @@ public:
     // argument is non-null, the traversal will stop once the specified node is reached.
     // This can be used to restrict traversal to a particular sub-tree.
     Node* traverseNextNode(const Node* stayWithin = 0) const;
-    
+
     // Like traverseNextNode, but skips children and starts with the next sibling.
     Node* traverseNextSibling(const Node* stayWithin = 0) const;
 
@@ -644,6 +644,7 @@ private:
     void markCachedNodeListsSlow(JSC::MarkStack&, JSC::JSGlobalData&);
 #endif
 
+    void setDocumentRecursively(Document*);
     void setStyleChange(StyleChangeType);
 
     // Used to share code between lazyAttach and setNeedsStyleRecalc.

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list