[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

kov at webkit.org kov at webkit.org
Thu Oct 29 20:33:57 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit b63966ada75b3e4569636a96e50ee55ffd720d5f
Author: kov at webkit.org <kov at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Sep 24 21:58:59 2009 +0000

    Implement correct horizontal scrollbar behavior for GTK+
    
    WebCore
    
    2009-09-24  Gustavo Noronha Silva  <gustavo.noronha at collabora.co.uk>
    
            Reviewed by Oliver Hunt.
    
            Implement correct horizontal scrollbar behavior for GTK+ also on
            styled scrollbars.
    
            https://bugs.webkit.org/show_bug.cgi?id=29348
            [Gtk] Scrollwheel on horizontal scrollbars should slide horizontally
    
            Test: platform/gtk/scrollbars/overflow-scrollbar-horizontal-wheel-scroll.html
    
            * page/EventHandler.cpp:
            (WebCore::EventHandler::handleWheelEvent): on GTK+, when using the
            wheel with the pointer on the horizontal scrollbar, scroll
            horizontally;
            * platform/PlatformWheelEvent.h:
            * platform/gtk/WheelEventGtk.cpp:
            (WebCore::PlatformWheelEvent::swapOrientation): allow adding a
            vertical scroll to the horizontal one;
    
    WebKitTools
    
    2009-09-24  Gustavo Noronha Silva  <gustavo.noronha at collabora.co.uk>
    
            Reviewed by Oliver Hunt.
    
            Add support for DRT to send mouse wheel events.
    
            https://bugs.webkit.org/show_bug.cgi?id=29348
            [Gtk] Scrollwheel on horizontal scrollbars should slide horizontally
    
            * DumpRenderTree/gtk/EventSender.cpp:
            (mouseWheelToCallback):
    
    LayoutTests
    
    2009-09-24  Gustavo Noronha Silva  <gustavo.noronha at collabora.co.uk>
    
            Reviewed by Oliver Hunt.
    
            Test for correct wheel scrolling behavior.
    
            https://bugs.webkit.org/show_bug.cgi?id=29348
            [Gtk] Scrollwheel on horizontal scrollbars should slide horizontally
    
            * platform/gtk/scrollbars/overflow-scrollbar-horizontal-wheel-scroll.html: Added.
            * platform/gtk/scrollbars/overflow-scrollbar-horizontal-wheel-scroll-expected.txt: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48735 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 167e0c0..6d89d12 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2009-09-24  Gustavo Noronha Silva  <gustavo.noronha at collabora.co.uk>
+
+        Reviewed by Oliver Hunt.
+
+        Test for correct wheel scrolling behavior.
+
+        https://bugs.webkit.org/show_bug.cgi?id=29348
+        [Gtk] Scrollwheel on horizontal scrollbars should slide horizontally
+
+        * platform/gtk/scrollbars/overflow-scrollbar-horizontal-wheel-scroll.html: Added.
+        * platform/gtk/scrollbars/overflow-scrollbar-horizontal-wheel-scroll-expected.txt: Added.
+
 2009-09-24  Philippe Normand  <pnormand at igalia.com>
 
         Reviewed by Gustavo Noronha.
diff --git a/LayoutTests/platform/gtk/scrollbars/overflow-scrollbar-horizontal-wheel-scroll-expected.txt b/LayoutTests/platform/gtk/scrollbars/overflow-scrollbar-horizontal-wheel-scroll-expected.txt
new file mode 100644
index 0000000..ce29272
--- /dev/null
+++ b/LayoutTests/platform/gtk/scrollbars/overflow-scrollbar-horizontal-wheel-scroll-expected.txt
@@ -0,0 +1,4 @@
+Test for bug 29348: This tests that using the mouse wheel while having the pointer in a horizontal scrollbar makes it scroll horizontally, also with styled scrollbars. On success, the vertical offset for both divs should be 80, and the horizonta 40.
+
+Scroll offset for 'overflow' is 80 and 40
+Scroll offset for 'styled' is 80 and 40
diff --git a/LayoutTests/platform/gtk/scrollbars/overflow-scrollbar-horizontal-wheel-scroll.html b/LayoutTests/platform/gtk/scrollbars/overflow-scrollbar-horizontal-wheel-scroll.html
new file mode 100644
index 0000000..7522fdd
--- /dev/null
+++ b/LayoutTests/platform/gtk/scrollbars/overflow-scrollbar-horizontal-wheel-scroll.html
@@ -0,0 +1,162 @@
+<html>
+<style>
+div#styled::-webkit-scrollbar {
+  width:17px;
+  height:17px;
+}
+
+div#styled::-webkit-scrollbar-button {
+  display:block;
+  width: 17px;
+  height: 17px;
+}
+
+div#styled::-webkit-scrollbar-button:vertical {
+  background-color:lightblue;
+  border:2px solid black;
+}
+
+div#styled::-webkit-scrollbar-button:horizontal {
+  background-color:#208020;
+  border:2px solid black;
+}
+
+div#styled::-webkit-scrollbar-thumb {
+  min-width:20px;
+  min-height:20px;
+  background-color: navy;
+  border:2px solid #cccccc;
+}
+
+div#styled::-webkit-scrollbar-thumb:horizontal {
+  background-color: #004000;
+}
+
+div#styled::-webkit-scrollbar-button:disabled {
+  display:none
+}
+
+div#styled::-webkit-scrollbar-track {
+  background-color: #2060a0;
+}
+
+div#styled::-webkit-scrollbar-track:horizontal {
+  background-color: #40a040;
+}
+</style>
+<body style="margin:0">
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+</script>
+<div id="overflow" style="border:2px solid black;overflow:auto;height:200px;width:200px; left: 0px; top: 100px; position: absolute;">
+<div style="background-color:green;width:1000px;height:1000px;"></div>
+<div style="background-color:red;width:1000px;height:1000px;"></div>
+</div>
+<div id="styled" style="width:200px; height:200px; overflow-y:scroll; overflow-x:scroll; position: absolute; left: 450px; top: 100px;">
+Hello<br>
+Hello<br>Hello<br>Hello<br>Hello<br>Hello<br>Hello<br>Hello<br>
+Hello<br>Hello<br>Hello<br>Hello<br>
+Hello<br>Hello<br>Hello<br>Hello<br>
+<span style="white-space:nowrap">Hello world this is a long string and will not wrap.</span>
+Hello<br>Hello<br>Hello<br>Hello<br>
+Hello<br>Hello<br>Hello<br>Hello<br>Hello<br>Hello<br>
+Hello<br>Hello<br>Hello<br>Hello<br>
+Hello<br>Hello<br>Hello<br>Hello<br>Hello<br>Hello<br>
+Hello<br>Hello<br>Hello<br>Hello<br>
+Hello<br>Hello<br>Hello<br>
+</div>
+<p>Test
+for <a href="https://bugs.webkit.org/show_bug.cgi?id=29348">bug
+29348</a>: This tests that using the mouse wheel while having the
+pointer in a horizontal scrollbar makes it scroll horizontally, also
+with styled scrollbars. On success, the vertical offset for both divs
+should be 80, and the horizonta 40.<p/>
+<div id="console"></div>
+<script>
+function failed() {
+    document.getElementById('console').innerHTML = "FAILED";
+    window.layoutTestController.notifyDone();
+}
+
+if (window.eventSender) {
+    var overflow = document.getElementById('overflow');
+
+    // Scroll inside the div
+    var x = overflow.offsetLeft + overflow.offsetWidth - 50;
+    var y = overflow.offsetTop + overflow.offsetHeight - 50;
+    eventSender.mouseMoveTo(x, y);
+    eventSender.mouseWheelTo(0, 1);
+
+    if (overflow.scrollTop != 40 || overflow.scrollLeft != 0)
+        failed();
+
+    // Scroll on top of the horizontal scrollbar
+    var x = overflow.offsetLeft + overflow.offsetWidth - 50;
+    var y = overflow.offsetTop + overflow.offsetHeight - 6;
+    eventSender.mouseMoveTo(x, y);
+    eventSender.mouseWheelTo(0, 1);
+
+    if (overflow.scrollTop != 40 || overflow.scrollLeft != 40)
+        failed();
+
+    // Scroll on top of the vertical scrollbar
+    var x = overflow.offsetLeft + overflow.offsetWidth - 6;
+    var y = overflow.offsetTop + overflow.offsetHeight - 50;
+    eventSender.mouseMoveTo(x, y);
+    eventSender.mouseWheelTo(0, 1);
+
+    if (overflow.scrollTop != 80 || overflow.scrollLeft != 40)
+        failed();
+
+    var styled = document.getElementById('styled');
+
+    // Scroll inside the div
+    var x = styled.offsetLeft + styled.offsetWidth - 50;
+    var y = styled.offsetTop + styled.offsetHeight - 50;
+    eventSender.mouseMoveTo(x, y);
+    eventSender.mouseWheelTo(0, 1);
+
+    if (styled.scrollTop != 40 || styled.scrollLeft != 0)
+        failed();
+
+    // Scroll on top of the horizontal scrollbar
+    var x = styled.offsetLeft + styled.offsetWidth - 50;
+    var y = styled.offsetTop + styled.offsetHeight - 6;
+    eventSender.mouseMoveTo(x, y);
+    eventSender.mouseWheelTo(0, 1);
+
+    if (styled.scrollTop != 40 || styled.scrollLeft != 40)
+        failed();
+
+    // Scroll on top of the vertical scrollbar
+    var x = styled.offsetLeft + styled.offsetWidth - 6;
+    var y = styled.offsetTop + styled.offsetHeight - 50;
+    eventSender.mouseMoveTo(x, y);
+    eventSender.mouseWheelTo(0, 1);
+
+    if (styled.scrollTop != 80 || styled.scrollLeft != 40)
+        failed();
+
+    setTimeout(finished, 500);
+}
+
+function finished()
+{
+    var msg = "Scroll offset for 'overflow' is " + document.getElementById('overflow').scrollTop + " and " + document.getElementById('overflow').scrollLeft;
+    msg += "<br/>";
+    msg += "Scroll offset for 'styled' is " + document.getElementById('styled').scrollTop + " and " + document.getElementById('styled').scrollLeft;
+
+    document.getElementById('console').innerHTML = msg;
+
+    // Just to cleanup the test results page
+    document.getElementById('styled').style.display = 'none';
+
+    window.layoutTestController.notifyDone();
+}
+
+</script>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 4f145d5..8ba3915 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,24 @@
+2009-09-24  Gustavo Noronha Silva  <gustavo.noronha at collabora.co.uk>
+
+        Reviewed by Oliver Hunt.
+
+        Implement correct horizontal scrollbar behavior for GTK+ also on
+        styled scrollbars.
+
+        https://bugs.webkit.org/show_bug.cgi?id=29348
+        [Gtk] Scrollwheel on horizontal scrollbars should slide horizontally
+
+        Test: platform/gtk/scrollbars/overflow-scrollbar-horizontal-wheel-scroll.html
+
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::handleWheelEvent): on GTK+, when using the
+        wheel with the pointer on the horizontal scrollbar, scroll
+        horizontally;
+        * platform/PlatformWheelEvent.h:
+        * platform/gtk/WheelEventGtk.cpp:
+        (WebCore::PlatformWheelEvent::swapOrientation): allow adding a
+        vertical scroll to the horizontal one;
+
 2009-09-24  Jeremy Orlow  <jorlow at chromium.org>
 
         Reviewed by Eric Seidel.
