Title: [257432] releases/WebKitGTK/webkit-2.28
Revision
257432
Author
[email protected]
Date
2020-02-26 02:56:09 -0800 (Wed, 26 Feb 2020)

Log Message

Merge r256913 - [WPE] Support 2D axis, smooth-motion events
https://bugs.webkit.org/show_bug.cgi?id=207881

Reviewed by Carlos Garcia Campos.

Source/WebKit:

WPE's WebEventFactory should also handle axis events that are capable
of providing information about axis change in both dimensions. In case
of smooth motion, the delta values should be preserved and not
transformed into line-steps.

Similarly, the ScrollGestureController should also adopt the 2D axis
event type, producing smooth-motion events when dispatching handling
a scroll gesture.

The changes are guarded and only enabled when building against at least
libwpe 1.5.0 since that's when the new API was added.

* Shared/libwpe/WebEventFactory.cpp:
(WebKit::WebEventFactory::createWebWheelEvent):
* UIProcess/API/wpe/ScrollGestureController.cpp:
(WebKit::ScrollGestureController::handleEvent):
* UIProcess/API/wpe/ScrollGestureController.h:
(WebKit::ScrollGestureController::axisEvent):

Tools:

* wpe/jhbuild.modules: Bump to a newer libwpe commit.

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.28/Source/WebKit/ChangeLog (257431 => 257432)


--- releases/WebKitGTK/webkit-2.28/Source/WebKit/ChangeLog	2020-02-26 10:56:03 UTC (rev 257431)
+++ releases/WebKitGTK/webkit-2.28/Source/WebKit/ChangeLog	2020-02-26 10:56:09 UTC (rev 257432)
@@ -1,3 +1,29 @@
+2020-02-18  Zan Dobersek  <[email protected]>
+
+        [WPE] Support 2D axis, smooth-motion events
+        https://bugs.webkit.org/show_bug.cgi?id=207881
+
+        Reviewed by Carlos Garcia Campos.
+
+        WPE's WebEventFactory should also handle axis events that are capable
+        of providing information about axis change in both dimensions. In case
+        of smooth motion, the delta values should be preserved and not
+        transformed into line-steps.
+
+        Similarly, the ScrollGestureController should also adopt the 2D axis
+        event type, producing smooth-motion events when dispatching handling
+        a scroll gesture.
+
+        The changes are guarded and only enabled when building against at least
+        libwpe 1.5.0 since that's when the new API was added.
+
+        * Shared/libwpe/WebEventFactory.cpp:
+        (WebKit::WebEventFactory::createWebWheelEvent):
+        * UIProcess/API/wpe/ScrollGestureController.cpp:
+        (WebKit::ScrollGestureController::handleEvent):
+        * UIProcess/API/wpe/ScrollGestureController.h:
+        (WebKit::ScrollGestureController::axisEvent):
+
 2020-02-17  Alberto Garcia  <[email protected]>
 
         [WPE] Change the QML plugin install path

Modified: releases/WebKitGTK/webkit-2.28/Source/WebKit/Shared/libwpe/WebEventFactory.cpp (257431 => 257432)


