[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

hyatt hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:51:27 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 62145fc2d30477e207d90c4368d4693c49646db6
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Jul 19 23:33:50 2004 +0000

    	Fix for 3715117, crash from a bug in removeChildren.  Clean up node removal and fix an n-squared removal
    	bug.  Also clean up checks in removeChild and in the dispatch of removedFromDocument mutation events to
    	make node removal more efficient.
    
            Reviewed by kocienda
    
            * khtml/xml/dom_nodeimpl.cpp:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@7057 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 3e00e50..d9d1a55 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,13 @@
+2004-07-19  David Hyatt  <hyatt at apple.com>
+
+	Fix for 3715117, crash from a bug in removeChildren.  Clean up node removal and fix an n-squared removal
+	bug.  Also clean up checks in removeChild and in the dispatch of removedFromDocument mutation events to
+	make node removal more efficient.
+	
+        Reviewed by kocienda
+
+        * khtml/xml/dom_nodeimpl.cpp:
+
 2004-07-19  John Sullivan  <sullivan at apple.com>
 
         Reviewed by Trey.
diff --git a/WebCore/khtml/xml/dom_nodeimpl.cpp b/WebCore/khtml/xml/dom_nodeimpl.cpp
index cf3bf46..1345267 100644
--- a/WebCore/khtml/xml/dom_nodeimpl.cpp
+++ b/WebCore/khtml/xml/dom_nodeimpl.cpp
@@ -1668,33 +1668,37 @@ NodeImpl *NodeBaseImpl::removeChild ( NodeImpl *oldChild, int &exceptioncode )
     // Dispatch post-removal mutation events
     dispatchSubtreeModifiedEvent();
 
-    NodeImpl *p = this;
-    while (p->parentNode())
-	p = p->parentNode();
-    if (p->nodeType() == Node::DOCUMENT_NODE) {
-	for (NodeImpl *c = oldChild; c; c = c->traverseNextNode(oldChild))
-	    c->removedFromDocument();
-    }
+    if (oldChild->inDocument())
+        oldChild->removedFromDocument();
 
     return oldChild;
 }
 
 void NodeBaseImpl::removeChildren()
 {
+    int exceptionCode;
     while (NodeImpl *n = _first) {
         NodeImpl *next = n->nextSibling();
+        
+        // Fire removed from document mutation events.
+        dispatchChildRemovalEvents(n, exceptionCode);
+    
         if (n->attached())
 	    n->detach();
-        if (n->inDocument())
-            n->removedFromDocument();
         n->setPreviousSibling(0);
         n->setNextSibling(0);
         n->setParent(0);
+        
+        if (n->inDocument())
+            n->removedFromDocument();
         if (!n->refCount())
             delete n;
         _first = next;
     }
     _last = 0;
+    
+    // Dispatch a single post-removal mutation event denoting a modified subtree.
+    dispatchSubtreeModifiedEvent();
 }
 
 
@@ -2117,10 +2121,7 @@ void NodeBaseImpl::dispatchChildRemovalEvents( NodeImpl *child, int &exceptionco
     bool hasRemovalListeners = getDocument()->hasListenerType(DocumentImpl::DOMNODEREMOVEDFROMDOCUMENT_LISTENER);
 
     // dispatch the DOMNOdeRemovedFromDocument event to all descendants
-    NodeImpl *p = this;
-    while (p->parentNode())
-	p = p->parentNode();
-    if (p->nodeType() == Node::DOCUMENT_NODE) {
+    if (inDocument()) {
 	for (NodeImpl *c = child; c; c = c->traverseNextNode(child)) {
 	    if (hasRemovalListeners) {
 		c->dispatchEvent(new MutationEventImpl(EventImpl::DOMNODEREMOVEDFROMDOCUMENT_EVENT,

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list