Title: [94130] trunk
Revision
94130
Author
[email protected]
Date
2011-08-30 17:03:40 -0700 (Tue, 30 Aug 2011)

Log Message

Fix pan scrolling on Windows to be clamped
https://bugs.webkit.org/show_bug.cgi?id=66910

Source/WebCore:

With the recent change to support rubberband scrolling on the Mac, pan
scrolling of overflow divs became unclamped and would scroll infinitely
and along an axis without a scrollbar.

Patch by Scott Byer <[email protected]> on 2011-08-30
Reviewed by Simon Fraser

Test: platform/win/fast/events/panScroll-correct-direction.html

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::panScrollFromPoint):
(WebCore::RenderLayer::scrollByRecursively):
* rendering/RenderLayer.h:

LayoutTests:

With the recent change to support rubberband scrolling on the Mac, pan
scrolling of overflow divs became unclamped and would scroll infinitely
and along an axis without a scrollbar.

Patch by Scott Byer <[email protected]> on 2011-08-30
Reviewed by Simon Fraser

* platform/mac/fast/frames/iframe-scaling-with-scroll-expected.png:
* platform/win/fast/events/panScroll-click-hyperlink-expected.txt: Added.
* platform/win/fast/events/panScroll-correct-direction-expected.txt: Added.
* platform/win/fast/events/panScroll-correct-direction.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (94129 => 94130)


--- trunk/LayoutTests/ChangeLog	2011-08-31 00:01:09 UTC (rev 94129)
+++ trunk/LayoutTests/ChangeLog	2011-08-31 00:03:40 UTC (rev 94130)
@@ -1,3 +1,19 @@
+2011-08-30  Scott Byer  <[email protected]>
+
+        Fix pan scrolling on Windows to be clamped
+        https://bugs.webkit.org/show_bug.cgi?id=66910
+
+        With the recent change to support rubberband scrolling on the Mac, pan
+        scrolling of overflow divs became unclamped and would scroll infinitely
+        and along an axis without a scrollbar.
+        
+        Reviewed by Simon Fraser
+
+        * platform/mac/fast/frames/iframe-scaling-with-scroll-expected.png:
+        * platform/win/fast/events/panScroll-click-hyperlink-expected.txt: Added.
+        * platform/win/fast/events/panScroll-correct-direction-expected.txt: Added.
+        * platform/win/fast/events/panScroll-correct-direction.html: Added.
+
 2011-08-30  Chris Rogers  <[email protected]>
 
         Don't allow nodes of one context to be connected to nodes of another context

Added: trunk/LayoutTests/platform/chromium-linux/fast/events/panScroll-click-hyperlink-expected.txt (0 => 94130)


--- trunk/LayoutTests/platform/chromium-linux/fast/events/panScroll-click-hyperlink-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium-linux/fast/events/panScroll-click-hyperlink-expected.txt	2011-08-31 00:03:40 UTC (rev 94130)
@@ -0,0 +1,10 @@
+This test can be used to verify that clicking on a hyperlink is ignored when in pan scroll mode. 
+Note, this test is expected to fail on the Apple Mac and Chromium Mac port since they don't support pan scrolling.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+FAIL either pan scrolling is disabled or this platform doesn't support pan scrolling.
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/platform/win/fast/events/panScroll-click-hyperlink-expected.txt (0 => 94130)


--- trunk/LayoutTests/platform/win/fast/events/panScroll-click-hyperlink-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/win/fast/events/panScroll-click-hyperlink-expected.txt	2011-08-31 00:03:40 UTC (rev 94130)
@@ -0,0 +1,10 @@
+This test can be used to verify that clicking on a hyperlink is ignored when in pan scroll mode. 
+Note, this test is expected to fail on the Apple Mac and Chromium Mac port since they don't support pan scrolling.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Link 1 wasn't clicked.
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/platform/win/fast/events/panScroll-correct-direction-expected.txt (0 => 94130)


--- trunk/LayoutTests/platform/win/fast/events/panScroll-correct-direction-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/win/fast/events/panScroll-correct-direction-expected.txt	2011-08-31 00:03:40 UTC (rev 94130)
@@ -0,0 +1,4 @@
+CONSOLE MESSAGE: line 14: Mousedown with 1
+This tests that pan scrolling scrolls the proper direction without event.preventDefault and the middle button mousedown event is fired. To test manually, try to pan scroll sideways inside this div.
+
+Success! Div with overflow was scrolled correctly

Added: trunk/LayoutTests/platform/win/fast/events/panScroll-correct-direction.html (0 => 94130)