diff --git a/WebCore/page/EventHandler.cpp b/WebCore/page/EventHandler.cpp
index 8d519ef..cd76c53 100644
--- a/WebCore/page/EventHandler.cpp
+++ b/WebCore/page/EventHandler.cpp
@@ -1758,6 +1758,13 @@ bool EventHandler::dispatchMouseEvent(const AtomicString& eventType, Node* targe
     return swallowEvent;
 }
 
+#if !PLATFORM(GTK)
+bool EventHandler::shouldTurnVerticalTicksIntoHorizontal(const HitTestResult& result) const
+{
+    return false;
+}
+#endif
+
 bool EventHandler::handleWheelEvent(PlatformWheelEvent& e)
 {
     Document* doc = m_frame->document();
@@ -1777,11 +1784,12 @@ bool EventHandler::handleWheelEvent(PlatformWheelEvent& e)
     bool isOverWidget;
     bool didSetLatchedNode = false;
 
+    HitTestRequest request(HitTestRequest::ReadOnly);
+    HitTestResult result(vPoint);
+    doc->renderView()->layer()->hitTest(request, result);
+
     if (m_useLatchedWheelEventNode) {
         if (!m_latchedWheelEventNode) {
-            HitTestRequest request(HitTestRequest::ReadOnly);
-            HitTestResult result(vPoint);
-            doc->renderView()->layer()->hitTest(request, result);
             m_latchedWheelEventNode = result.innerNode();
             m_widgetIsLatched = result.isOverWidget();
             didSetLatchedNode = true;
@@ -1795,13 +1803,13 @@ bool EventHandler::handleWheelEvent(PlatformWheelEvent& e)
         if (m_previousWheelScrolledNode)
             m_previousWheelScrolledNode = 0;
 
-        HitTestRequest request(HitTestRequest::ReadOnly);
-        HitTestResult result(vPoint);
-        doc->renderView()->layer()->hitTest(request, result);
         node = result.innerNode();
         isOverWidget = result.isOverWidget();
     }
 
+    if (shouldTurnVerticalTicksIntoHorizontal(result))
+        e.turnVerticalTicksIntoHorizontal();
+
     if (node) {
         // Figure out which view to send the event to.
         RenderObject* target = node->renderer();
diff --git a/WebCore/page/EventHandler.h b/WebCore/page/EventHandler.h
index 7066252..e1a02db 100644
--- a/WebCore/page/EventHandler.h
+++ b/WebCore/page/EventHandler.h
@@ -125,6 +125,8 @@ public:
     bool shouldDragAutoNode(Node*, const IntPoint&) const; // -webkit-user-drag == auto
 #endif
 
+    bool shouldTurnVerticalTicksIntoHorizontal(const HitTestResult&) const;
+
     bool tabsToLinks(KeyboardEvent*) const;
     bool tabsToAllControls(KeyboardEvent*) const;
 
diff --git a/WebCore/page/gtk/EventHandlerGtk.cpp b/WebCore/page/gtk/EventHandlerGtk.cpp
index d12cdcc..7051391 100644
--- a/WebCore/page/gtk/EventHandlerGtk.cpp
+++ b/WebCore/page/gtk/EventHandlerGtk.cpp
@@ -122,4 +122,13 @@ unsigned EventHandler::accessKeyModifiers()
     return PlatformKeyboardEvent::AltKey;
 }
 
+// GTK+ must scroll horizontally if the mouse pointer is on top of the
+// horizontal scrollbar while scrolling with the wheel; we need to
+// add the deltas and ticks here so that this behavior is consistent
+// for styled scrollbars.
+bool EventHandler::shouldTurnVerticalTicksIntoHorizontal(const HitTestResult& result) const
+{
+    return result.scrollbar() && result.scrollbar()->orientation() == HorizontalScrollbar;
+}
+
 }
diff --git a/WebCore/platform/PlatformWheelEvent.h b/WebCore/platform/PlatformWheelEvent.h
index 537deac..9a4a0cb 100644
--- a/WebCore/platform/PlatformWheelEvent.h
+++ b/WebCore/platform/PlatformWheelEvent.h
@@ -93,6 +93,15 @@ namespace WebCore {
         void accept() { m_isAccepted = true; }
         void ignore() { m_isAccepted = false; }
 
+        void turnVerticalTicksIntoHorizontal()
+        {
+            m_deltaX = m_deltaY;
+            m_deltaY = 0;
+
+            m_wheelTicksX = m_wheelTicksY;
+            m_wheelTicksY = 0;
+        }
+
 #if PLATFORM(GTK)
         PlatformWheelEvent(GdkEventScroll*);
 #endif
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index d375678..d4e2ae4 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,15 @@
+2009-09-24  Gustavo Noronha Silva  <gustavo.noronha at collabora.co.uk>
+
+        Reviewed by Oliver Hunt.
+
+        Add support for DRT to send mouse wheel events.
+
+        https://bugs.webkit.org/show_bug.cgi?id=29348
+        [Gtk] Scrollwheel on horizontal scrollbars should slide horizontally
+
+        * DumpRenderTree/gtk/EventSender.cpp:
+        (mouseWheelToCallback):
+
 2009-09-17  Eric Seidel  <eric at webkit.org>
 
         Reviewed by David Levin.
diff --git a/WebKitTools/DumpRenderTree/gtk/EventSender.cpp b/WebKitTools/DumpRenderTree/gtk/EventSender.cpp
index 4583e12..8ee74c8 100644
--- a/WebKitTools/DumpRenderTree/gtk/EventSender.cpp
+++ b/WebKitTools/DumpRenderTree/gtk/EventSender.cpp
@@ -232,6 +232,52 @@ static JSValueRef mouseMoveToCallback(JSContextRef context, JSObjectRef function
     return JSValueMakeUndefined(context);
 }
 
+static JSValueRef mouseWheelToCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
+    if (!view)
+        return JSValueMakeUndefined(context);
+
+    if (argumentCount < 2)
+        return JSValueMakeUndefined(context);
+
+    int horizontal = (int)JSValueToNumber(context, arguments[0], exception);
+    g_return_val_if_fail((!exception || !*exception), JSValueMakeUndefined(context));
+    int vertical = (int)JSValueToNumber(context, arguments[1], exception);
+    g_return_val_if_fail((!exception || !*exception), JSValueMakeUndefined(context));
+
+    // GTK+ doesn't support multiple direction scrolls in the same event!
+    g_return_val_if_fail((!vertical || !horizontal), JSValueMakeUndefined(context));
+
+    GdkEvent event;
+    event.type = GDK_SCROLL;
+    event.scroll.x = lastMousePositionX;
+    event.scroll.y = lastMousePositionY;
+    event.scroll.time = GDK_CURRENT_TIME;
+    event.scroll.window = GTK_WIDGET(view)->window;
+
+    if (horizontal < 0)
+        event.scroll.direction = GDK_SCROLL_LEFT;
+    else if (horizontal > 0)
+        event.scroll.direction = GDK_SCROLL_RIGHT;
+    else if (vertical < 0)
+        event.scroll.direction = GDK_SCROLL_UP;
+    else if (vertical > 0)
+        event.scroll.direction = GDK_SCROLL_DOWN;
+    else
+        g_assert_not_reached();
+
+    if (dragMode && down && !replayingSavedEvents) {
+        msgQueue[endOfQueue].event = event;
+        msgQueue[endOfQueue++].isDragEvent = true;
+    } else {
+        webkit_web_frame_layout(mainFrame);
+        gtk_main_do_event(&event);
+    }
+
+    return JSValueMakeUndefined(context);
+}
+
 static JSValueRef beginDragWithFilesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
 {
     if (argumentCount < 1)
@@ -443,6 +489,7 @@ static JSValueRef zoomPageOutCallback(JSContextRef context, JSObjectRef function
 }
 
 static JSStaticFunction staticFunctions[] = {
+    { "mouseWheelTo", mouseWheelToCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     { "contextClick", contextClickCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     { "mouseDown", mouseDownCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     { "mouseUp", mouseUpCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list