Title: [134965] trunk
Revision
134965
Author
commit-qu...@webkit.org
Date
2012-11-16 10:17:30 -0800 (Fri, 16 Nov 2012)

Log Message

Handle gesture events on scrollbars.
https://bugs.webkit.org/show_bug.cgi?id=101516

Patch by Robert Flack <fla...@chromium.org> on 2012-11-16
Reviewed by Antonio Gomes.

Adds a gesture event handler to scrollbars and sends gestures beginning
over a scrollbar to this handler to allow touch scrolling scrollbars.

Source/WebCore:

Test: fast/events/touch/gesture/gesture-scrollbar.html

* page/EventHandler.cpp:
(WebCore::EventHandler::clear):
(WebCore::EventHandler::handleGestureEvent):
(WebCore::EventHandler::isScrollbarHandlingGestures):
(WebCore):
* page/EventHandler.h:
(EventHandler):
* platform/Scrollbar.cpp:
(WebCore::Scrollbar::Scrollbar):
(WebCore):
(WebCore::Scrollbar::gestureEvent):
(WebCore::Scrollbar::mouseMoved):
(WebCore::Scrollbar::mouseUp):
(WebCore::Scrollbar::mouseDown):
* platform/Scrollbar.h:
(WebCore):
(Scrollbar):
* platform/ScrollbarTheme.h:
(WebCore::ScrollbarTheme::hitTest):
* platform/ScrollbarThemeComposite.cpp:
(WebCore::ScrollbarThemeComposite::hitTest):
* platform/ScrollbarThemeComposite.h:
(ScrollbarThemeComposite):
* platform/qt/ScrollbarThemeQStyle.cpp:
(WebCore::ScrollbarThemeQStyle::hitTest):
* platform/qt/ScrollbarThemeQStyle.h:
(ScrollbarThemeQStyle):

Source/WebKit/chromium:

* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::handleGestureEvent):

LayoutTests:

* fast/events/touch/gesture/gesture-scrollbar-expected.txt: Added.
* fast/events/touch/gesture/gesture-scrollbar.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (134964 => 134965)


--- trunk/LayoutTests/ChangeLog	2012-11-16 18:15:33 UTC (rev 134964)
+++ trunk/LayoutTests/ChangeLog	2012-11-16 18:17:30 UTC (rev 134965)
@@ -1,3 +1,16 @@
+2012-11-16  Robert Flack  <fla...@chromium.org>
+
+        Handle gesture events on scrollbars.
+        https://bugs.webkit.org/show_bug.cgi?id=101516
+
+        Reviewed by Antonio Gomes.
+
+        Adds a gesture event handler to scrollbars and sends gestures beginning
+        over a scrollbar to this handler to allow touch scrolling scrollbars.
+
+        * fast/events/touch/gesture/gesture-scrollbar-expected.txt: Added.
+        * fast/events/touch/gesture/gesture-scrollbar.html: Added.
+
 2012-11-16  Dimitri Glazkov  <dglaz...@chromium.org>
 
         [Chromium] Removed incorrect baseline.

Added: trunk/LayoutTests/fast/events/touch/gesture/gesture-scrollbar-expected.txt (0 => 134965)


--- trunk/LayoutTests/fast/events/touch/gesture/gesture-scrollbar-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/gesture/gesture-scrollbar-expected.txt	2012-11-16 18:17:30 UTC (rev 134965)
@@ -0,0 +1,11 @@
+This tests scroll gesture events on a scroll bar. The scrollable div below should be slightly scrolled down if successful.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS movingDiv.scrollTop is 0
+PASS movingDiv.scrollTop is >= 1
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/events/touch/gesture/gesture-scrollbar.html (0 => 134965)


