Changeset 199810 in webkit


Ignore:
Timestamp:
Apr 21, 2016 3:50:59 AM (8 years ago)
Author:
Carlos Garcia Campos
Message:

[GTK] WebKitWebView should propagate wheel events not handled by the web process
https://bugs.webkit.org/show_bug.cgi?id=156834

Reviewed by Žan Doberšek.

We are currently swallowing all wheel events unconditionally, not allowing applications to handle wheel events
when not handled by us. Since the GTK+ event propagation system is synchronous, and our events are handled
asynchronously, we need to do something similar to what we do for key events, not propagate the event the first
time and if not handled by the web process, re-inject it in the event loop and then just propagate it.

  • Shared/NativeWebWheelEvent.h:

(WebKit::NativeWebWheelEvent::nativeEvent): Remove useless const.

  • UIProcess/API/gtk/PageClientImpl.cpp:

(WebKit::PageClientImpl::wheelEventWasNotHandledByWebCore): Tell the web view to propagate the next wheel event,
and re-inject the event not handled by the web process in the event loop.

  • UIProcess/API/gtk/PageClientImpl.h:
  • UIProcess/API/gtk/WebKitWebViewBase.cpp:

(webkitWebViewBaseScrollEvent): Propagate the event if shouldForwardNextWheelEvent is true.
(webkitWebViewBaseForwardNextWheelEvent): Set shouldForwardNextWheelEvent to true.

  • UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
  • UIProcess/PageClient.h:
  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::didReceiveEvent): Remove ifdef.

  • UIProcess/efl/WebView.h:
