Title: [199810] trunk/Source/WebKit2
Revision
199810
Author
carlo...@webkit.org
Date
2016-04-21 03:50:59 -0700 (Thu, 21 Apr 2016)

Log 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:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (199809 => 199810)


--- trunk/Source/WebKit2/ChangeLog	2016-04-21 08:41:14 UTC (rev 199809)
+++ trunk/Source/WebKit2/ChangeLog	2016-04-21 10:50:59 UTC (rev 199810)
@@ -1,3 +1,30 @@
+2016-04-21  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        [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:
+
 2016-04-20  Dustin Falgout  <dus...@falgout.us>
 
         [GTK] Expose AllowUniversalAccessFromFileURLs preference now that calling localStorage.getItem() results in SecurityError: DOM Exception 18

Modified: trunk/Source/WebKit2/Shared/NativeWebWheelEvent.h (199809 => 199810)


--- trunk/Source/WebKit2/Shared/NativeWebWheelEvent.h	2016-04-21 08:41:14 UTC (rev 199809)
+++ trunk/Source/WebKit2/Shared/NativeWebWheelEvent.h	2016-04-21 10:50:59 UTC (rev 199810)
@@ -59,7 +59,7 @@
 #if USE(APPKIT)
     NSEvent* nativeEvent() const { return m_nativeEvent.get(); }
 #elif PLATFORM(GTK)
-    const GdkEvent* nativeEvent() const { return m_nativeEvent.get(); }
+    GdkEvent* nativeEvent() const { return m_nativeEvent.get(); }
 #elif PLATFORM(EFL)
     const Evas_Event_Mouse_Wheel* nativeEvent() const { return m_nativeEvent; }
 #elif PLATFORM(IOS)

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp (199809 => 199810)


--- trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp	2016-04-21 08:41:14 UTC (rev 199809)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp	2016-04-21 10:50:59 UTC (rev 199810)
@@ -31,6 +31,7 @@
 #include "DrawingAreaProxyImpl.h"
 #include "NativeWebKeyboardEvent.h"
 #include "NativeWebMouseEvent.h"
+#include "NativeWebWheelEvent.h"
 #include "NotImplemented.h"
 #include "WebColorPickerGtk.h"
 #include "WebContextMenuProxyGtk.h"
@@ -377,6 +378,12 @@
 }
 #endif // ENABLE(TOUCH_EVENTS)
 
+void PageClientImpl::wheelEventWasNotHandledByWebCore(const NativeWebWheelEvent& event)
+{
+    webkitWebViewBaseForwardNextWheelEvent(WEBKIT_WEB_VIEW_BASE(m_viewWidget));
+    gtk_main_do_event(event.nativeEvent());
+}
+
 void PageClientImpl::didFinishLoadingDataForCustomContentProvider(const String&, const IPC::DataReference&)
 {
 }

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h (199809 => 199810)


--- trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h	2016-04-21 08:41:14 UTC (rev 199809)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h	2016-04-21 10:50:59 UTC (rev 199810)
@@ -131,6 +131,8 @@
     void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled) override;
 #endif
 
+    void wheelEventWasNotHandledByWebCore(const NativeWebWheelEvent&) override;
+
     void didChangeBackgroundColor() override;
 
     void refView() override;

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp (199809 => 199810)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp	2016-04-21 08:41:14 UTC (rev 199809)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp	2016-04-21 10:50:59 UTC (rev 199810)
@@ -177,6 +177,7 @@
     std::unique_ptr<PageClientImpl> pageClient;
     RefPtr<WebPageProxy> pageProxy;
     bool shouldForwardNextKeyEvent;
+    bool shouldForwardNextWheelEvent;
     ClickCounter clickCounter;
     CString tooltipText;
     IntRect tooltipArea;
@@ -853,8 +854,11 @@
     WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget);
     WebKitWebViewBasePrivate* priv = webViewBase->priv;
 
+    if (std::exchange(priv->shouldForwardNextWheelEvent, false))
+        return FALSE;
+
     if (priv->authenticationDialog)
-        return TRUE;
+        return FALSE;
 
     priv->pageProxy->handleWheelEvent(NativeWebWheelEvent(reinterpret_cast<GdkEvent*>(event)));
 
