Title: [192124] trunk
Revision
192124
Author
wenson_hs...@apple.com
Date
2015-11-06 18:32:13 -0800 (Fri, 06 Nov 2015)

Log Message

Scrolling iframe inside scrollable div does not work with trackpad
https://bugs.webkit.org/show_bug.cgi?id=150168
<rdar://problem/23143931>

Reviewed by Brent Fulgham.

Source/WebCore:

When scrolling in an iframe nested under an overflow scrolling region, EventHandler::platformPrepareForWheelEvents
fails to compute the correct scrollableArea, using the overflow div's scrollable area instead of the iframe's view.
This causes the latching algorithm to bail out of handling the wheel event. To avoid this, we special-case the
decision to compute the scrollableArea from the scrollableContainer if we are attempting to scroll in an iframe.

Test: fast/scrolling/latching/scroll-iframe-in-overflow.html

* page/mac/EventHandlerMac.mm:
(WebCore::EventHandler::platformPrepareForWheelEvents):

LayoutTests:

Tests that an iframe nested under an overflow scrolling div can be scrolled.

* fast/scrolling/latching/scroll-iframe-in-overflow-expected.txt: Added.
* fast/scrolling/latching/scroll-iframe-in-overflow.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (192123 => 192124)


--- trunk/LayoutTests/ChangeLog	2015-11-07 01:12:55 UTC (rev 192123)
+++ trunk/LayoutTests/ChangeLog	2015-11-07 02:32:13 UTC (rev 192124)
@@ -1,3 +1,16 @@
+2015-11-06  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        Scrolling iframe inside scrollable div does not work with trackpad
+        https://bugs.webkit.org/show_bug.cgi?id=150168
+        <rdar://problem/23143931>
+
+        Reviewed by Brent Fulgham.
+
+        Tests that an iframe nested under an overflow scrolling div can be scrolled.
+
+        * fast/scrolling/latching/scroll-iframe-in-overflow-expected.txt: Added.
+        * fast/scrolling/latching/scroll-iframe-in-overflow.html: Added.
+
 2015-11-06  Myles C. Maxfield  <mmaxfi...@apple.com>
 
         REGRESSION(r182286): Tatechuyoko following ruby is drawn too far to the right

Added: trunk/LayoutTests/fast/scrolling/latching/scroll-iframe-in-overflow-expected.txt (0 => 192124)


--- trunk/LayoutTests/fast/scrolling/latching/scroll-iframe-in-overflow-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/scrolling/latching/scroll-iframe-in-overflow-expected.txt	2015-11-07 02:32:13 UTC (rev 192124)
@@ -0,0 +1,2 @@
+PASS The iframe scrolled but the wrapper did not.
+

Added: trunk/LayoutTests/fast/scrolling/latching/scroll-iframe-in-overflow.html (0 => 192124)


