Title: [103277] trunk/Source
Revision
103277
Author
ander...@apple.com
Date
2011-12-19 15:53:58 -0800 (Mon, 19 Dec 2011)

Log Message

Send gesture events through the event dispatcher and scrolling coordinator
https://bugs.webkit.org/show_bug.cgi?id=74879

Reviewed by Andreas Kling.

Source/WebCore:

* WebCore.exp.in:
Export ScrollingCoordinator::handleGestureEvent.

* page/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::handleGestureEvent):
* page/ScrollingCoordinator.h:
Add handleGestureEvent stub.

Source/WebKit2:

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::handleGestureEvent):
Use the EventDispatcher message.

* WebProcess/WebPage/EventDispatcher.cpp:
(WebKit::EventDispatcher::gestureEvent):
Try to send the event to the scrolling coordinator first before dispatching it on the main thread.

(WebKit::EventDispatcher::dispatchGestureEvent):
Just call through to the WebPageProxy.

* WebProcess/WebPage/EventDispatcher.h:
* WebProcess/WebPage/EventDispatcher.messages.in:
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
Move the GestureEvent message from WebPage to EventDispatcher.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (103276 => 103277)


--- trunk/Source/WebCore/ChangeLog	2011-12-19 23:40:04 UTC (rev 103276)
+++ trunk/Source/WebCore/ChangeLog	2011-12-19 23:53:58 UTC (rev 103277)
@@ -1,3 +1,18 @@
+2011-12-19  Anders Carlsson  <ander...@apple.com>
+
+        Send gesture events through the event dispatcher and scrolling coordinator
+        https://bugs.webkit.org/show_bug.cgi?id=74879
+
+        Reviewed by Andreas Kling.
+
+        * WebCore.exp.in:
+        Export ScrollingCoordinator::handleGestureEvent.
+
+        * page/ScrollingCoordinator.cpp:
+        (WebCore::ScrollingCoordinator::handleGestureEvent):
+        * page/ScrollingCoordinator.h:
+        Add handleGestureEvent stub.
+
 2011-12-19  Kentaro Hara  <hara...@chromium.org>
 
         Move WebAudio and WebSocket getters from JSDOMWindowCustom.cpp

Modified: trunk/Source/WebCore/WebCore.exp.in (103276 => 103277)


--- trunk/Source/WebCore/WebCore.exp.in	2011-12-19 23:40:04 UTC (rev 103276)
+++ trunk/Source/WebCore/WebCore.exp.in	2011-12-19 23:53:58 UTC (rev 103277)
@@ -2022,7 +2022,12 @@
 __ZN7WebCore20ScrollingCoordinator16handleWheelEventERKNS_18PlatformWheelEventE
 __ZN7WebCore20ScrollingCoordinatorD1Ev
 __ZN7WebCore4Page20scrollingCoordinatorEv
+
+#if ENABLE(GESTURE_EVENTS)
+__ZN7WebCore20ScrollingCoordinator18handleGestureEventERKNS_20PlatformGestureEventE
 #endif
 
+#endif
 
 
+

Modified: trunk/Source/WebCore/page/ScrollingCoordinator.cpp (103276 => 103277)


--- trunk/Source/WebCore/page/ScrollingCoordinator.cpp	2011-12-19 23:40:04 UTC (rev 103276)
+++ trunk/Source/WebCore/page/ScrollingCoordinator.cpp	2011-12-19 23:53:58 UTC (rev 103277)
@@ -104,6 +104,14 @@
     return true;
 }
 
