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

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:52:59 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit bc2d605a162ae03851c6320384dccc2058f2505a
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jul 28 16:36:14 2004 +0000

            Reviewed by Trey.
    
            - fixed <rdar://problem/3658471> REGRESSION: Node.appendChild( ) fails when parent already contains that child
    
            * khtml/xml/dom_nodeimpl.cpp: (NodeImpl::isAncestor): Restore the original meaning of this function.
            It returns true if the parameter is an ancestor of this, but had been changed to return true if this
            is an ancestor of the parameter. However, we do retain one change we made at the same time, which is
            that it does not consider a node an ancestor of itself.
    
            * khtml/editing/htmlediting_impl.cpp: (khtml::ApplyStyleCommandImpl::nodeFullySelected):
            * khtml/xml/dom2_traversalimpl.cpp: (DOM::NodeIteratorImpl::notifyBeforeNodeRemoval):
            Reverse parameters for callers who wanted the new meaning of isAncestor, with care to not use it in
            any cases where the pointer might be 0.
    
            * khtml/xml/dom_nodeimpl.h: Added const to the parameter to make things more symmetric and allow the
            new uses to all compile.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@7136 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 8805551..04c299e 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,22 @@
+2004-07-28  Darin Adler  <darin at apple.com>
+
+        Reviewed by Trey.
+
+        - fixed <rdar://problem/3658471> REGRESSION: Node.appendChild( ) fails when parent already contains that child
+
+        * khtml/xml/dom_nodeimpl.cpp: (NodeImpl::isAncestor): Restore the original meaning of this function.
+        It returns true if the parameter is an ancestor of this, but had been changed to return true if this
+        is an ancestor of the parameter. However, we do retain one change we made at the same time, which is
+        that it does not consider a node an ancestor of itself.
+
+        * khtml/editing/htmlediting_impl.cpp: (khtml::ApplyStyleCommandImpl::nodeFullySelected):
+        * khtml/xml/dom2_traversalimpl.cpp: (DOM::NodeIteratorImpl::notifyBeforeNodeRemoval):
+        Reverse parameters for callers who wanted the new meaning of isAncestor, with care to not use it in
+        any cases where the pointer might be 0.
+
+        * khtml/xml/dom_nodeimpl.h: Added const to the parameter to make things more symmetric and allow the
+        new uses to all compile.
+
 2004-07-28  Ken Kocienda  <kocienda at apple.com>
 
         Reviewed by Darin
diff --git a/WebCore/khtml/editing/htmlediting_impl.cpp b/WebCore/khtml/editing/htmlediting_impl.cpp
index 591a47b..46a6779 100644
--- a/WebCore/khtml/editing/htmlediting_impl.cpp
+++ b/WebCore/khtml/editing/htmlediting_impl.cpp
@@ -758,7 +758,7 @@ bool ApplyStyleCommandImpl::nodeFullySelected(const NodeImpl *node) const
             return end.offset() >= child->caretMaxOffset();
     }
 
-    return !node->isAncestor(end.node());
+    return !end.node()->isAncestor(node);
 }
 
 //------------------------------------------------------------------------------------------
diff --git a/WebCore/khtml/xml/dom2_traversalimpl.cpp b/WebCore/khtml/xml/dom2_traversalimpl.cpp
index bed709d..8ccf9d6 100644
--- a/WebCore/khtml/xml/dom2_traversalimpl.cpp
+++ b/WebCore/khtml/xml/dom2_traversalimpl.cpp
@@ -194,7 +194,7 @@ void NodeIteratorImpl::notifyBeforeNodeRemoval(NodeImpl *willRemove)
     if (!willRemove || willRemove == root())
         return;
     bool willRemoveReferenceNode = willRemove == referenceNode();
-    bool willRemoveReferenceNodeAncestor = willRemove->isAncestor(referenceNode());
+    bool willRemoveReferenceNodeAncestor = referenceNode() && referenceNode()->isAncestor(willRemove);
     if (!willRemoveReferenceNode && !willRemoveReferenceNodeAncestor)
         return;
 
@@ -204,7 +204,7 @@ void NodeIteratorImpl::notifyBeforeNodeRemoval(NodeImpl *willRemove)
             // Move out from under the node being removed if the reference node is
             // a descendant of the node being removed.
             if (willRemoveReferenceNodeAncestor) {
-                while (node && willRemove->isAncestor(node))
+                while (node && node->isAncestor(willRemove))
                     node = findNextNode(node);
             }
             if (node)
@@ -216,7 +216,7 @@ void NodeIteratorImpl::notifyBeforeNodeRemoval(NodeImpl *willRemove)
                 // Move out from under the node being removed if the reference node is
                 // a descendant of the node being removed.
                 if (willRemoveReferenceNodeAncestor) {
-                    while (node && willRemove->isAncestor(node))
+                    while (node && node->isAncestor(willRemove))
                         node = findPreviousNode(node);
                 }
                 if (node) {
@@ -235,7 +235,7 @@ void NodeIteratorImpl::notifyBeforeNodeRemoval(NodeImpl *willRemove)
             // Move out from under the node being removed if the reference node is
             // a descendant of the node being removed.
             if (willRemoveReferenceNodeAncestor) {
-                while (node && willRemove->isAncestor(node))
+                while (node && node->isAncestor(willRemove))
                     node = findPreviousNode(node);
             }
             if (node)
@@ -246,7 +246,7 @@ void NodeIteratorImpl::notifyBeforeNodeRemoval(NodeImpl *willRemove)
                 // Move out from under the node being removed if the reference node is
                 // a descendant of the node being removed.
                 if (willRemoveReferenceNodeAncestor) {
-                    while (node && willRemove->isAncestor(node))
+                    while (node && node->isAncestor(willRemove))
                         node = findPreviousNode(node);
                 }
                 if (node)
diff --git a/WebCore/khtml/xml/dom_nodeimpl.cpp b/WebCore/khtml/xml/dom_nodeimpl.cpp
index 1345267..8a180d3 100644
--- a/WebCore/khtml/xml/dom_nodeimpl.cpp
+++ b/WebCore/khtml/xml/dom_nodeimpl.cpp
@@ -1033,12 +1033,11 @@ void NodeImpl::checkAddChild(NodeImpl *newChild, int &exceptioncode)
     }
 }
 
-bool NodeImpl::isAncestor(NodeImpl *node) const
+bool NodeImpl::isAncestor(const NodeImpl *other) const
 {
-    if (!node || node == this)
-        return false;
-    for (NodeImpl *p = node->parentNode(); p; p = p->parentNode()) {
-        if (p == this)
+    // Return true if other is an ancestor of this, otherwise false
+    for (const NodeImpl *n = parentNode(); n; n = n->parentNode()) {
+        if (n == other)
             return true;
     }
     return false;
diff --git a/WebCore/khtml/xml/dom_nodeimpl.h b/WebCore/khtml/xml/dom_nodeimpl.h
index bb4be4b..e0908d5 100644
--- a/WebCore/khtml/xml/dom_nodeimpl.h
+++ b/WebCore/khtml/xml/dom_nodeimpl.h
@@ -343,7 +343,7 @@ public:
     
     void checkSetPrefix(const DOMString &_prefix, int &exceptioncode);
     void checkAddChild(NodeImpl *newChild, int &exceptioncode);
-    bool isAncestor(NodeImpl *) const;
+    bool isAncestor(const NodeImpl *) const;
     virtual bool childAllowed( NodeImpl *newChild );
 
     virtual long maxOffset() const;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list