--- trunk/LayoutTests/fast/events/touch/gesture/gesture-scrollbar.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/gesture/gesture-scrollbar.html	2012-11-16 18:17:30 UTC (rev 134965)
@@ -0,0 +1,83 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+<style type="text/css">
+::-webkit-scrollbar {
+  background-color: #ccc;
+  height: 15px;
+  width: 15px;
+}
+
+::-webkit-scrollbar-button {
+  display: none;
+}
+
+::-webkit-scrollbar-thumb {
+  background-color: #777;
+  height: 15px;
+  width: 15px;
+}
+
+#scrollable {
+    height: 300px;
+    width: 300px;
+    overflow: scroll;
+}
+
+.large {
+    height: 600px;
+}
+</style>
+</head>
+<body _onload_="runTest();">
+<div id="scrollable">
+  <div class="large">
+  </div>
+</div>
+
+<script type="text/_javascript_">
+
+var movingDiv;
+
+function verticalScrollTest() {
+    movingDiv = document.getElementById('scrollable');
+    var scrollbarX = movingDiv.offsetLeft + movingDiv.offsetWidth - 5;
+    var scrollThumbSafeOffset = 80;
+    var scrollbarY = movingDiv.offsetTop + scrollThumbSafeOffset;
+
+    shouldBe('movingDiv.scrollTop', '0');
+    eventSender.gestureTapDown(scrollbarX, scrollbarY);
+    eventSender.gestureScrollBegin(scrollbarX, scrollbarY);
+    eventSender.gestureScrollUpdate(0, 20);
+    eventSender.gestureScrollEnd(0, 0);
+    shouldBeGreaterThanOrEqual('movingDiv.scrollTop', '1');
+    // If we've got here, we've passed.
+    isSuccessfullyParsed();
+}
+
+function exitIfNecessary()
+{
+    debug('Gesture events not implemented on this platform or broken');
+    isSuccessfullyParsed();
+}
+
+function runTest()
+{
+    internals.settings.setMockScrollbarsEnabled(true);
+    if (window.eventSender) {
+        description('This tests scroll gesture events on a scroll bar. ' +
+            'The scrollable div below should be slightly scrolled down ' +
+            'if successful.');
+
+        if (eventSender.clearTouchPoints)
+            verticalScrollTest();
+        else
+            exitIfNecessary();
+    } else {
+        debug("This test requires DumpRenderTree.");
+    }
+}
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (134964 => 134965)


--- trunk/Source/WebCore/ChangeLog	2012-11-16 18:15:33 UTC (rev 134964)
+++ trunk/Source/WebCore/ChangeLog	2012-11-16 18:17:30 UTC (rev 134965)
@@ -1,3 +1,43 @@
+2012-11-16  Robert Flack  <fla...@chromium.org>
+
+        Handle gesture events on scrollbars.
+        https://bugs.webkit.org/show_bug.cgi?id=101516
+
+        Reviewed by Antonio Gomes.
+
+        Adds a gesture event handler to scrollbars and sends gestures beginning
+        over a scrollbar to this handler to allow touch scrolling scrollbars.
+
+        Test: fast/events/touch/gesture/gesture-scrollbar.html
+
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::clear):
+        (WebCore::EventHandler::handleGestureEvent):
+        (WebCore::EventHandler::isScrollbarHandlingGestures):
+        (WebCore):
+        * page/EventHandler.h:
+        (EventHandler):
+        * platform/Scrollbar.cpp:
+        (WebCore::Scrollbar::Scrollbar):
+        (WebCore):
+        (WebCore::Scrollbar::gestureEvent):
+        (WebCore::Scrollbar::mouseMoved):
+        (WebCore::Scrollbar::mouseUp):
+        (WebCore::Scrollbar::mouseDown):
+        * platform/Scrollbar.h:
+        (WebCore):
+        (Scrollbar):
+        * platform/ScrollbarTheme.h:
+        (WebCore::ScrollbarTheme::hitTest):
+        * platform/ScrollbarThemeComposite.cpp:
+        (WebCore::ScrollbarThemeComposite::hitTest):
+        * platform/ScrollbarThemeComposite.h:
+        (ScrollbarThemeComposite):
+        * platform/qt/ScrollbarThemeQStyle.cpp:
+        (WebCore::ScrollbarThemeQStyle::hitTest):
+        * platform/qt/ScrollbarThemeQStyle.h:
+        (ScrollbarThemeQStyle):
+
 2012-11-16  Xianzhu Wang  <wangxian...@chromium.org>
 
         [Chromium-Android] Stack overflow in MediaControlsChromiumAndroid.cpp