+#if ENABLE(GESTURE_EVENTS)
+bool ScrollingCoordinator::handleGestureEvent(const PlatformGestureEvent&)
+{
+    // FIXME: Implement.
+    return false;
+}
+#endif
+
 void ScrollingCoordinator::didUpdateMainFrameScrollPosition()
 {
     ASSERT(isMainThread());

Modified: trunk/Source/WebCore/page/ScrollingCoordinator.h (103276 => 103277)


--- trunk/Source/WebCore/page/ScrollingCoordinator.h	2011-12-19 23:40:04 UTC (rev 103276)
+++ trunk/Source/WebCore/page/ScrollingCoordinator.h	2011-12-19 23:53:58 UTC (rev 103277)
@@ -45,6 +45,10 @@
 class Page;
 class PlatformWheelEvent;
 
+#if ENABLE(GESTURE_EVENTS)
+class PlatformGestureEvent;
+#endif
+
 class ScrollingCoordinator : public ThreadSafeRefCounted<ScrollingCoordinator> {
 public:
     static PassRefPtr<ScrollingCoordinator> create(Page*);
@@ -63,6 +67,12 @@
     // and return false if the event must be sent again to the WebCore event handler.
     bool handleWheelEvent(const PlatformWheelEvent&);
 
+#if ENABLE(GESTURE_EVENTS)
+    // Can be called from any thread. Will try to handle the gesture event on the scrolling thread,
+    // and return false if the event must be sent again to the WebCore event handler.
+    bool handleGestureEvent(const PlatformGestureEvent&);
+#endif
+
 private:
     explicit ScrollingCoordinator(Page*);
 

Modified: trunk/Source/WebKit2/ChangeLog (103276 => 103277)


--- trunk/Source/WebKit2/ChangeLog	2011-12-19 23:40:04 UTC (rev 103276)
+++ trunk/Source/WebKit2/ChangeLog	2011-12-19 23:53:58 UTC (rev 103277)
@@ -1,3 +1,27 @@
+2011-12-19  Anders Carlsson  <ander...@apple.com>
+
+        Send gesture events through the event dispatcher and scrolling coordinator
+        https://bugs.webkit.org/show_bug.cgi?id=74879
+
+        Reviewed by Andreas Kling.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::handleGestureEvent):
+        Use the EventDispatcher message.
+
+        * WebProcess/WebPage/EventDispatcher.cpp:
+        (WebKit::EventDispatcher::gestureEvent):
+        Try to send the event to the scrolling coordinator first before dispatching it on the main thread.
+
+        (WebKit::EventDispatcher::dispatchGestureEvent):
+        Just call through to the WebPageProxy.
+
+        * WebProcess/WebPage/EventDispatcher.h:
+        * WebProcess/WebPage/EventDispatcher.messages.in:
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+        Move the GestureEvent message from WebPage to EventDispatcher.
+
 2011-12-19  Jesus Sanchez-Palencia  <jesus.palen...@openbossa.org>
 
         [Qt] Setting QWebPreferences affect multiple WebViews

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (103276 => 103277)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2011-12-19 23:40:04 UTC (rev 103276)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2011-12-19 23:53:58 UTC (rev 103277)
@@ -968,7 +968,7 @@
         return;
 
     process()->responsivenessTimer()->start();
-    process()->send(Messages::WebPage::GestureEvent(event), m_pageID);
+    process()->send(Messages::EventDispatcher::GestureEvent(m_pageID, event), 0);
 }
 #endif
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/EventDispatcher.cpp (103276 => 103277)


--- trunk/Source/WebKit2/WebProcess/WebPage/EventDispatcher.cpp	2011-12-19 23:40:04 UTC (rev 103276)
+++ trunk/Source/WebKit2/WebProcess/WebPage/EventDispatcher.cpp	2011-12-19 23:53:58 UTC (rev 103277)
@@ -95,6 +95,25 @@
     RunLoop::main()->dispatch(bind(&EventDispatcher::dispatchWheelEvent, this, pageID, wheelEvent));
 }
 
+#if ENABLE(GESTURE_EVENTS)
+void EventDispatcher::gestureEvent(uint64_t pageID, const WebGestureEvent& gestureEvent)
+{
+#if ENABLE(THREADED_SCROLLING)
+    MutexLocker locker(m_scrollingCoordinatorsMutex);
+    if (ScrollingCoordinator* scrollingCoordinator = m_scrollingCoordinators.get(pageID).get()) {
+        PlatformGestureEvent platformGestureEvent = platform(gestureEvent);
+
+        if (scrollingCoordinator->handleGestureEvent(platformGestureEvent)) {
+            sendDidHandleEvent(pageID, gestureEvent);
+            return;
+        }
+    }
+#endif
+
+    RunLoop::main()->dispatch(bind(&EventDispatcher::dispatchGestureEvent, this, pageID, gestureEvent));
+}
+#endif
+
 void EventDispatcher::dispatchWheelEvent(uint64_t pageID, const WebWheelEvent& wheelEvent)
 {
     ASSERT(isMainThread());
@@ -106,6 +125,19 @@
     webPage->wheelEvent(wheelEvent);
 }
 
