REGRESSION(r227544): [GTK] contextMenuEvent is NULL on CONTEXT_MENU call
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Jan 2018 09:14:33 +0000 (09:14 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Jan 2018 09:14:33 +0000 (09:14 +0000)
commit0ae82d8d9c766937276ab94e05f152bf69a5da08
tree35bde3aba5a27d19705a49357e9f0ae7ddb60f6d
parent5befbf2c947bfad476c8d6440f574fb24b1d80fd
REGRESSION(r227544): [GTK] contextMenuEvent is NULL on CONTEXT_MENU call
https://bugs.webkit.org/show_bug.cgi?id=182224

Reviewed by Michael Catanzaro.

Move the gestures handling to WebKitWebViewBase. This patch adds GestureControllerClient class, created and
implemented by WebKitWebViewBase and used by GestureController instead of the WebPageProxy. This way we ensure
events are handled consistently.

* UIProcess/API/gtk/PageClientImpl.cpp:
(WebKit::PageClientImpl::doneWithTouchEvent): Cast the GdkEvent since GestureController no longer works wirth
const GdkEvents.
(WebKit::PageClientImpl::zoom): Use webkit_web_view_set_zoom_level() in case of WebKitWebView or
WebPageProxy::setPageZoomFactor() otherwise.
* UIProcess/API/gtk/PageClientImpl.h:
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(ClickCounter::currentClickCountForGdkButtonEvent): Receive a GdkEvent to avoid casts.
(webkitWebViewBaseHandleMouseEvent): Helper function to handle mouse events.
(webkitWebViewBaseButtonPressEvent): Use webkitWebViewBaseHandleMouseEvent.
(webkitWebViewBaseButtonReleaseEvent): Ditto.
(webkitWebViewBaseHandleWheelEvent): Helper function to handle wheel events.
(webkitWebViewBaseScrollEvent): Use webkitWebViewBaseHandleWheelEvent.
(webkitWebViewBaseMotionNotifyEvent): Use webkitWebViewBaseHandleMouseEvent.
(webkitWebViewBaseCrossingNotifyEvent): Ditto.
(webkitWebViewBaseGestureController): Pass the widget and client to GestureController.
* UIProcess/gtk/GestureController.cpp:
(WebKit::GestureController::GestureController): Receives a widget and client now.
(WebKit::GestureController::handleEvent): Remove the const.
(WebKit::GestureController::Gesture::Gesture): Initialize client.
(WebKit::GestureController::Gesture::handleEvent): Remove the const.
(WebKit::GestureController::DragGesture::startDrag): Use the client instead of WebPageProxy.
(WebKit::GestureController::DragGesture::handleDrag): Ditto.
(WebKit::GestureController::DragGesture::handleTap): Ditto.
(WebKit::GestureController::DragGesture::begin): Ignore the const returned by gtk_gesture_get_last_event().
(WebKit::GestureController::DragGesture::update): Ditto.
(WebKit::GestureController::DragGesture::end): Ditto.
(WebKit::GestureController::DragGesture::DragGesture): Receives a widget and client now.
(WebKit::GestureController::SwipeGesture::startMomentumScroll): Use the client instead of WebPageProxy.
(WebKit::GestureController::SwipeGesture::swipe): Ignore the const returned by gtk_gesture_get_last_event().
(WebKit::GestureController::SwipeGesture::SwipeGesture): Receives a widget and client now.
(WebKit::GestureController::ZoomGesture::begin): Start the zoom.
(WebKit::GestureController::ZoomGesture::startZoom): Use the client instead of WebPageProxy.
(WebKit::GestureController::ZoomGesture::handleZoom): Ditto.
(WebKit::GestureController::ZoomGesture::ZoomGesture): Receives a widget and client now.
(WebKit::GestureController::LongPressGesture::longPressed): Use the client instead of WebKitWebView.
(WebKit::GestureController::LongPressGesture::pressed): Ignore the const returned by gtk_gesture_get_last_event().
(WebKit::GestureController::LongPressGesture::LongPressGesture): Receives a widget and client now.
(WebKit::GestureController::Gesture::simulateMouseClick): Deleted.
(WebKit::createScrollEvent): Deleted.
* UIProcess/gtk/GestureController.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227893 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp
Source/WebKit/UIProcess/API/gtk/PageClientImpl.h
Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp
Source/WebKit/UIProcess/gtk/GestureController.cpp
Source/WebKit/UIProcess/gtk/GestureController.h