Modified: trunk/Source/WebCore/page/EventHandler.cpp (134964 => 134965)


--- trunk/Source/WebCore/page/EventHandler.cpp	2012-11-16 18:15:33 UTC (rev 134964)
+++ trunk/Source/WebCore/page/EventHandler.cpp	2012-11-16 18:17:30 UTC (rev 134965)
@@ -397,6 +397,7 @@
 #endif
 #if ENABLE(GESTURE_EVENTS)
     m_scrollGestureHandlingNode = 0;
+    m_scrollbarHandlingScrollGesture = 0;
 #endif
     m_mouseMovedDurationRunningAverage = 0;
     m_baseEventType = PlatformEvent::NoType;
@@ -2520,8 +2521,11 @@
         return false;
 
     Node* eventTarget = 0;
-    if (gestureEvent.type() == PlatformEvent::GestureScrollEnd || gestureEvent.type() == PlatformEvent::GestureScrollUpdate)
+    Scrollbar* scrollbar = 0;
+    if (gestureEvent.type() == PlatformEvent::GestureScrollEnd || gestureEvent.type() == PlatformEvent::GestureScrollUpdate) {
+        scrollbar = m_scrollbarHandlingScrollGesture.get();
         eventTarget = m_scrollGestureHandlingNode.get();
+    }
 
     IntPoint adjustedPoint = gestureEvent.position();
     HitTestRequest::HitTestRequestType hitType = HitTestRequest::TouchEvent;
@@ -2539,12 +2543,29 @@
     if (!shouldGesturesTriggerActive())
         hitType |= HitTestRequest::ReadOnly;
 