Location:
trunk/Source/WebKit2
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r199795 r199810  
     12016-04-21  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] WebKitWebView should propagate wheel events not handled by the web process
     4        https://bugs.webkit.org/show_bug.cgi?id=156834
     5
     6        Reviewed by Žan Doberšek.
     7
     8        We are currently swallowing all wheel events unconditionally, not allowing applications to handle wheel events
     9        when not handled by us. Since the GTK+ event propagation system is synchronous, and our events are handled
     10        asynchronously, we need to do something similar to what we do for key events, not propagate the event the first
     11        time and if not handled by the web process, re-inject it in the event loop and then just propagate it.
     12
     13        * Shared/NativeWebWheelEvent.h:
     14        (WebKit::NativeWebWheelEvent::nativeEvent): Remove useless const.
     15        * UIProcess/API/gtk/PageClientImpl.cpp:
     16        (WebKit::PageClientImpl::wheelEventWasNotHandledByWebCore): Tell the web view to propagate the next wheel event,
     17        and re-inject the event not handled by the web process in the event loop.
     18        * UIProcess/API/gtk/PageClientImpl.h:
     19        * UIProcess/API/gtk/WebKitWebViewBase.cpp:
     20        (webkitWebViewBaseScrollEvent): Propagate the event if shouldForwardNextWheelEvent is true.
     21        (webkitWebViewBaseForwardNextWheelEvent): Set shouldForwardNextWheelEvent to true.
     22        * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
     23        * UIProcess/PageClient.h:
     24        * UIProcess/WebPageProxy.cpp:
     25        (WebKit::WebPageProxy::didReceiveEvent): Remove ifdef.
     26        * UIProcess/efl/WebView.h:
     27
    1282016-04-20  Dustin Falgout  <dustin@falgout.us>
    229
  • trunk/Source/WebKit2/Shared/NativeWebWheelEvent.h

    r163886 r199810  
    6060    NSEvent* nativeEvent() const { return m_nativeEvent.get(); }
    6161#elif PLATFORM(GTK)
    62     const GdkEvent* nativeEvent() const { return m_nativeEvent.get(); }
     62    GdkEvent* nativeEvent() const { return m_nativeEvent.get(); }
    6363#elif PLATFORM(EFL)
    6464    const Evas_Event_Mouse_Wheel* nativeEvent() const { return m_nativeEvent; }
  • trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp

    r198775 r199810  
    3232#include "NativeWebKeyboardEvent.h"
    3333#include "NativeWebMouseEvent.h"
     34#include "NativeWebWheelEvent.h"
    3435#include "NotImplemented.h"
    3536#include "WebColorPickerGtk.h"
     
    378379#endif // ENABLE(TOUCH_EVENTS)
    379380
     381void PageClientImpl::wheelEventWasNotHandledByWebCore(const NativeWebWheelEvent& event)
     382{
     383    webkitWebViewBaseForwardNextWheelEvent(WEBKIT_WEB_VIEW_BASE(m_viewWidget));
     384    gtk_main_do_event(event.nativeEvent());
     385}
     386
    380387void PageClientImpl::didFinishLoadingDataForCustomContentProvider(const String&, const IPC::DataReference&)
    381388{
  • trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h

    r199695 r199810  
    132132#endif
    133133
     134    void wheelEventWasNotHandledByWebCore(const NativeWebWheelEvent&) override;
     135
    134136    void didChangeBackgroundColor() override;
    135137
  • trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp

    r197733 r199810  
    178178    RefPtr<WebPageProxy> pageProxy;
    179179    bool shouldForwardNextKeyEvent;
     180    bool shouldForwardNextWheelEvent;
    180181    ClickCounter clickCounter;
    181182    CString tooltipText;
     
    854855    WebKitWebViewBasePrivate* priv = webViewBase->priv;
    855856
     857    if (std::exchange(priv->shouldForwardNextWheelEvent, false))
     858        return FALSE;
     859
    856860    if (priv->authenticationDialog)
    857         return TRUE;
     861        return FALSE;
    858862
    859863    priv->pageProxy->handleWheelEvent(NativeWebWheelEvent(reinterpret_cast<GdkEvent*>(event)));
     
    12841288}
    12851289
     1290void webkitWebViewBaseForwardNextWheelEvent(WebKitWebViewBase* webkitWebViewBase)
     1291{
     1292    webkitWebViewBase->priv->shouldForwardNextWheelEvent = true;
     1293}
     1294
    12861295#if ENABLE(FULLSCREEN_API)
    12871296static void screenSaverInhibitedCallback(GDBusProxy* screenSaverProxy, GAsyncResult* result, WebKitWebViewBase* webViewBase)
  • trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h

    r196062 r199810  
    4545void webkitWebViewBaseSetTooltipArea(WebKitWebViewBase*, const WebCore::IntRect&);
    4646void webkitWebViewBaseForwardNextKeyEvent(WebKitWebViewBase*);
     47void webkitWebViewBaseForwardNextWheelEvent(WebKitWebViewBase*);
    4748void webkitWebViewBaseChildMoveResize(WebKitWebViewBase*, GtkWidget*, const WebCore::IntRect&);
    4849void webkitWebViewBaseEnterFullScreen(WebKitWebViewBase*);
  • trunk/Source/WebKit2/UIProcess/PageClient.h

    r199695 r199810  
    169169    virtual bool canUndoRedo(WebPageProxy::UndoOrRedo) = 0;
    170170    virtual void executeUndoRedo(WebPageProxy::UndoOrRedo) = 0;
     171    virtual void wheelEventWasNotHandledByWebCore(const NativeWebWheelEvent&) = 0;
    171172#if PLATFORM(COCOA)
    172173    virtual void accessibilityWebProcessTokenReceived(const IPC::DataReference&) = 0;
     
    180181    virtual LayerOrView *acceleratedCompositingRootLayer() const = 0;
    181182    virtual PassRefPtr<ViewSnapshot> takeViewSnapshot() = 0;
    182     virtual void wheelEventWasNotHandledByWebCore(const NativeWebWheelEvent&) = 0;
    183183#if ENABLE(MAC_GESTURE_EVENTS)
    184184    virtual void gestureEventWasNotHandledByWebCore(const NativeWebGestureEvent&) = 0;
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r199695 r199810  
    46474647            if (m_uiClient->implementsDidNotHandleWheelEvent())
    46484648                m_uiClient->didNotHandleWheelEvent(this, oldestCoalescedEvent->last());
    4649 #if PLATFORM(COCOA)
    46504649            m_pageClient.wheelEventWasNotHandledByWebCore(oldestCoalescedEvent->last());
    4651 #endif
    46524650        }
    46534651
  • trunk/Source/WebKit2/UIProcess/efl/WebView.h

    r199695 r199810  
    208208    void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled) override;
    209209#endif
     210    void wheelEventWasNotHandledByWebCore(const NativeWebWheelEvent&) override { }
    210211
    211212    RefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy&) override;
Note: See TracChangeset for help on using the changeset viewer.