Title: [178904] branches/safari-600.5-branch

Diff

Modified: branches/safari-600.5-branch/LayoutTests/ChangeLog (178903 => 178904)


--- branches/safari-600.5-branch/LayoutTests/ChangeLog	2015-01-22 09:31:59 UTC (rev 178903)
+++ branches/safari-600.5-branch/LayoutTests/ChangeLog	2015-01-22 09:32:03 UTC (rev 178904)
@@ -1,5 +1,24 @@
 2015-01-22  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r173688. rdar://problem/19451277
+
+    2014-09-16  Yusuke Suzuki  <utatane....@gmail.com>
+
+            filterRootById accidentally clears inAdjacentChain flag
+            https://bugs.webkit.org/show_bug.cgi?id=136851
+
+            Reviewed by Benjamin Poulain.
+
+            When SubSelector comes, `inAdjacentChain` flag is cleared to false.
+            So for example, `document.querySelector("span#id + ok")` doesn't work correctly.
+            In this patch, we handles SubSelector relation correctly; don't change `inAdjacentChain` flag
+            to filter the right search root node.
+
+            * fast/selectors/filter-root-node-with-selector-contains-adjacents-expected.txt: Added.
+            * fast/selectors/filter-root-node-with-selector-contains-adjacents.html: Added.
+
+2015-01-22  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r172797. rdar://problem/19451324
 
     2014-08-20  Zalan Bujtas  <za...@apple.com>

Added: branches/safari-600.5-branch/LayoutTests/fast/selectors/filter-root-node-with-selector-contains-adjacents-expected.txt (0 => 178904)


--- branches/safari-600.5-branch/LayoutTests/fast/selectors/filter-root-node-with-selector-contains-adjacents-expected.txt	                        (rev 0)
+++ branches/safari-600.5-branch/LayoutTests/fast/selectors/filter-root-node-with-selector-contains-adjacents-expected.txt	2015-01-22 09:32:03 UTC (rev 178904)
@@ -0,0 +1,34 @@
+Test filtering the root nodes by leveraging #id inside selectors with adjacents.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.querySelectorAll("span#first + t1").length is 1
+PASS document.querySelectorAll("span#second ~ t2").length is 1
+PASS document.querySelectorAll("span#third + t3 > t4").length is 1
+PASS document.querySelectorAll("span#third + t3 > t5").length is 0
+PASS document.querySelectorAll("span#fourth t6 ~ t7").length is 3
+PASS document.querySelectorAll(".ok#first + t1").length is 1
+PASS document.querySelectorAll(".ok#second ~ t2").length is 1
+PASS document.querySelectorAll(".ok#third + t3 > t4").length is 1
+PASS document.querySelectorAll(".ok#third + t3 > t5").length is 0
+PASS document.querySelectorAll(".ok#fourth t6 ~ t7").length is 3
+PASS document.querySelectorAll("#first.ok + t1").length is 1
+PASS document.querySelectorAll("#second.ok ~ t2").length is 1
+PASS document.querySelectorAll("#third.ok + t3 > t4").length is 1
+PASS document.querySelectorAll("#third.ok + t3 > t5").length is 0
+PASS document.querySelectorAll("#fourth.ok t6 ~ t7").length is 3
+PASS document.querySelectorAll("span#first.ok + t1").length is 1
+PASS document.querySelectorAll("span#second.ok ~ t2").length is 1
+PASS document.querySelectorAll("span#third.ok + t3 > t4").length is 1
+PASS document.querySelectorAll("span#third.ok + t3 > t5").length is 0
+PASS document.querySelectorAll("span#fourth.ok t6 ~ t7").length is 3
+PASS document.querySelectorAll("span.ok#first + t1").length is 1
+PASS document.querySelectorAll("span.ok#second ~ t2").length is 1
+PASS document.querySelectorAll("span.ok#third + t3 > t4").length is 1
+PASS document.querySelectorAll("span.ok#third + t3 > t5").length is 0
+PASS document.querySelectorAll("span.ok#fourth t6 ~ t7").length is 3
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: branches/safari-600.5-branch/LayoutTests/fast/selectors/filter-root-node-with-selector-contains-adjacents.html (0 => 178904)