--- trunk/LayoutTests/platform/win/fast/events/panScroll-correct-direction.html	                        (rev 0)
+++ trunk/LayoutTests/platform/win/fast/events/panScroll-correct-direction.html	2011-08-31 00:03:40 UTC (rev 94130)
@@ -0,0 +1,46 @@
+<html>
+    <head>
+        <title>Pan Scrolling Test</title>
+    </head>
+    <body>
+        <script>
+            if (window.layoutTestController) {
+                layoutTestController.dumpAsText();
+                layoutTestController.waitUntilDone();
+            }
+            
+            addEventListener('mousedown', 
+                function(event) { 
+                    console.log("Mousedown with " + event.button);
+                }
+            , false);
+        </script>
+        <div id="overflow" style="width:500px; height:150px; overflow:auto; border:2px solid black; padding:10px">
+            <h1>This tests that pan scrolling scrolls the proper direction without event.preventDefault
+            and the middle button mousedown event is fired. To test manually, try to pan scroll sideways
+            inside this div.</h1>
+        </div>
+        <p>
+        <div id="console"></div>
+        <script>
+            if (window.eventSender)
+            {
+                eventSender.mouseMoveTo(50, 50);
+                eventSender.mouseDown(1);
+                eventSender.mouseUp(1);
+                eventSender.mouseMoveTo(-50, 200);
+                setTimeout(finished, 500);
+            }
+            
+            function finished()
+            {
+                if (document.getElementById('overflow').scrollLeft)
+                    document.getElementById('console').innerHTML = "Fail! Div with overflow was scrolled in the wrong axis";
+                else
+                    document.getElementById('console').innerHTML = "Success! Div with overflow was scrolled correctly";
+                
+                window.layoutTestController.notifyDone();
+            }
+        </script>
+    </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (94129 => 94130)


--- trunk/Source/WebCore/ChangeLog	2011-08-31 00:01:09 UTC (rev 94129)
+++ trunk/Source/WebCore/ChangeLog	2011-08-31 00:03:40 UTC (rev 94130)
@@ -1,3 +1,21 @@
+2011-08-30  Scott Byer  <[email protected]>
+
+        Fix pan scrolling on Windows to be clamped
+        https://bugs.webkit.org/show_bug.cgi?id=66910
+
+        With the recent change to support rubberband scrolling on the Mac, pan
+        scrolling of overflow divs became unclamped and would scroll infinitely
+        and along an axis without a scrollbar.
+
+        Reviewed by Simon Fraser
+
+        Test: platform/win/fast/events/panScroll-correct-direction.html
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::panScrollFromPoint):
+        (WebCore::RenderLayer::scrollByRecursively):
+        * rendering/RenderLayer.h:
+
 2011-08-30  Bill Budge  <[email protected]>
 
         This patch makes the XMLHttpRequest method/header validation logic available as

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (94129 => 94130)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2011-08-31 00:01:09 UTC (rev 94129)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2011-08-31 00:03:40 UTC (rev 94130)
@@ -1272,10 +1272,10 @@
     if (abs(yDelta) <= ScrollView::noPanScrollRadius)
         yDelta = 0;
 
-    scrollByRecursively(adjustedScrollDelta(xDelta), adjustedScrollDelta(yDelta));
+    scrollByRecursively(adjustedScrollDelta(xDelta), adjustedScrollDelta(yDelta), ScrollOffsetClamped);
 }
 
-void RenderLayer::scrollByRecursively(LayoutUnit xDelta, LayoutUnit yDelta)
+void RenderLayer::scrollByRecursively(LayoutUnit xDelta, LayoutUnit yDelta, ScrollOffsetClamping clamp)
 {
     if (!xDelta && !yDelta)
         return;
@@ -1287,7 +1287,7 @@
     if (renderer()->hasOverflowClip() && !restrictedByLineClamp) {
         LayoutUnit newOffsetX = scrollXOffset() + xDelta;
         LayoutUnit newOffsetY = scrollYOffset() + yDelta;
-        scrollToOffset(newOffsetX, newOffsetY);
+        scrollToOffset(newOffsetX, newOffsetY, clamp);
 
         // If this layer can't do the scroll we ask the next layer up that can scroll to try
         LayoutUnit leftToScrollX = newOffsetX - scrollXOffset();

Modified: trunk/Source/WebCore/rendering/RenderLayer.h (94129 => 94130)


--- trunk/Source/WebCore/rendering/RenderLayer.h	2011-08-31 00:01:09 UTC (rev 94129)
+++ trunk/Source/WebCore/rendering/RenderLayer.h	2011-08-31 00:03:40 UTC (rev 94130)
@@ -224,8 +224,13 @@
 
     void panScrollFromPoint(const LayoutPoint&);
 
+    enum ScrollOffsetClamping {
+        ScrollOffsetUnclamped,
+        ScrollOffsetClamped
+    };
+
     // Scrolling methods for layers that can scroll their overflow.
-    void scrollByRecursively(LayoutUnit xDelta, LayoutUnit yDelta);
+    void scrollByRecursively(LayoutUnit xDelta, LayoutUnit yDelta, ScrollOffsetClamping = ScrollOffsetUnclamped);
 
     LayoutSize scrolledContentOffset() const { return scrollOffset() + m_scrollOverflow; }
 
@@ -233,10 +238,6 @@
     LayoutUnit scrollYOffset() const { return m_scrollOffset.height() + m_scrollOrigin.y(); }
     LayoutSize scrollOffset() const { return LayoutSize(scrollXOffset(), scrollYOffset()); }
 
-    enum ScrollOffsetClamping {
-        ScrollOffsetUnclamped,
-        ScrollOffsetClamped
-    };
     void scrollToOffset(LayoutUnit, LayoutUnit, ScrollOffsetClamping = ScrollOffsetUnclamped);
     void scrollToXOffset(LayoutUnit x, ScrollOffsetClamping clamp = ScrollOffsetUnclamped) { scrollToOffset(x, scrollYOffset(), clamp); }
     void scrollToYOffset(LayoutUnit y, ScrollOffsetClamping clamp = ScrollOffsetUnclamped) { scrollToOffset(scrollXOffset(), y, clamp); }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to