--- releases/WebKitGTK/webkit-2.28/Source/WebKit/Shared/libwpe/WebEventFactory.cpp	2020-02-26 10:56:03 UTC (rev 257431)
+++ releases/WebKitGTK/webkit-2.28/Source/WebKit/Shared/libwpe/WebEventFactory.cpp	2020-02-26 10:56:09 UTC (rev 257432)
@@ -144,6 +144,35 @@
 
 WebWheelEvent WebEventFactory::createWebWheelEvent(struct wpe_input_axis_event* event, float deviceScaleFactor)
 {
+    WebCore::IntPoint position(event->x, event->y);
+    position.scale(1 / deviceScaleFactor);
+
+    WebCore::FloatSize wheelTicks;
+    WebCore::FloatSize delta;
+
+#if WPE_CHECK_VERSION(1, 5, 0)
+    if (event->type & wpe_input_axis_event_type_mask_2d) {
+        auto* event2D = reinterpret_cast<struct wpe_input_axis_2d_event*>(event);
+        switch (event->type & (wpe_input_axis_event_type_mask_2d - 1)) {
+        case wpe_input_axis_event_type_motion:
+            wheelTicks = WebCore::FloatSize(std::copysign(1, event2D->x_axis), std::copysign(1, event2D->y_axis));
+            delta = wheelTicks;
+            delta.scale(WebCore::Scrollbar::pixelsPerLineStep());
+            break;
+        case wpe_input_axis_event_type_motion_smooth:
+            wheelTicks = WebCore::FloatSize(event2D->x_axis / deviceScaleFactor, event2D->y_axis / deviceScaleFactor);
+            delta = wheelTicks;
+            break;
+        default:
+            return WebWheelEvent();
+        }
+
+        return WebWheelEvent(WebEvent::Wheel, position, position,
+            delta, wheelTicks, WebWheelEvent::ScrollByPixelWheelEvent,
+            OptionSet<WebEvent::Modifier> { }, wallTimeForEventTime(event->time));
+    }
+#endif
+
     // FIXME: We shouldn't hard-code this.
     enum Axis {
         Vertical,
@@ -151,8 +180,6 @@
         Smooth
     };
 
-    WebCore::FloatSize wheelTicks;
-    WebCore::FloatSize delta;
     switch (event->axis) {
     case Vertical:
         wheelTicks = WebCore::FloatSize(0, std::copysign(1, event->value));
@@ -169,13 +196,12 @@
         delta = wheelTicks;
         break;
     default:
-        ASSERT_NOT_REACHED();
+        return WebWheelEvent();
     };
 
-    WebCore::IntPoint position(event->x, event->y);
-    position.scale(1 / deviceScaleFactor);
     return WebWheelEvent(WebEvent::Wheel, position, position,
-        delta, wheelTicks, WebWheelEvent::ScrollByPixelWheelEvent, OptionSet<WebEvent::Modifier> { }, wallTimeForEventTime(event->time));
+        delta, wheelTicks, WebWheelEvent::ScrollByPixelWheelEvent,
+        OptionSet<WebEvent::Modifier> { }, wallTimeForEventTime(event->time));
 }
 
 #if ENABLE(TOUCH_EVENTS)

Modified: releases/WebKitGTK/webkit-2.28/Source/WebKit/UIProcess/API/wpe/ScrollGestureController.cpp (257431 => 257432)


