Title: [155129] branches/safari-537-branch

Diff

Modified: branches/safari-537-branch/LayoutTests/ChangeLog (155128 => 155129)


--- branches/safari-537-branch/LayoutTests/ChangeLog	2013-09-05 17:28:28 UTC (rev 155128)
+++ branches/safari-537-branch/LayoutTests/ChangeLog	2013-09-05 17:35:59 UTC (rev 155129)
@@ -1,3 +1,17 @@
+2013-09-05  Lucas Forschler  <[email protected]>
+
+        Merge r154037
+
+    2013-08-13  Ryosuke Niwa  <[email protected]>
+
+            REGRESSION(r150187): Safari fails to render allrecipe.com comment popups
+            https://bugs.webkit.org/show_bug.cgi?id=119780
+
+            Reviewed by Benjamin Poulain.
+
+            * fast/selectors/querySelector-id-with-multiple-elements-with-same-id-expected.txt: Added.
+            * fast/selectors/querySelector-id-with-multiple-elements-with-same-id.html: Added.
+
 2013-09-04  Lucas Forschler  <[email protected]>
 
         Merge r155014

Copied: branches/safari-537-branch/LayoutTests/fast/selectors/querySelector-id-with-multiple-elements-with-same-id-expected.txt (from rev 154037, trunk/LayoutTests/fast/selectors/querySelector-id-with-multiple-elements-with-same-id-expected.txt) (0 => 155129)


--- branches/safari-537-branch/LayoutTests/fast/selectors/querySelector-id-with-multiple-elements-with-same-id-expected.txt	                        (rev 0)
+++ branches/safari-537-branch/LayoutTests/fast/selectors/querySelector-id-with-multiple-elements-with-same-id-expected.txt	2013-09-05 17:35:59 UTC (rev 155129)
@@ -0,0 +1,11 @@
+This test makes sure WebKit element.querySelector("#foo") returns a descendent node of the element even when there are multiple elements with the id foo.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS container.querySelectorAll("#foo").length is 1
+PASS container.querySelectorAll("#foo")[0] is container.firstChild
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Copied: branches/safari-537-branch/LayoutTests/fast/selectors/querySelector-id-with-multiple-elements-with-same-id.html (from rev 154037, trunk/LayoutTests/fast/selectors/querySelector-id-with-multiple-elements-with-same-id.html) (0 => 155129)


--- branches/safari-537-branch/LayoutTests/fast/selectors/querySelector-id-with-multiple-elements-with-same-id.html	                        (rev 0)
+++ branches/safari-537-branch/LayoutTests/fast/selectors/querySelector-id-with-multiple-elements-with-same-id.html	2013-09-05 17:35:59 UTC (rev 155129)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<body>
+<span id="foo"></span>
+<div id="container"><span id="foo"></span></div>
+</body>
+<script src=""
+<script>
+description('This test makes sure WebKit element.querySelector("#foo") returns a descendent node of the element even when there are multiple elements with the id foo.');
+
+var container = document.getElementById('container');
+shouldBe('container.querySelectorAll("#foo").length', '1');
+shouldBe('container.querySelectorAll("#foo")[0]', 'container.firstChild');
+
+</script>
+<script src=""
+</html>

Modified: branches/safari-537-branch/Source/WebCore/ChangeLog (155128 => 155129)


--- branches/safari-537-branch/Source/WebCore/ChangeLog	2013-09-05 17:28:28 UTC (rev 155128)
+++ branches/safari-537-branch/Source/WebCore/ChangeLog	2013-09-05 17:35:59 UTC (rev 155129)
@@ -1,3 +1,26 @@
+2013-09-05  Lucas Forschler  <[email protected]>
+
+        Merge r154037
+
+    2013-08-13  Ryosuke Niwa  <[email protected]>
+
+            REGRESSION(r150187): Safari fails to render allrecipe.com comment popups
+            https://bugs.webkit.org/show_bug.cgi?id=119780
+
+            Reviewed by Benjamin Poulain.
+
+            The bug was caused by SelectorDataList::executeFastPathForIdSelector not verifying that
+            elements found by getAllElementsById are descendents of rootNode when there are multiple
+            elements of the same id. This resulted in querySelector and querySelectorAll of an element
+            returning nodes outside of the element.
+
+            Fixed the bug by checking this condition when we have multiple elements of the same id.
+
+            Test: fast/selectors/querySelector-id-with-multiple-elements-with-same-id.html
+
+            * dom/SelectorQuery.cpp:
+            (WebCore::SelectorDataList::executeFastPathForIdSelector):
+
 2013-09-04  Dean Jackson  <[email protected]>
 
         <rdar://problem/14910916> Disable CSS_SHAPES on safari-537-branch

Modified: branches/safari-537-branch/Source/WebCore/dom/SelectorQuery.cpp (155128 => 155129)


--- branches/safari-537-branch/Source/WebCore/dom/SelectorQuery.cpp	2013-09-05 17:28:28 UTC (rev 155128)
+++ branches/safari-537-branch/Source/WebCore/dom/SelectorQuery.cpp	2013-09-05 17:35:59 UTC (rev 155129)
@@ -132,9 +132,10 @@
         const Vector<Element*>* elements = rootNode->treeScope()->getAllElementsById(idToMatch);
         ASSERT(elements);
         size_t count = elements->size();
+        bool rootNodeIsTreeScopeRoot = isTreeScopeRoot(rootNode);
         for (size_t i = 0; i < count; ++i) {
             Element* element = elements->at(i);
-            if (selectorMatches(selectorData, element, rootNode)) {
+            if ((rootNodeIsTreeScopeRoot || element->isDescendantOf(rootNode)) && selectorMatches(selectorData, element, rootNode)) {
                 matchedElements.append(element);
                 if (firstMatchOnly)
                     return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to