Title: [135695] trunk/Source/WebCore
Revision
135695
Author
morr...@google.com
Date
2012-11-26 02:21:53 -0800 (Mon, 26 Nov 2012)

Log Message

[Refactoring] Some Node::isDescendant calls can be replaced with Node::contains()
https://bugs.webkit.org/show_bug.cgi?id=103211

Reviewed by Daniel Bates.

A couple of call sites of isDescendant() does same as Node::contains().
This change replaces these locations with Node::contains().

No new tests, no behavior change.

* dom/Node.cpp:
(WebCore::checkAcceptChild):
* dom/Range.cpp:
(WebCore::Range::surroundContents):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (135694 => 135695)


--- trunk/Source/WebCore/ChangeLog	2012-11-26 10:11:53 UTC (rev 135694)
+++ trunk/Source/WebCore/ChangeLog	2012-11-26 10:21:53 UTC (rev 135695)
@@ -1,3 +1,20 @@
+2012-11-26  Hajime Morrita  <morr...@google.com>
+
+        [Refactoring] Some Node::isDescendant calls can be replaced with Node::contains()
+        https://bugs.webkit.org/show_bug.cgi?id=103211
+
+        Reviewed by Daniel Bates.
+
+        A couple of call sites of isDescendant() does same as Node::contains().
+        This change replaces these locations with Node::contains().
+
+        No new tests, no behavior change.
+
+        * dom/Node.cpp:
+        (WebCore::checkAcceptChild):
+        * dom/Range.cpp:
+        (WebCore::Range::surroundContents):
+
 2012-11-26  Kunihiko Sakamoto  <ksakam...@chromium.org>
 
         [Chromium] Enable input type datetime-local

Modified: trunk/Source/WebCore/dom/Node.cpp (135694 => 135695)


--- trunk/Source/WebCore/dom/Node.cpp	2012-11-26 10:11:53 UTC (rev 135694)
+++ trunk/Source/WebCore/dom/Node.cpp	2012-11-26 10:21:53 UTC (rev 135695)
@@ -1193,7 +1193,7 @@
     // HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the
     // newChild node, or if the node to append is one of this node's ancestors.
 
-    if (newChild == newParent || newParent->isDescendantOf(newChild)) {
+    if (newChild->contains(newParent)) {
         ec = HIERARCHY_REQUEST_ERR;
         return;
     }

Modified: trunk/Source/WebCore/dom/Range.cpp (135694 => 135695)


--- trunk/Source/WebCore/dom/Range.cpp	2012-11-26 10:11:53 UTC (rev 135694)
+++ trunk/Source/WebCore/dom/Range.cpp	2012-11-26 10:21:53 UTC (rev 135695)
@@ -1447,7 +1447,7 @@
         return;
     }
     
-    if (m_start.container() == newParent || m_start.container()->isDescendantOf(newParent.get())) {
+    if (newParent->contains(m_start.container())) {
         ec = HIERARCHY_REQUEST_ERR;
         return;
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to