--- releases/WebKitGTK/webkit-2.28/Source/WebKit/UIProcess/API/wpe/ScrollGestureController.cpp	2020-02-26 10:56:03 UTC (rev 257431)
+++ releases/WebKitGTK/webkit-2.28/Source/WebKit/UIProcess/API/wpe/ScrollGestureController.cpp	2020-02-26 10:56:09 UTC (rev 257432)
@@ -52,11 +52,21 @@
                 || deltaTime >= 200;
         }
         if (m_handling) {
+#if WPE_CHECK_VERSION(1, 5, 0)
+            m_axisEvent.base = {
+                static_cast<enum wpe_input_axis_event_type>(wpe_input_axis_event_type_mask_2d | wpe_input_axis_event_type_motion_smooth),
+                touchPoint->time, m_start.x, m_start.y,
+                0, 0, 0,
+            };
+            m_axisEvent.x_axis = m_offset.x - touchPoint->x;
+            m_axisEvent.y_axis = -(m_offset.y - touchPoint->y);
+#else
             m_axisEvent = {
                 wpe_input_axis_event_type_motion,
                 touchPoint->time, m_start.x, m_start.y,
                 2, (touchPoint->y - m_offset.y), 0
             };
+#endif
             m_offset.x = touchPoint->x;
             m_offset.y = touchPoint->y;
             return true;
@@ -65,10 +75,18 @@
     case wpe_input_touch_event_type_up:
         if (m_handling) {
             m_handling = false;
+#if WPE_CHECK_VERSION(1, 5, 0)
+            m_axisEvent.base = {
+                wpe_input_axis_event_type_null,
+                0, 0, 0, 0, 0, 0
+            };
+            m_axisEvent.x_axis = m_axisEvent.y_axis = 0;
+#else
             m_axisEvent = {
                 wpe_input_axis_event_type_null,
                 0, 0, 0, 0, 0, 0
             };
+#endif
             return true;
         }
         return false;

Modified: releases/WebKitGTK/webkit-2.28/Source/WebKit/UIProcess/API/wpe/ScrollGestureController.h (257431 => 257432)


--- releases/WebKitGTK/webkit-2.28/Source/WebKit/UIProcess/API/wpe/ScrollGestureController.h	2020-02-26 10:56:03 UTC (rev 257431)
+++ releases/WebKitGTK/webkit-2.28/Source/WebKit/UIProcess/API/wpe/ScrollGestureController.h	2020-02-26 10:56:09 UTC (rev 257432)
@@ -34,7 +34,14 @@
 public:
     ScrollGestureController() = default;
 
-    struct wpe_input_axis_event* axisEvent() { return &m_axisEvent; }
+    struct wpe_input_axis_event* axisEvent()
+    {
+#if WPE_CHECK_VERSION(1, 5, 0)
+        return &m_axisEvent.base;
+#else
+        return &m_axisEvent;
+#endif
+    }
 
     bool isHandling() const { return m_handling; }
     bool handleEvent(const struct wpe_input_touch_event_raw*);
@@ -52,7 +59,11 @@
     } m_offset;
 
     bool m_handling { false };
+#if WPE_CHECK_VERSION(1, 5, 0)
+    struct wpe_input_axis_2d_event m_axisEvent;
+#else
     struct wpe_input_axis_event m_axisEvent;
+#endif
 };
 
 } // namespace WebKit

Modified: releases/WebKitGTK/webkit-2.28/Tools/ChangeLog (257431 => 257432)


--- releases/WebKitGTK/webkit-2.28/Tools/ChangeLog	2020-02-26 10:56:03 UTC (rev 257431)
+++ releases/WebKitGTK/webkit-2.28/Tools/ChangeLog	2020-02-26 10:56:09 UTC (rev 257432)
@@ -1,3 +1,12 @@
+2020-02-18  Zan Dobersek  <[email protected]>
+
+        [WPE] Support 2D axis, smooth-motion events
+        https://bugs.webkit.org/show_bug.cgi?id=207881
+
+        Reviewed by Carlos Garcia Campos.
+
+        * wpe/jhbuild.modules: Bump to a newer libwpe commit.
+
 2020-02-17  Alberto Garcia  <[email protected]>
 
         [WPE] Change the QML plugin install path

Modified: releases/WebKitGTK/webkit-2.28/Tools/wpe/jhbuild.modules (257431 => 257432)


--- releases/WebKitGTK/webkit-2.28/Tools/wpe/jhbuild.modules	2020-02-26 10:56:03 UTC (rev 257431)
+++ releases/WebKitGTK/webkit-2.28/Tools/wpe/jhbuild.modules	2020-02-26 10:56:09 UTC (rev 257432)
@@ -186,7 +186,7 @@
   </autotools>
 
   <cmake id="libwpe">
-    <branch repo="github.com" module="WebPlatformForEmbedded/libwpe.git" checkoutdir="libwpe" tag="d395e440883b4b4c764ccd7bae1cf1539d441661"/>
+    <branch repo="github.com" module="WebPlatformForEmbedded/libwpe.git" checkoutdir="libwpe" tag="b191f14936a64ae0685f50ce2bb22f7c50bf156d"/>
   </cmake>
 
   <cmake id="wpebackend-fdo">
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to