@@ -1283,6 +1287,11 @@
     webkitWebViewBase->priv->shouldForwardNextKeyEvent = TRUE;
 }
 
+void webkitWebViewBaseForwardNextWheelEvent(WebKitWebViewBase* webkitWebViewBase)
+{
+    webkitWebViewBase->priv->shouldForwardNextWheelEvent = true;
+}
+
 #if ENABLE(FULLSCREEN_API)
 static void screenSaverInhibitedCallback(GDBusProxy* screenSaverProxy, GAsyncResult* result, WebKitWebViewBase* webViewBase)
 {

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h (199809 => 199810)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h	2016-04-21 08:41:14 UTC (rev 199809)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h	2016-04-21 10:50:59 UTC (rev 199810)
@@ -44,6 +44,7 @@
 void webkitWebViewBaseSetTooltipText(WebKitWebViewBase*, const char*);
 void webkitWebViewBaseSetTooltipArea(WebKitWebViewBase*, const WebCore::IntRect&);
 void webkitWebViewBaseForwardNextKeyEvent(WebKitWebViewBase*);
+void webkitWebViewBaseForwardNextWheelEvent(WebKitWebViewBase*);
 void webkitWebViewBaseChildMoveResize(WebKitWebViewBase*, GtkWidget*, const WebCore::IntRect&);
 void webkitWebViewBaseEnterFullScreen(WebKitWebViewBase*);
 void webkitWebViewBaseExitFullScreen(WebKitWebViewBase*);

Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (199809 => 199810)


--- trunk/Source/WebKit2/UIProcess/PageClient.h	2016-04-21 08:41:14 UTC (rev 199809)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h	2016-04-21 10:50:59 UTC (rev 199810)
@@ -168,6 +168,7 @@
     virtual void clearAllEditCommands() = 0;
     virtual bool canUndoRedo(WebPageProxy::UndoOrRedo) = 0;
     virtual void executeUndoRedo(WebPageProxy::UndoOrRedo) = 0;
+    virtual void wheelEventWasNotHandledByWebCore(const NativeWebWheelEvent&) = 0;
 #if PLATFORM(COCOA)
     virtual void accessibilityWebProcessTokenReceived(const IPC::DataReference&) = 0;
     virtual bool executeSavedCommandBySelector(const String& selector) = 0;
@@ -179,7 +180,6 @@
     virtual void setAcceleratedCompositingRootLayer(LayerOrView *) = 0;
     virtual LayerOrView *acceleratedCompositingRootLayer() const = 0;
     virtual PassRefPtr<ViewSnapshot> takeViewSnapshot() = 0;
-    virtual void wheelEventWasNotHandledByWebCore(const NativeWebWheelEvent&) = 0;
 #if ENABLE(MAC_GESTURE_EVENTS)
     virtual void gestureEventWasNotHandledByWebCore(const NativeWebGestureEvent&) = 0;
 #endif

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (199809 => 199810)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2016-04-21 08:41:14 UTC (rev 199809)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2016-04-21 10:50:59 UTC (rev 199810)
@@ -4646,9 +4646,7 @@
         if (!handled) {
             if (m_uiClient->implementsDidNotHandleWheelEvent())
                 m_uiClient->didNotHandleWheelEvent(this, oldestCoalescedEvent->last());
-#if PLATFORM(COCOA)
             m_pageClient.wheelEventWasNotHandledByWebCore(oldestCoalescedEvent->last());
-#endif
         }
 
         if (!m_wheelEventQueue.isEmpty())

Modified: trunk/Source/WebKit2/UIProcess/efl/WebView.h (199809 => 199810)


--- trunk/Source/WebKit2/UIProcess/efl/WebView.h	2016-04-21 08:41:14 UTC (rev 199809)
+++ trunk/Source/WebKit2/UIProcess/efl/WebView.h	2016-04-21 10:50:59 UTC (rev 199810)
@@ -207,6 +207,7 @@
 #if ENABLE(TOUCH_EVENTS)
     void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled) override;
 #endif
+    void wheelEventWasNotHandledByWebCore(const NativeWebWheelEvent&) override { }
 
     RefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy&) override;
 #if ENABLE(CONTEXT_MENUS)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to