+#if ENABLE(GESTURE_EVENTS)
+void EventDispatcher::dispatchGestureEvent(uint64_t pageID, const WebGestureEvent& gestureEvent)
+{
+    ASSERT(isMainThread());
+
+    WebPage* webPage = WebProcess::shared().webPage(pageID);
+    if (!webPage)
+        return;
+
+    webPage->gestureEvent(gestureEvent);
+}
+#endif
+
 #if ENABLE(THREADED_SCROLLING)
 void EventDispatcher::sendDidHandleEvent(uint64_t pageID, const WebEvent& event)
 {

Modified: trunk/Source/WebKit2/WebProcess/WebPage/EventDispatcher.h (103276 => 103277)


--- trunk/Source/WebKit2/WebProcess/WebPage/EventDispatcher.h	2011-12-19 23:40:04 UTC (rev 103276)
+++ trunk/Source/WebKit2/WebProcess/WebPage/EventDispatcher.h	2011-12-19 23:53:58 UTC (rev 103277)
@@ -42,6 +42,10 @@
 class WebPage;
 class WebWheelEvent;
 
+#if ENABLE(GESTURE_EVENTS)
+class WebGestureEvent;
+#endif
+
 class EventDispatcher : public CoreIPC::Connection::QueueClient {
     WTF_MAKE_NONCOPYABLE(EventDispatcher);
 
@@ -63,9 +67,15 @@
 
     // Message handlers
     void wheelEvent(uint64_t pageID, const WebWheelEvent&);
+#if ENABLE(GESTURE_EVENTS)
+    void gestureEvent(uint64_t pageID, const WebGestureEvent&);
+#endif
 
     // This is called on the main thread.
     void dispatchWheelEvent(uint64_t pageID, const WebWheelEvent&);
+#if ENABLE(GESTURE_EVENTS)
+    void dispatchGestureEvent(uint64_t pageID, const WebGestureEvent&);
+#endif
 
 #if ENABLE(THREADED_SCROLLING)
     void sendDidHandleEvent(uint64_t pageID, const WebEvent&);

Modified: trunk/Source/WebKit2/WebProcess/WebPage/EventDispatcher.messages.in (103276 => 103277)


--- trunk/Source/WebKit2/WebProcess/WebPage/EventDispatcher.messages.in	2011-12-19 23:40:04 UTC (rev 103276)
+++ trunk/Source/WebKit2/WebProcess/WebPage/EventDispatcher.messages.in	2011-12-19 23:53:58 UTC (rev 103277)
@@ -22,4 +22,9 @@
 
 messages -> EventDispatcher {
     WheelEvent(uint64_t pageID, WebKit::WebWheelEvent event) DispatchOnConnectionQueue
+
+#if ENABLE(GESTURE_EVENTS)
+    GestureEvent(uint64_t pageID, WebKit::WebGestureEvent event) DispatchOnConnectionQueue
+#endif
+
 }

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (103276 => 103277)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2011-12-19 23:40:04 UTC (rev 103276)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2011-12-19 23:53:58 UTC (rev 103277)
@@ -469,6 +469,9 @@
     void contextMenuShowing() { m_isShowingContextMenu = true; }
 
     void wheelEvent(const WebWheelEvent&);
+#if ENABLE(GESTURE_EVENTS)
+    void gestureEvent(const WebGestureEvent&);
+#endif
 
 private:
     WebPage(uint64_t pageID, const WebPageCreationParameters&);
@@ -521,9 +524,6 @@
     void wheelEventSyncForTesting(const WebWheelEvent&, bool&);
     void keyEvent(const WebKeyboardEvent&);
     void keyEventSyncForTesting(const WebKeyboardEvent&, bool&);
-#if ENABLE(GESTURE_EVENTS)
-    void gestureEvent(const WebGestureEvent&);
-#endif
 #if ENABLE(TOUCH_EVENTS)
     void touchEvent(const WebTouchEvent&);
     void touchEventSyncForTesting(const WebTouchEvent&, bool& handled);

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (103276 => 103277)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in	2011-12-19 23:40:04 UTC (rev 103276)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in	2011-12-19 23:53:58 UTC (rev 103277)
@@ -37,9 +37,6 @@
     MouseEvent(WebKit::WebMouseEvent event)
     MouseEventSyncForTesting(WebKit::WebMouseEvent event) -> (bool handled)
     WheelEventSyncForTesting(WebKit::WebWheelEvent event) -> (bool handled)
-#if ENABLE(GESTURE_EVENTS)
-    GestureEvent(WebKit::WebGestureEvent event)
-#endif
 #if ENABLE(TOUCH_EVENTS)
     TouchEvent(WebKit::WebTouchEvent event)
     TouchEventSyncForTesting(WebKit::WebTouchEvent event) -> (bool handled)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to