--- trunk/LayoutTests/fast/scrolling/latching/scroll-iframe-in-overflow.html	                        (rev 0)
+++ trunk/LayoutTests/fast/scrolling/latching/scroll-iframe-in-overflow.html	2015-11-07 02:32:13 UTC (rev 192124)
@@ -0,0 +1,78 @@
+<html>
+<head>
+    <script src=""
+    <style type="text/css">
+    #wrapper {
+        height: 400px;
+        width: 600px;
+        overflow: scroll;
+        background-color: #EEE;
+    }
+
+    iframe {
+        background-color: #CCC;
+        width: 400px;
+        height: 100px;
+        margin-bottom: 1000px;
+    }
+
+    body {
+        margin: 0;
+    }
+    </style>
+    <script>
+    window.jsTestIsAsync = true;
+
+    function checkForScroll() {
+        var iframe = document.getElementById("frame");
+        var wrapper = document.getElementById("wrapper");
+        if (iframe.contentWindow.scrollY && !wrapper.scrollTop)
+            testPassed("The iframe scrolled but the wrapper did not.");
+        else
+            testFailed("The iframe's scroll position is: " + iframe.contentWindow.scrollY + ", and the wrapper's scroll position is: " + wrapper.scrollTop);
+
+        testRunner.notifyDone();
+    }
+
+    function scrollTest() {
+        eventSender.mouseMoveTo(200, 50);
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, "began", "none");
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, "changed", "none");
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, "changed", "none");
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, "changed", "none");
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, "changed", "none");
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, "changed", "none");
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, "ended", "none");
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -10, "none", "begin");
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -10, "none", "continue");
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -10, "none", "continue");
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -10, "none", "continue");
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -10, "none", "continue");
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -10, "none", "continue");
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, "none", "end");
+        eventSender.callAfterScrollingCompletes(checkForScroll);
+    }
+
+    function setup() {
+        if (window.eventSender) {
+            eventSender.monitorWheelEvents();
+            setTimeout(scrollTest, 0);
+        } else {
+            var message = document.createElement("div");
+            message.innerHTML = "<p>This test is better run under DumpRenderTree. To manually test it, place the mouse pointer<br/>"
+                + "inside the IFrame, then use a two-finger swipe to scroll the iframe to the bottom (and beyond).<br/>"
+                + "<br/><br/>"
+                + "The test passes if the overflow container does not scroll but the iframe scrolls to the bottom.</p>";
+            document.body.appendChild(message);
+        }
+    }
+
+    </script>
+</head>
+<body _onload_="setup()">
+    <div id="wrapper">
+        <iframe id="frame" src=""
+    </div>
+    <script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (192123 => 192124)


--- trunk/Source/WebCore/ChangeLog	2015-11-07 01:12:55 UTC (rev 192123)
+++ trunk/Source/WebCore/ChangeLog	2015-11-07 02:32:13 UTC (rev 192124)
@@ -1,3 +1,21 @@
+2015-11-06  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        Scrolling iframe inside scrollable div does not work with trackpad
+        https://bugs.webkit.org/show_bug.cgi?id=150168
+        <rdar://problem/23143931>
+
+        Reviewed by Brent Fulgham.
+
+        When scrolling in an iframe nested under an overflow scrolling region, EventHandler::platformPrepareForWheelEvents
+        fails to compute the correct scrollableArea, using the overflow div's scrollable area instead of the iframe's view.
+        This causes the latching algorithm to bail out of handling the wheel event. To avoid this, we special-case the
+        decision to compute the scrollableArea from the scrollableContainer if we are attempting to scroll in an iframe.
+
+        Test: fast/scrolling/latching/scroll-iframe-in-overflow.html
+
+        * page/mac/EventHandlerMac.mm:
+        (WebCore::EventHandler::platformPrepareForWheelEvents):
+
 2015-11-06  Brady Eidson  <beid...@apple.com>
 
         Modern IDB: Make the result data for a "get" request be an IDBGetResult.

Modified: trunk/Source/WebCore/page/mac/EventHandlerMac.mm (192123 => 192124)


--- trunk/Source/WebCore/page/mac/EventHandlerMac.mm	2015-11-07 01:12:55 UTC (rev 192123)
+++ trunk/Source/WebCore/page/mac/EventHandlerMac.mm	2015-11-07 02:32:13 UTC (rev 192124)
@@ -932,7 +932,7 @@
             scrollableArea = scrollViewForEventTarget(wheelEventTarget.get());
         } else {
             scrollableContainer = findEnclosingScrollableContainer(wheelEventTarget.get(), wheelEvent.deltaX(), wheelEvent.deltaY());
-            if (scrollableContainer)
+            if (scrollableContainer && !is<HTMLIFrameElement>(wheelEventTarget.get()))
                 scrollableArea = scrollableAreaForContainerNode(*scrollableContainer);
             else {
                 scrollableContainer = view->frame().document()->bodyOrFrameset();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to