-    if (!eventTarget || !(hitType & HitTestRequest::ReadOnly)) {
+    if ((!scrollbar && !eventTarget) || !(hitType & HitTestRequest::ReadOnly)) {
         IntPoint hitTestPoint = m_frame->view()->windowToContents(adjustedPoint);
-        HitTestResult result = hitTestResultAtPoint(hitTestPoint, false, false, DontHitTestScrollbars, hitType);
+        HitTestResult result = hitTestResultAtPoint(hitTestPoint, false, false, ShouldHitTestScrollbars, hitType);
         eventTarget = result.targetNode();
+        if (!scrollbar) {
+            FrameView* view = m_frame->view();
+            scrollbar = view ? view->scrollbarAtPoint(gestureEvent.position()) : 0;
+        }
+        if (!scrollbar)
+            scrollbar = result.scrollbar();
     }
 
+    if (scrollbar) {
+        bool eventSwallowed = scrollbar->gestureEvent(gestureEvent);
+        if (gestureEvent.type() == PlatformEvent::GestureScrollBegin && eventSwallowed)
+            m_scrollbarHandlingScrollGesture = scrollbar;
+        else if (gestureEvent.type() == PlatformEvent::GestureScrollEnd || !eventSwallowed)
+            m_scrollbarHandlingScrollGesture = 0;
+
+        if (eventSwallowed)
+            return true;
+    }
+
     if (eventTarget) {
         bool eventSwallowed = eventTarget->dispatchGestureEvent(gestureEvent);
 
@@ -2659,6 +2680,11 @@
     return handleGestureScrollCore(gestureEvent, ScrollByPixelWheelEvent, true);
 }
 
+bool EventHandler::isScrollbarHandlingGestures() const
+{
+    return m_scrollbarHandlingScrollGesture.get();
+}
+
 bool EventHandler::handleGestureScrollCore(const PlatformGestureEvent& gestureEvent, PlatformWheelEventGranularity granularity, bool latchedWheel)
 {
     const float tickDivisor = (float)WheelEvent::tickMultiplier;

Modified: trunk/Source/WebCore/page/EventHandler.h (134964 => 134965)


--- trunk/Source/WebCore/page/EventHandler.h	2012-11-16 18:15:33 UTC (rev 134964)
+++ trunk/Source/WebCore/page/EventHandler.h	2012-11-16 18:17:30 UTC (rev 134965)
@@ -172,6 +172,7 @@
     bool handleGestureLongPress(const PlatformGestureEvent&);
     bool handleGestureTwoFingerTap(const PlatformGestureEvent&);
     bool handleGestureScrollUpdate(const PlatformGestureEvent&);
+    bool isScrollbarHandlingGestures() const;
 #endif
 
 #if ENABLE(TOUCH_ADJUSTMENT)
@@ -460,6 +461,7 @@
 
 #if ENABLE(GESTURE_EVENTS)
     RefPtr<Node> m_scrollGestureHandlingNode;
+    RefPtr<Scrollbar> m_scrollbarHandlingScrollGesture;
 #endif
 
     double m_mouseMovedDurationRunningAverage;

Modified: trunk/Source/WebCore/platform/Scrollbar.cpp (134964 => 134965)


--- trunk/Source/WebCore/platform/Scrollbar.cpp	2012-11-16 18:15:33 UTC (rev 134964)
+++ trunk/Source/WebCore/platform/Scrollbar.cpp	2012-11-16 18:17:30 UTC (rev 134965)
@@ -33,6 +33,10 @@
 #include "ScrollbarTheme.h"
 #include <algorithm>
 
+#if ENABLE(GESTURE_EVENTS)
+#include "PlatformGestureEvent.h"
+#endif
+
 // FIXME: The following #includes are a layering violation and should be removed.
 #include "AXObjectCache.h"
 #include "AccessibilityScrollbar.h"
@@ -80,6 +84,7 @@
     , m_hoveredPart(NoPart)
     , m_pressedPart(NoPart)
     , m_pressedPos(0)
+    , m_scrollPos(0)
     , m_draggingDocument(false)
     , m_documentDragPos(0)
     , m_enabled(true)
@@ -351,6 +356,45 @@
         theme()->invalidatePart(this, m_hoveredPart);
 }
 
+#if ENABLE(GESTURE_EVENTS)
+bool Scrollbar::gestureEvent(const PlatformGestureEvent& evt)
+{
+    bool handled = false;
+    switch (evt.type()) {
+    case PlatformEvent::GestureTapDown:
+        setPressedPart(theme()->hitTest(this, evt.position()));
+        m_pressedPos = (orientation() == HorizontalScrollbar ? convertFromContainingWindow(evt.position()).x() : convertFromContainingWindow(evt.position()).y());
+        return true;
+    case PlatformEvent::GestureTapDownCancel:
+    case PlatformEvent::GestureScrollBegin:
+        if (m_pressedPart == ThumbPart) {
+            m_scrollPos = m_pressedPos;
+            return true;
+        }
+        break;
+    case PlatformEvent::GestureScrollUpdate:
+        if (m_pressedPart == ThumbPart) {
+            m_scrollPos += HorizontalScrollbar ? evt.deltaX() : evt.deltaY();
+            moveThumb(m_scrollPos, false);
+            return true;
+        }
+        break;
+    case PlatformEvent::GestureScrollEnd:
+        m_scrollPos = 0;
+        break;
+    case PlatformEvent::GestureTap:
+        if (m_pressedPart != ThumbPart && m_pressedPart != NoPart)
+            handled = m_scrollableArea && m_scrollableArea->scroll(pressedPartScrollDirection(), pressedPartScrollGranularity());
+        break;
+    default:
+        break;
+    }
+    setPressedPart(NoPart);
+    m_pressedPos = 0;
+    return handled;
+}
+#endif
+
 bool Scrollbar::mouseMoved(const PlatformMouseEvent& evt)
 {
     if (m_pressedPart == ThumbPart) {
@@ -368,7 +412,7 @@
     if (m_pressedPart != NoPart)
         m_pressedPos = (orientation() == HorizontalScrollbar ? convertFromContainingWindow(evt.position()).x() : convertFromContainingWindow(evt.position()).y());
 
-    ScrollbarPart part = theme()->hitTest(this, evt);
+    ScrollbarPart part = theme()->hitTest(this, evt.position());
     if (part != m_hoveredPart) {
         if (m_pressedPart != NoPart) {
             if (part == m_pressedPart) {
@@ -414,7 +458,7 @@
     if (m_scrollableArea) {
         // m_hoveredPart won't be updated until the next mouseMoved or mouseDown, so we have to hit test
         // to really know if the mouse has exited the scrollbar on a mouseUp.
-        ScrollbarPart part = theme()->hitTest(this, mouseEvent);
+        ScrollbarPart part = theme()->hitTest(this, mouseEvent.position());
         if (part == NoPart)
             m_scrollableArea->mouseExitedScrollbar(this);
     }
@@ -431,7 +475,7 @@
     if (evt.button() == RightButton)
         return true; // FIXME: Handled as context menu by Qt right now.  Should just avoid even calling this method on a right click though.
 
-    setPressedPart(theme()->hitTest(this, evt));
+    setPressedPart(theme()->hitTest(this, evt.position()));
     int pressedPos = (orientation() == HorizontalScrollbar ? convertFromContainingWindow(evt.position()).x() : convertFromContainingWindow(evt.position()).y());
     
     if ((m_pressedPart == BackTrackPart || m_pressedPart == ForwardTrackPart) && theme()->shouldCenterOnThumb(this, evt)) {

Modified: trunk/Source/WebCore/platform/Scrollbar.h (134964 => 134965)


--- trunk/Source/WebCore/platform/Scrollbar.h	2012-11-16 18:15:33 UTC (rev 134964)
+++ trunk/Source/WebCore/platform/Scrollbar.h	2012-11-16 18:17:30 UTC (rev 134965)
@@ -41,6 +41,10 @@
 class ScrollableArea;
 class ScrollbarTheme;
 
+#if ENABLE(GESTURE_EVENTS)
+class PlatformGestureEvent;
+#endif
+
 class Scrollbar : public Widget,
                   public ScrollbarThemeClient {
 
@@ -123,6 +127,10 @@
 
     bool isWindowActive() const;
 
+#if ENABLE(GESTURE_EVENTS)
+    bool gestureEvent(const PlatformGestureEvent&);
+#endif
+
     // These methods are used for platform scrollbars to give :hover feedback.  They will not get called
     // when the mouse went down in a scrollbar, since it is assumed the scrollbar will start
     // grabbing all events in that case anyway.
@@ -183,6 +191,7 @@
     ScrollbarPart m_hoveredPart;
     ScrollbarPart m_pressedPart;
     int m_pressedPos;
+    float m_scrollPos;
     bool m_draggingDocument;
     int m_documentDragPos;
 

Modified: trunk/Source/WebCore/platform/ScrollbarTheme.h (134964 => 134965)


--- trunk/Source/WebCore/platform/ScrollbarTheme.h	2012-11-16 18:15:33 UTC (rev 134964)
+++ trunk/Source/WebCore/platform/ScrollbarTheme.h	2012-11-16 18:17:30 UTC (rev 134965)
@@ -49,7 +49,7 @@
     virtual void updateEnabledState(ScrollbarThemeClient*) { };
 
     virtual bool paint(ScrollbarThemeClient*, GraphicsContext*, const IntRect& /*damageRect*/) { return false; }
-    virtual ScrollbarPart hitTest(ScrollbarThemeClient*, const PlatformMouseEvent&) { return NoPart; }
+    virtual ScrollbarPart hitTest(ScrollbarThemeClient*, const IntPoint&) { return NoPart; }
     
     virtual int scrollbarThickness(ScrollbarControlSize = RegularScrollbar) { return 0; }
 

Modified: trunk/Source/WebCore/platform/ScrollbarThemeComposite.cpp (134964 => 134965)


--- trunk/Source/WebCore/platform/ScrollbarThemeComposite.cpp	2012-11-16 18:15:33 UTC (rev 134964)
+++ trunk/Source/WebCore/platform/ScrollbarThemeComposite.cpp	2012-11-16 18:17:30 UTC (rev 134965)
@@ -115,41 +115,41 @@
     return true;
 }
 
-ScrollbarPart ScrollbarThemeComposite::hitTest(ScrollbarThemeClient* scrollbar, const PlatformMouseEvent& evt)
+ScrollbarPart ScrollbarThemeComposite::hitTest(ScrollbarThemeClient* scrollbar, const IntPoint& position)
 {
     ScrollbarPart result = NoPart;
     if (!scrollbar->enabled())
         return result;
 
-    IntPoint mousePosition = scrollbar->convertFromContainingWindow(evt.position());
-    mousePosition.move(scrollbar->x(), scrollbar->y());
+    IntPoint testPosition = scrollbar->convertFromContainingWindow(position);
+    testPosition.move(scrollbar->x(), scrollbar->y());
     
-    if (!scrollbar->frameRect().contains(mousePosition))
+    if (!scrollbar->frameRect().contains(testPosition))
         return NoPart;
 
     result = ScrollbarBGPart;
 
     IntRect track = trackRect(scrollbar);
-    if (track.contains(mousePosition)) {
+    if (track.contains(testPosition)) {
         IntRect beforeThumbRect;
         IntRect thumbRect;
         IntRect afterThumbRect;
         splitTrack(scrollbar, track, beforeThumbRect, thumbRect, afterThumbRect);
-        if (thumbRect.contains(mousePosition))
+        if (thumbRect.contains(testPosition))
             result = ThumbPart;
-        else if (beforeThumbRect.contains(mousePosition))
+        else if (beforeThumbRect.contains(testPosition))
             result = BackTrackPart;
-        else if (afterThumbRect.contains(mousePosition))
+        else if (afterThumbRect.contains(testPosition))
             result = ForwardTrackPart;
         else
             result = TrackBGPart;
-    } else if (backButtonRect(scrollbar, BackButtonStartPart).contains(mousePosition))
+    } else if (backButtonRect(scrollbar, BackButtonStartPart).contains(testPosition))
         result = BackButtonStartPart;
-    else if (backButtonRect(scrollbar, BackButtonEndPart).contains(mousePosition))
+    else if (backButtonRect(scrollbar, BackButtonEndPart).contains(testPosition))
         result = BackButtonEndPart;
-    else if (forwardButtonRect(scrollbar, ForwardButtonStartPart).contains(mousePosition))
+    else if (forwardButtonRect(scrollbar, ForwardButtonStartPart).contains(testPosition))
         result = ForwardButtonStartPart;
-    else if (forwardButtonRect(scrollbar, ForwardButtonEndPart).contains(mousePosition))
+    else if (forwardButtonRect(scrollbar, ForwardButtonEndPart).contains(testPosition))
         result = ForwardButtonEndPart;
     return result;
 }

Modified: trunk/Source/WebCore/platform/ScrollbarThemeComposite.h (134964 => 134965)


--- trunk/Source/WebCore/platform/ScrollbarThemeComposite.h	2012-11-16 18:15:33 UTC (rev 134964)
+++ trunk/Source/WebCore/platform/ScrollbarThemeComposite.h	2012-11-16 18:17:30 UTC (rev 134965)
@@ -34,7 +34,7 @@
 public:
     // Implement ScrollbarTheme interface
     virtual bool paint(ScrollbarThemeClient*, GraphicsContext*, const IntRect& damageRect);
-    virtual ScrollbarPart hitTest(ScrollbarThemeClient*, const PlatformMouseEvent&);
+    virtual ScrollbarPart hitTest(ScrollbarThemeClient*, const IntPoint&);
     virtual void invalidatePart(ScrollbarThemeClient*, ScrollbarPart);
     virtual int thumbPosition(ScrollbarThemeClient*);
     virtual int thumbLength(ScrollbarThemeClient*);

Modified: trunk/Source/WebCore/platform/qt/ScrollbarThemeQStyle.cpp (134964 => 134965)


--- trunk/Source/WebCore/platform/qt/ScrollbarThemeQStyle.cpp	2012-11-16 18:15:33 UTC (rev 134964)
+++ trunk/Source/WebCore/platform/qt/ScrollbarThemeQStyle.cpp	2012-11-16 18:17:30 UTC (rev 134965)
@@ -151,10 +151,10 @@
     return true;
 }
 
-ScrollbarPart ScrollbarThemeQStyle::hitTest(ScrollbarThemeClient* scrollbar, const PlatformMouseEvent& evt)
+ScrollbarPart ScrollbarThemeQStyle::hitTest(ScrollbarThemeClient* scrollbar, const IntPoint& position)
 {
     QStyleFacadeOption opt = initSliderStyleOption(scrollbar);
-    const QPoint pos = scrollbar->convertFromContainingWindow(evt.position());
+    const QPoint pos = scrollbar->convertFromContainingWindow(position);
     opt.rect.moveTo(QPoint(0, 0));
     QStyleFacade::SubControl sc = m_qStyle->hitTestScrollBar(opt, pos);
     return scrollbarPart(sc);

Modified: trunk/Source/WebCore/platform/qt/ScrollbarThemeQStyle.h (134964 => 134965)


--- trunk/Source/WebCore/platform/qt/ScrollbarThemeQStyle.h	2012-11-16 18:15:33 UTC (rev 134964)
+++ trunk/Source/WebCore/platform/qt/ScrollbarThemeQStyle.h	2012-11-16 18:17:30 UTC (rev 134965)
@@ -42,7 +42,7 @@
     virtual bool paint(ScrollbarThemeClient*, GraphicsContext*, const IntRect& dirtyRect);
     virtual void paintScrollCorner(ScrollView*, GraphicsContext*, const IntRect& cornerRect);
 
-    virtual ScrollbarPart hitTest(ScrollbarThemeClient*, const PlatformMouseEvent&);
+    virtual ScrollbarPart hitTest(ScrollbarThemeClient*, const IntPoint&);
 
     virtual bool shouldCenterOnThumb(ScrollbarThemeClient*, const PlatformMouseEvent&);
 

Modified: trunk/Source/WebKit/chromium/ChangeLog (134964 => 134965)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-11-16 18:15:33 UTC (rev 134964)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-11-16 18:17:30 UTC (rev 134965)
@@ -1,3 +1,16 @@
+2012-11-16  Robert Flack  <fla...@chromium.org>
+
+        Handle gesture events on scrollbars.
+        https://bugs.webkit.org/show_bug.cgi?id=101516
+
+        Reviewed by Antonio Gomes.
+
+        Adds a gesture event handler to scrollbars and sends gestures beginning
+        over a scrollbar to this handler to allow touch scrolling scrollbars.
+
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::handleGestureEvent):
+
 2012-11-16  Peter Beverloo  <pe...@chromium.org>
 
         Unreviewed.  Rolled DEPS.

Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (134964 => 134965)


--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2012-11-16 18:15:33 UTC (rev 134964)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2012-11-16 18:17:30 UTC (rev 134965)
@@ -692,6 +692,8 @@
 
     switch (event.type) {
     case WebInputEvent::GestureFlingStart: {
+        if (mainFrameImpl()->frame()->eventHandler()->isScrollbarHandlingGestures())
+            break;
         m_client->cancelScheduledContentIntents();
         m_lastWheelPosition = WebPoint(event.x, event.y);
         m_lastWheelGlobalPosition = WebPoint(event.globalX, event.globalY);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to