[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

simon.fraser at apple.com simon.fraser at apple.com
Wed Dec 22 12:29:42 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit ff8a152a6eef98b3e00b3fc381b01998dc80e7ac
Author: simon.fraser at apple.com <simon.fraser at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Aug 24 20:08:41 2010 +0000

    2010-08-24  Simon Fraser  <simon.fraser at apple.com>
    
            Reviewed by Sam Weinig.
    
            TreeWalker traversal order is wrong when skipping and rejecting
            https://bugs.webkit.org/show_bug.cgi?id=44377
    
            TreeWalker's nextSibling() and previousSibling() behaved incorrectly
            when traversing down a subtree where all nodes are skipped; it backed all
            the way up to the root of the subtree, then jump to the subtree's parentNode.
            This would skip later siblings.
    
            Fix by resetting 'node' when traversing to children so that node = node->parentNode()
            gets the correct node later.
    
            Test: fast/dom/TreeWalker/traversal-skip-most.html
    
            * dom/TreeWalker.cpp:
            (WebCore::TreeWalker::previousSibling):
            (WebCore::TreeWalker::nextSibling):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65926 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 2d6e93a..00dd6e6 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -5,6 +5,21 @@
         TreeWalker traversal order is wrong when skipping and rejecting
         https://bugs.webkit.org/show_bug.cgi?id=44377
         
+        TreeWalker test where skipping nodes requires the walker to back up
+        the hierarchy.
+
+        * fast/dom/TreeWalker/script-tests/traversal-skip-most.js: Added.
+        (filter.acceptNode):
+        * fast/dom/TreeWalker/traversal-skip-most-expected.txt: Added.
+        * fast/dom/TreeWalker/traversal-skip-most.html: Added.
+
+2010-08-24  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        TreeWalker traversal order is wrong when skipping and rejecting
+        https://bugs.webkit.org/show_bug.cgi?id=44377
+        
         Add some tests for TreeWalker with node filters that skip and reject.
 
         * fast/dom/TreeWalker/script-tests/traversal-reject.js: Added.
diff --git a/LayoutTests/fast/dom/TreeWalker/script-tests/traversal-skip-most.js b/LayoutTests/fast/dom/TreeWalker/script-tests/traversal-skip-most.js
new file mode 100644
index 0000000..b3d21ab
--- /dev/null
+++ b/LayoutTests/fast/dom/TreeWalker/script-tests/traversal-skip-most.js
@@ -0,0 +1,27 @@
+description('Test TreeWalker with skipping');
+
+var walker;
+var testElement = document.createElement("div");
+testElement.innerHTML='<div id="A1"><div id="B1" class="keep"></div><div id="B2">this text matters</div><div id="B3" class="keep"></div></div>';
+
+var filter = {
+  acceptNode: function(node) {
+    if (node.className == 'keep')
+      return NodeFilter.FILTER_ACCEPT;
+
+    return NodeFilter.FILTER_SKIP;
+  }
+}
+
+debug("<br>Testing nextSibling")
+walker = document.createTreeWalker(testElement, NodeFilter.SHOW_ELEMENT, filter, false);
+shouldBe("walker.firstChild(); walker.currentNode.id", "'B1'");
+shouldBe("walker.nextSibling(); walker.currentNode.id", "'B3'");
+
+debug("<br>Testing previousSibling")
+walker = document.createTreeWalker(testElement, NodeFilter.SHOW_ELEMENT, filter, false);
+walker.currentNode = testElement.querySelectorAll('#B3')[0];
+shouldBe("walker.previousSibling(); walker.currentNode.id", "'B1'");
+
+
+var successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/TreeWalker/traversal-skip-most-expected.txt b/LayoutTests/fast/dom/TreeWalker/traversal-skip-most-expected.txt
new file mode 100644
index 0000000..2be59a2
--- /dev/null
+++ b/LayoutTests/fast/dom/TreeWalker/traversal-skip-most-expected.txt
@@ -0,0 +1,16 @@
+Test TreeWalker with skipping
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+Testing nextSibling
+PASS walker.firstChild(); walker.currentNode.id is 'B1'
+PASS walker.nextSibling(); walker.currentNode.id is 'B3'
+
+Testing previousSibling
+PASS walker.previousSibling(); walker.currentNode.id is 'B1'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/TreeWalker/traversal-skip-most.html b/LayoutTests/fast/dom/TreeWalker/traversal-skip-most.html
new file mode 100644
index 0000000..141f979
--- /dev/null
+++ b/LayoutTests/fast/dom/TreeWalker/traversal-skip-most.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/traversal-skip-most.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index ce965e6..1b308f5 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,24 @@
+2010-08-24  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        TreeWalker traversal order is wrong when skipping and rejecting
+        https://bugs.webkit.org/show_bug.cgi?id=44377
+        
+        TreeWalker's nextSibling() and previousSibling() behaved incorrectly
+        when traversing down a subtree where all nodes are skipped; it backed all
+        the way up to the root of the subtree, then jump to the subtree's parentNode.
+        This would skip later siblings.
+        
+        Fix by resetting 'node' when traversing to children so that node = node->parentNode()
+        gets the correct node later.
+
+        Test: fast/dom/TreeWalker/traversal-skip-most.html
+
+        * dom/TreeWalker.cpp:
+        (WebCore::TreeWalker::previousSibling):
+        (WebCore::TreeWalker::nextSibling):
+
 2010-08-24  Hans Wennborg  <hans at chromium.org>
 
         Reviewed by Steve Block.
diff --git a/WebCore/dom/TreeWalker.cpp b/WebCore/dom/TreeWalker.cpp
index 9c46fb3..6a8ca87 100644
--- a/WebCore/dom/TreeWalker.cpp
+++ b/WebCore/dom/TreeWalker.cpp
@@ -153,6 +153,7 @@ Node* TreeWalker::previousSibling(ScriptState* state)
                 case NodeFilter::FILTER_SKIP:
                     if (sibling->lastChild()) {
                         sibling = sibling->lastChild();
+                        node = sibling;
                         continue;
                     }
                     break;
@@ -189,6 +190,7 @@ Node* TreeWalker::nextSibling(ScriptState* state)
                 case NodeFilter::FILTER_SKIP:
                     if (sibling->firstChild()) {
                         sibling = sibling->firstChild();
+                        node = sibling;
                         continue;
                     }
                     break;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list