--- branches/safari-600.5-branch/LayoutTests/fast/selectors/filter-root-node-with-selector-contains-adjacents.html	                        (rev 0)
+++ branches/safari-600.5-branch/LayoutTests/fast/selectors/filter-root-node-with-selector-contains-adjacents.html	2015-01-22 09:32:03 UTC (rev 178904)
@@ -0,0 +1,47 @@
+<!doctype html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<div style="display:none">
+    <span class="ok" id="first"></span>
+    <t1></t1>
+
+    <span class="ok" id="second"></span>
+    <t2></t2>
+
+    <span class="ok" id="third"></span>
+    <t3><t4></t4></t3>
+
+    <span class="ok" id="fourth">
+        <t6>
+        </t6>
+        <t7></t7>
+        <t7></t7>
+        <t7>
+            <t7></t7>
+        </t7>
+    </span>
+</div>
+</body>
+<script>
+description('Test filtering the root nodes by leveraging #id inside selectors with adjacents.');
+
+[
+    'span$',
+    '.ok$',
+    '$.ok',
+    'span$.ok',
+    'span.ok$'
+].forEach(function (selector) {
+    shouldBe('document.querySelectorAll("' + selector.replace('$', '#first')  + ' + t1").length', '1');
+    shouldBe('document.querySelectorAll("' + selector.replace('$', '#second') + ' ~ t2").length', '1');
+    shouldBe('document.querySelectorAll("' + selector.replace('$', '#third')  + ' + t3 > t4").length', '1');
+    shouldBe('document.querySelectorAll("' + selector.replace('$', '#third')  + ' + t3 > t5").length', '0');
+    shouldBe('document.querySelectorAll("' + selector.replace('$', '#fourth') + ' t6 ~ t7").length', '3');
+});
+
+</script>
+<script src=""
+</html>

Modified: branches/safari-600.5-branch/Source/WebCore/ChangeLog (178903 => 178904)


--- branches/safari-600.5-branch/Source/WebCore/ChangeLog	2015-01-22 09:31:59 UTC (rev 178903)
+++ branches/safari-600.5-branch/Source/WebCore/ChangeLog	2015-01-22 09:32:03 UTC (rev 178904)
@@ -1,5 +1,21 @@
 2015-01-22  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r173688. rdar://problem/19451277
+
+    2014-09-16  Yusuke Suzuki  <utatane....@gmail.com>
+
+            filterRootById accidentally clears inAdjacentChain flag
+            https://bugs.webkit.org/show_bug.cgi?id=136851
+
+            Reviewed by Benjamin Poulain.
+
+            Test: fast/selectors/filter-root-node-with-selector-contains-adjacents.html
+
+            * dom/SelectorQuery.cpp:
+            (WebCore::filterRootById):
+
+2015-01-22  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r172797. rdar://problem/19451324
 
     2014-08-20  Zalan Bujtas  <za...@apple.com>

Modified: branches/safari-600.5-branch/Source/WebCore/dom/SelectorQuery.cpp (178903 => 178904)


--- branches/safari-600.5-branch/Source/WebCore/dom/SelectorQuery.cpp	2015-01-22 09:31:59 UTC (rev 178903)
+++ branches/safari-600.5-branch/Source/WebCore/dom/SelectorQuery.cpp	2015-01-22 09:32:03 UTC (rev 178904)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2011, 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 Yusuke Suzuki <utatane....@gmail.com>
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -251,6 +252,8 @@
                 }
             }
         }
+        if (selector->relation() == CSSSelector::SubSelector)
+            continue;
         if (selector->relation() == CSSSelector::DirectAdjacent || selector->relation() == CSSSelector::IndirectAdjacent)
             inAdjacentChain = true;
         else
@@ -494,7 +497,7 @@
     const int maximumSelectorQueryCacheSize = 256;
     if (m_entries.size() == maximumSelectorQueryCacheSize)
         m_entries.remove(m_entries.begin());
-    
+
     return m_entries.add(selectors, std::make_unique<SelectorQuery>(WTF::move(selectorList))).iterator->value.get();
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to