Title: [194004] trunk
Revision
194004
Author
[email protected]
Date
2015-12-11 22:58:15 -0800 (Fri, 11 Dec 2015)

Log Message

Mousewheel events don't work in iframes in RTL documents
https://bugs.webkit.org/show_bug.cgi?id=152200

Reviewed by Beth Dakin.

Source/WebCore:

When dispatching wheel events, the testing of the event point against the
non-fast scrollable region was broken in an RTL document. Fix by taking
the scrollOrigin into account in ScrollingTreeFrameScrollingNode::viewToContentsOffset().

Test: fast/scrolling/rtl-point-in-iframe.html

* page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
(WebCore::ScrollingTreeFrameScrollingNode::viewToContentsOffset):

LayoutTests:

Try dispatching wheel events to an iframe in an RTL document.

* fast/scrolling/rtl-point-in-iframe-expected.txt: Added.
* fast/scrolling/rtl-point-in-iframe.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (194003 => 194004)


--- trunk/LayoutTests/ChangeLog	2015-12-12 06:10:07 UTC (rev 194003)
+++ trunk/LayoutTests/ChangeLog	2015-12-12 06:58:15 UTC (rev 194004)
@@ -1,3 +1,15 @@
+2015-12-11  Simon Fraser  <[email protected]>
+
+        Mousewheel events don't work in iframes in RTL documents
+        https://bugs.webkit.org/show_bug.cgi?id=152200
+
+        Reviewed by Beth Dakin.
+        
+        Try dispatching wheel events to an iframe in an RTL document.
+
+        * fast/scrolling/rtl-point-in-iframe-expected.txt: Added.
+        * fast/scrolling/rtl-point-in-iframe.html: Added.
+
 2015-12-11  Zalan Bujtas  <[email protected]>
 
         ASSERTION FAILED: !rect.isEmpty() in WebCore::GraphicsContext::drawRect

Added: trunk/LayoutTests/fast/scrolling/rtl-point-in-iframe-expected.txt (0 => 194004)


--- trunk/LayoutTests/fast/scrolling/rtl-point-in-iframe-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/scrolling/rtl-point-in-iframe-expected.txt	2015-12-12 06:58:15 UTC (rev 194004)
@@ -0,0 +1,3 @@
+
+PASS iframe received wheel events.
+

Added: trunk/LayoutTests/fast/scrolling/rtl-point-in-iframe.html (0 => 194004)


--- trunk/LayoutTests/fast/scrolling/rtl-point-in-iframe.html	                        (rev 0)
+++ trunk/LayoutTests/fast/scrolling/rtl-point-in-iframe.html	2015-12-12 06:58:15 UTC (rev 194004)
@@ -0,0 +1,89 @@
+<!DOCTYPE html>
+<html dir="rtl">
+<head>
+    <link rel="stylesheet" href=""
+    <script src=""
+    <style>
+    .origin {
+        position: absolute;
+        top: 0;
+        left: 0;
+        height: 10px;
+        width: 10px;
+        background-color: blue;
+    }
+    
+    .wide {
+        width: 1200px;
+        height: 10px;
+        background-color: silver;
+    }
+    iframe {
+        position: absolute;
+    }
+    </style>
+    <script>
+    var pageScrollPositionBefore;
+    var iframeScrollPositionBefore;
+    
+    function checkForScroll()
+    {
+        // The iframe should have scrolled, but not the main page.
+        var iframeScrollPositionAfter = window.frames['target'].document.body.scrollTop;
+
+        if (iframeScrollPositionBefore != iframeScrollPositionAfter)
+            testPassed("iframe received wheel events.");
+        else
+            testFailed("iframe did not receive wheel events.");
+
+        testRunner.notifyDone();
+    }
+
+    function scrollTest()
+    {
+        pageScrollPositionBefore = document.body.scrollTop;
+
+        var iframeTarget = document.getElementById('target');
+        iframeScrollPositionBefore = iframeTarget.contentDocument.body.scrollTop;
+
+        var startPosX = iframeTarget.offsetLeft + 20;
+        var startPosY = iframeTarget.offsetTop + 20;
+        eventSender.mouseMoveTo(startPosX, startPosY);
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'began', 'none');
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'changed', 'none');
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'changed', 'none');
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'ended', 'none');
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'none', 'begin');
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'none', 'continue');
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'none', 'end');
+        setTimeout(checkForScroll, 100);
+    }
+    
+    function startTest()
+    {
+        if (window.eventSender) {
+            testRunner.waitUntilDone();
+            setTimeout(scrollTest, 0);
+        }
+    }
+    
+    window.addEventListener('load', startTest, false);
+    </script>
+</head>
+<body>
+    <div class="wide">
+    <div class="origin"></div>
+
+    <iframe id="target" name="target" style="border:solid 1px green; height: 300px; width: 300px;" 
+        src= ""
+            <html>
+                <head>
+                    <style>div { width: 400px; height: 1000px; background-color: green; } </style>
+                </head>
+                <body>
+                    <div></div>
+                </body>
+            </html>">
+    </iframe>
+    <div id='console'></div>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (194003 => 194004)


--- trunk/Source/WebCore/ChangeLog	2015-12-12 06:10:07 UTC (rev 194003)
+++ trunk/Source/WebCore/ChangeLog	2015-12-12 06:58:15 UTC (rev 194004)
@@ -1,3 +1,19 @@
+2015-12-11  Simon Fraser  <[email protected]>
+
+        Mousewheel events don't work in iframes in RTL documents
+        https://bugs.webkit.org/show_bug.cgi?id=152200
+
+        Reviewed by Beth Dakin.
+        
+        When dispatching wheel events, the testing of the event point against the
+        non-fast scrollable region was broken in an RTL document. Fix by taking
+        the scrollOrigin into account in ScrollingTreeFrameScrollingNode::viewToContentsOffset().
+
+        Test: fast/scrolling/rtl-point-in-iframe.html
+
+        * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
+        (WebCore::ScrollingTreeFrameScrollingNode::viewToContentsOffset):
+
 2015-12-11  Zalan Bujtas  <[email protected]>
 
         ASSERTION FAILED: !rect.isEmpty() in WebCore::GraphicsContext::drawRect

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeFrameScrollingNode.cpp (194003 => 194004)


--- trunk/Source/WebCore/page/scrolling/ScrollingTreeFrameScrollingNode.cpp	2015-12-12 06:10:07 UTC (rev 194003)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeFrameScrollingNode.cpp	2015-12-12 06:58:15 UTC (rev 194004)
@@ -91,7 +91,7 @@
 
 FloatSize ScrollingTreeFrameScrollingNode::viewToContentsOffset(const FloatPoint& scrollOffset) const
 {
-    return toFloatSize(scrollOffset) - FloatSize(0, headerHeight() + topContentInset());
+    return toFloatSize(scrollOffset) - toFloatSize(scrollOrigin()) - FloatSize(0, headerHeight() + topContentInset());
 }
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to