Fix rubber-band effect on non-scrollable pages
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Feb 2013 01:32:10 +0000 (01:32 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Feb 2013 01:32:10 +0000 (01:32 +0000)
https://bugs.webkit.org/show_bug.cgi?id=107611

Source/WebCore:

Patch by Christopher Cameron <ccameron@chromium.org> on 2013-01-31
Reviewed by Antonio Gomes.

Handle a FrameView's wheel event even if it is not scrollable
because Chrome relies on handling these wheel events for the
over-scroll rubber-band effect.

This had been removed in r138378
[EFL][WK2] Never create WebCore scrollbars for EFL/WK2
by kenneth@chromium.org

Tests: platform/chromium/rubberbanding/wheelevent-overhang-e.html
       platform/chromium/rubberbanding/wheelevent-overhang-n.html
       platform/chromium/rubberbanding/wheelevent-overhang-s.html
       platform/chromium/rubberbanding/wheelevent-overhang-w.html

* page/FrameView.cpp:
(WebCore::FrameView::wheelEvent):

Tools:

Add mouseWheelBegin function to EventSender to allow
event-based rubber-banding tests.

Patch by Christopher Cameron <ccameron@chromium.org> on 2013-01-31
Reviewed by Antonio Gomes.

* DumpRenderTree/chromium/TestRunner/src/EventSender.cpp:
(WebTestRunner):
(WebTestRunner::EventSender::EventSender):
(WebTestRunner::EventSender::mouseDragBegin):
* DumpRenderTree/chromium/TestRunner/src/EventSender.h:
(EventSender):

LayoutTests:

Patch by Christopher Cameron <ccameron@chromium.org> on 2013-01-31
Reviewed by Antonio Gomes.

* platform/chromium/rubberbanding/event-overhang-e-expected.png: Added.
* platform/chromium/rubberbanding/event-overhang-e-expected.txt: Added.
* platform/chromium/rubberbanding/event-overhang-e.html: Added.
* platform/chromium/rubberbanding/event-overhang-n-expected.png: Added.
* platform/chromium/rubberbanding/event-overhang-n-expected.txt: Added.
* platform/chromium/rubberbanding/event-overhang-n.html: Added.
* platform/chromium/rubberbanding/event-overhang-s-expected.png: Added.
* platform/chromium/rubberbanding/event-overhang-s-expected.txt: Added.
* platform/chromium/rubberbanding/event-overhang-s.html: Added.
* platform/chromium/rubberbanding/event-overhang-w-expected.png: Added.
* platform/chromium/rubberbanding/event-overhang-w-expected.txt: Added.
* platform/chromium/rubberbanding/event-overhang-w.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@141514 268f45cc-cd09-0410-ab3c-d52691b4dbfc

18 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/chromium/rubberbanding/event-overhang-e-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium/rubberbanding/event-overhang-e-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/rubberbanding/event-overhang-e.html [new file with mode: 0644]
LayoutTests/platform/chromium/rubberbanding/event-overhang-n-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium/rubberbanding/event-overhang-n-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/rubberbanding/event-overhang-n.html [new file with mode: 0644]
LayoutTests/platform/chromium/rubberbanding/event-overhang-s-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium/rubberbanding/event-overhang-s-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/rubberbanding/event-overhang-s.html [new file with mode: 0644]
LayoutTests/platform/chromium/rubberbanding/event-overhang-w-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium/rubberbanding/event-overhang-w-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/rubberbanding/event-overhang-w.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/page/FrameView.cpp
Tools/ChangeLog
Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.cpp
Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.h

index 7120385..5d3c134 100644 (file)
@@ -1,3 +1,23 @@
+2013-01-31  Christopher Cameron  <ccameron@chromium.org>
+
+        Fix rubber-band effect on non-scrollable pages
+        https://bugs.webkit.org/show_bug.cgi?id=107611
+
+        Reviewed by Antonio Gomes.
+
+        * platform/chromium/rubberbanding/event-overhang-e-expected.png: Added.
+        * platform/chromium/rubberbanding/event-overhang-e-expected.txt: Added.
+        * platform/chromium/rubberbanding/event-overhang-e.html: Added.
+        * platform/chromium/rubberbanding/event-overhang-n-expected.png: Added.
+        * platform/chromium/rubberbanding/event-overhang-n-expected.txt: Added.
+        * platform/chromium/rubberbanding/event-overhang-n.html: Added.
+        * platform/chromium/rubberbanding/event-overhang-s-expected.png: Added.
+        * platform/chromium/rubberbanding/event-overhang-s-expected.txt: Added.
+        * platform/chromium/rubberbanding/event-overhang-s.html: Added.
+        * platform/chromium/rubberbanding/event-overhang-w-expected.png: Added.
+        * platform/chromium/rubberbanding/event-overhang-w-expected.txt: Added.
+        * platform/chromium/rubberbanding/event-overhang-w.html: Added.
+
 2013-01-31  Jessie Berlin  <jberlin@apple.com>
 
         REGRESSION(r141136): Apple's internal PLT test suite doesn't finish
diff --git a/LayoutTests/platform/chromium/rubberbanding/event-overhang-e-expected.png b/LayoutTests/platform/chromium/rubberbanding/event-overhang-e-expected.png
new file mode 100644 (file)
index 0000000..549e129
Binary files /dev/null and b/LayoutTests/platform/chromium/rubberbanding/event-overhang-e-expected.png differ
diff --git a/LayoutTests/platform/chromium/rubberbanding/event-overhang-e-expected.txt b/LayoutTests/platform/chromium/rubberbanding/event-overhang-e-expected.txt
new file mode 100644 (file)
index 0000000..7444e19
--- /dev/null
@@ -0,0 +1,10 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {DIV} at (0,0) size 784x30 [bgcolor=#000000]
+      RenderBlock {DIV} at (0,30) size 784x18
+        RenderText {#text} at (0,0) size 148x18
+          text run at (0,0) width 148: "This test requires DRT."
+scrolled to 100,0
diff --git a/LayoutTests/platform/chromium/rubberbanding/event-overhang-e.html b/LayoutTests/platform/chromium/rubberbanding/event-overhang-e.html
new file mode 100644 (file)
index 0000000..c5e9e88
--- /dev/null
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<head><title>Test rubber banding overhang drawing</title></head>
+<body>
+<div style="height:30px; background-color:black; width:100%"></div>
+<div id="info">This test requires DRT.</div>
+<script>
+    if (window.internals) {
+        document.getElementById('info').style.visibility = "hidden";
+        internals.settings.setMockScrollbarsEnabled(false);
+        eventSender.mouseMoveTo(10, 10);
+        eventSender.mouseDragBegin();
+        eventSender.mouseScrollBy(-50, 0, false, true);
+    }
+</script>
+</body>
+</html>
diff --git a/LayoutTests/platform/chromium/rubberbanding/event-overhang-n-expected.png b/LayoutTests/platform/chromium/rubberbanding/event-overhang-n-expected.png
new file mode 100644 (file)
index 0000000..2cd2ae5
Binary files /dev/null and b/LayoutTests/platform/chromium/rubberbanding/event-overhang-n-expected.png differ
diff --git a/LayoutTests/platform/chromium/rubberbanding/event-overhang-n-expected.txt b/LayoutTests/platform/chromium/rubberbanding/event-overhang-n-expected.txt
new file mode 100644 (file)
index 0000000..cff31b6
--- /dev/null
@@ -0,0 +1,9 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {DIV} at (0,0) size 784x30 [bgcolor=#000000]
+      RenderBlock {DIV} at (0,30) size 784x18
+        RenderText {#text} at (0,0) size 148x18
+          text run at (0,0) width 148: "This test requires DRT."
diff --git a/LayoutTests/platform/chromium/rubberbanding/event-overhang-n.html b/LayoutTests/platform/chromium/rubberbanding/event-overhang-n.html
new file mode 100644 (file)
index 0000000..6f302a2
--- /dev/null
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<head><title>Test rubber banding overhang drawing</title></head>
+<body>
+<div style="height:30px; background-color:black; width:100%"></div>
+<div id="info">This test requires DRT.</div>
+<script>
+    if (window.internals) {
+        document.getElementById('info').style.visibility = "hidden";
+        internals.settings.setMockScrollbarsEnabled(false);
+        eventSender.mouseMoveTo(10, 10);
+        eventSender.mouseDragBegin();
+        eventSender.mouseScrollBy(0, 50, false, true);
+    }
+</script>
+</body>
+</html>
diff --git a/LayoutTests/platform/chromium/rubberbanding/event-overhang-s-expected.png b/LayoutTests/platform/chromium/rubberbanding/event-overhang-s-expected.png
new file mode 100644 (file)
index 0000000..f99833b
Binary files /dev/null and b/LayoutTests/platform/chromium/rubberbanding/event-overhang-s-expected.png differ
diff --git a/LayoutTests/platform/chromium/rubberbanding/event-overhang-s-expected.txt b/LayoutTests/platform/chromium/rubberbanding/event-overhang-s-expected.txt
new file mode 100644 (file)
index 0000000..e18d147
--- /dev/null
@@ -0,0 +1,10 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {DIV} at (0,0) size 784x30 [bgcolor=#000000]
+      RenderBlock {DIV} at (0,30) size 784x18
+        RenderText {#text} at (0,0) size 148x18
+          text run at (0,0) width 148: "This test requires DRT."
+scrolled to 0,100
diff --git a/LayoutTests/platform/chromium/rubberbanding/event-overhang-s.html b/LayoutTests/platform/chromium/rubberbanding/event-overhang-s.html
new file mode 100644 (file)
index 0000000..0c09208
--- /dev/null
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<head><title>Test rubber banding overhang drawing</title></head>
+<body>
+<div style="height:30px; background-color:black; width:100%"></div>
+<div id="info">This test requires DRT.</div>
+<script>
+    if (window.internals) {
+        document.getElementById('info').style.visibility = "hidden";
+        internals.settings.setMockScrollbarsEnabled(false);
+        eventSender.mouseMoveTo(10, 10);
+        eventSender.mouseDragBegin();
+        eventSender.mouseScrollBy(0, -50, false, true);
+    }
+</script>
+</body>
+</html>
diff --git a/LayoutTests/platform/chromium/rubberbanding/event-overhang-w-expected.png b/LayoutTests/platform/chromium/rubberbanding/event-overhang-w-expected.png
new file mode 100644 (file)
index 0000000..5c074eb
Binary files /dev/null and b/LayoutTests/platform/chromium/rubberbanding/event-overhang-w-expected.png differ
diff --git a/LayoutTests/platform/chromium/rubberbanding/event-overhang-w-expected.txt b/LayoutTests/platform/chromium/rubberbanding/event-overhang-w-expected.txt
new file mode 100644 (file)
index 0000000..cff31b6
--- /dev/null
@@ -0,0 +1,9 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {DIV} at (0,0) size 784x30 [bgcolor=#000000]
+      RenderBlock {DIV} at (0,30) size 784x18
+        RenderText {#text} at (0,0) size 148x18
+          text run at (0,0) width 148: "This test requires DRT."
diff --git a/LayoutTests/platform/chromium/rubberbanding/event-overhang-w.html b/LayoutTests/platform/chromium/rubberbanding/event-overhang-w.html
new file mode 100644 (file)
index 0000000..58c45b1
--- /dev/null
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<head><title>Test rubber banding overhang drawing</title></head>
+<body>
+<div style="height:30px; background-color:black; width:100%"></div>
+<div id="info">This test requires DRT.</div>
+<script>
+    if (window.internals) {
+        document.getElementById('info').style.visibility = "hidden";
+        internals.settings.setMockScrollbarsEnabled(false);
+        eventSender.mouseMoveTo(10, 10);
+        eventSender.mouseDragBegin();
+        eventSender.mouseScrollBy(50, 0, false, true);
+    }
+</script>
+</body>
+</html>
index 88cc12f..44065a1 100644 (file)
@@ -1,3 +1,26 @@
+2013-01-31  Christopher Cameron  <ccameron@chromium.org>
+
+        Fix rubber-band effect on non-scrollable pages
+        https://bugs.webkit.org/show_bug.cgi?id=107611
+
+        Reviewed by Antonio Gomes.
+
+        Handle a FrameView's wheel event even if it is not scrollable
+        because Chrome relies on handling these wheel events for the
+        over-scroll rubber-band effect.
+        This had been removed in r138378
+        [EFL][WK2] Never create WebCore scrollbars for EFL/WK2
+        by kenneth@chromium.org
+
+        Tests: platform/chromium/rubberbanding/wheelevent-overhang-e.html
+               platform/chromium/rubberbanding/wheelevent-overhang-n.html
+               platform/chromium/rubberbanding/wheelevent-overhang-s.html
+               platform/chromium/rubberbanding/wheelevent-overhang-w.html
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::wheelEvent):
+
 2013-01-31  Enrica Casucci  <enrica@apple.com>
 
         Mac: Editor::baseWritingDirectionForSelectionStart should return WritingDirection instead of NSWritingDirection.
index 8663a13..7cabf2d 100644 (file)
@@ -3815,8 +3815,12 @@ void FrameView::removeChild(Widget* widget)
 
 bool FrameView::wheelEvent(const PlatformWheelEvent& wheelEvent)
 {
+    // Note that to allow for rubber-band over-scroll behavior, even non-scrollable views
+    // should handle wheel events.
+#if !ENABLE(RUBBER_BANDING)
     if (!isScrollable())
         return false;
+#endif
 
     if (delegatesScrolling()) {
         IntSize offset = scrollOffset();
index dddc902..e7dbafc 100644 (file)
@@ -1,3 +1,20 @@
+2013-01-31  Christopher Cameron  <ccameron@chromium.org>
+
+        Fix rubber-band effect on non-scrollable pages
+        https://bugs.webkit.org/show_bug.cgi?id=107611
+
+        Add mouseWheelBegin function to EventSender to allow
+        event-based rubber-banding tests.
+
+        Reviewed by Antonio Gomes.
+
+        * DumpRenderTree/chromium/TestRunner/src/EventSender.cpp:
+        (WebTestRunner):
+        (WebTestRunner::EventSender::EventSender):
+        (WebTestRunner::EventSender::mouseDragBegin):
+        * DumpRenderTree/chromium/TestRunner/src/EventSender.h:
+        (EventSender):
+
 2013-01-31  James Robinson  <jamesr@chromium.org>
 
         [chromium] Notify the WebWidget when the WebViewHost is about to tear down compositing support
index d56a1a8..b9864b4 100644 (file)
@@ -276,6 +276,7 @@ EventSender::EventSender()
     bindMethod("mouseMoveTo", &EventSender::mouseMoveTo);
     bindMethod("mouseScrollBy", &EventSender::mouseScrollBy);
     bindMethod("mouseUp", &EventSender::mouseUp);
+    bindMethod("mouseDragBegin", &EventSender::mouseDragBegin);
     bindMethod("releaseTouchPoint", &EventSender::releaseTouchPoint);
     bindMethod("scheduleAsynchronousClick", &EventSender::scheduleAsynchronousClick);
     bindMethod("scheduleAsynchronousKeyDown", &EventSender::scheduleAsynchronousKeyDown);
@@ -1044,6 +1045,15 @@ void EventSender::sendCurrentTouchEvent(const WebInputEvent::Type type)
     }
 }
 
+void EventSender::mouseDragBegin(const CppArgumentList& arguments, CppVariant* result)
+{
+    WebMouseWheelEvent event;
+    initMouseEvent(WebInputEvent::MouseWheel, WebMouseEvent::ButtonNone, lastMousePos, &event, getCurrentEventTimeSec(m_delegate));
+    event.phase = WebMouseWheelEvent::PhaseBegan;
+    event.hasPreciseScrollingDeltas = true;
+    webview()->handleInputEvent(event);
+}
+
 void EventSender::handleMouseWheel(const CppArgumentList& arguments, CppVariant* result, bool continuous)
 {
     result->setNull();
index 3c21ef9..70e6ea0 100644 (file)
@@ -83,6 +83,7 @@ public:
     void zoomPageOut(const CppArgumentList&, CppVariant*);
     void scalePageBy(const CppArgumentList&, CppVariant*);
 
+    void mouseDragBegin(const CppArgumentList&, CppVariant*);
     void mouseScrollBy(const CppArgumentList&, CppVariant*);
     void continuousMouseScrollBy(const CppArgumentList&, CppVariant*);
     void scheduleAsynchronousClick(const CppArgumentList&, CppVariant*);