Title: [211905] trunk
Revision
211905
Author
commit-qu...@webkit.org
Date
2017-02-08 15:15:58 -0800 (Wed, 08 Feb 2017)

Log Message

getIntersectionList always returns empty NodeList until layout is complete
https://bugs.webkit.org/show_bug.cgi?id=81423

Patch by Said Abou-Hallawa <sabouhall...@apple.com> on 2017-02-08
Reviewed by Simon Fraser.

Source/WebCore:

Layout needs to be forced before trying to figure out which SVGElements
intersect with a given SVGRect. We do the same thing in the DOM API
Element::getBoundingClientRect().

Test: svg/custom/intersection-list-before-layout.html

* svg/SVGSVGElement.cpp:
(WebCore::SVGSVGElement::getIntersectionList):

LayoutTests:

* svg/custom/intersection-list-before-layout-expected.txt: Added.
* svg/custom/intersection-list-before-layout.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (211904 => 211905)


--- trunk/LayoutTests/ChangeLog	2017-02-08 22:57:38 UTC (rev 211904)
+++ trunk/LayoutTests/ChangeLog	2017-02-08 23:15:58 UTC (rev 211905)
@@ -1,3 +1,13 @@
+2017-02-08  Said Abou-Hallawa  <sabouhall...@apple.com>
+
+        getIntersectionList always returns empty NodeList until layout is complete
+        https://bugs.webkit.org/show_bug.cgi?id=81423
+
+        Reviewed by Simon Fraser.
+
+        * svg/custom/intersection-list-before-layout-expected.txt: Added.
+        * svg/custom/intersection-list-before-layout.html: Added.
+
 2017-02-08  Antoine Quint  <grao...@apple.com>
 
         [Modern Media Controls] Implement reduced and tight padding modes

Added: trunk/LayoutTests/svg/custom/intersection-list-before-layout-expected.txt (0 => 211905)


--- trunk/LayoutTests/svg/custom/intersection-list-before-layout-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/intersection-list-before-layout-expected.txt	2017-02-08 23:15:58 UTC (rev 211905)
@@ -0,0 +1 @@
+Number of intersected elements = 1.

Added: trunk/LayoutTests/svg/custom/intersection-list-before-layout.html (0 => 211905)


--- trunk/LayoutTests/svg/custom/intersection-list-before-layout.html	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/intersection-list-before-layout.html	2017-02-08 23:15:58 UTC (rev 211905)
@@ -0,0 +1,26 @@
+<style>
+    svg {
+        width: 100px;
+        height: 100px;
+        pointer-events: all;
+    }
+</style>
+<body>
+    <svg>
+        <rect width="100" height="100" fill="red"/>
+    </svg>
+    <script>
+        if (window.testRunner)
+            testRunner.dumpAsText();
+
+        var root = document.getElementsByTagName("svg")[0];
+        var rect = root.createSVGRect();
+        rect.x = 10;
+        rect.y = 10;
+        rect.width = 1;
+        rect.height = 1;
+        
+        var list = root.getIntersectionList(rect, null);
+        document.write("<h3>Number of intersected elements = " + list.length + ".</h3>") 
+    </script>
+</body>

Modified: trunk/Source/WebCore/ChangeLog (211904 => 211905)


--- trunk/Source/WebCore/ChangeLog	2017-02-08 22:57:38 UTC (rev 211904)
+++ trunk/Source/WebCore/ChangeLog	2017-02-08 23:15:58 UTC (rev 211905)
@@ -1,3 +1,19 @@
+2017-02-08  Said Abou-Hallawa  <sabouhall...@apple.com>
+
+        getIntersectionList always returns empty NodeList until layout is complete
+        https://bugs.webkit.org/show_bug.cgi?id=81423
+
+        Reviewed by Simon Fraser.
+
+        Layout needs to be forced before trying to figure out which SVGElements
+        intersect with a given SVGRect. We do the same thing in the DOM API
+        Element::getBoundingClientRect().
+
+        Test: svg/custom/intersection-list-before-layout.html
+
+        * svg/SVGSVGElement.cpp:
+        (WebCore::SVGSVGElement::getIntersectionList):
+
 2017-02-08  Antoine Quint  <grao...@apple.com>
 
         [Modern Media Controls] Implement reduced and tight padding modes

Modified: trunk/Source/WebCore/svg/SVGSVGElement.cpp (211904 => 211905)


--- trunk/Source/WebCore/svg/SVGSVGElement.cpp	2017-02-08 22:57:38 UTC (rev 211904)
+++ trunk/Source/WebCore/svg/SVGSVGElement.cpp	2017-02-08 23:15:58 UTC (rev 211905)
@@ -333,6 +333,7 @@
 
 Ref<NodeList> SVGSVGElement::getIntersectionList(SVGRect& rect, SVGElement* referenceElement)
 {
+    document().updateLayoutIgnorePendingStylesheets();
     return collectIntersectionOrEnclosureList(rect, referenceElement, checkIntersection);
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to