Title: [279334] releases/WebKitGTK/webkit-2.32/Source/WebKit
Revision
279334
Author
[email protected]
Date
2021-06-28 05:20:26 -0700 (Mon, 28 Jun 2021)

Log Message

Merge r278198 - [WPE] Correctly compute wheel event phase for 2D axis events
https://bugs.webkit.org/show_bug.cgi?id=226370

Patch by Zan Dobersek <[email protected]> on 2021-05-28
Reviewed by Adrian Perez de Castro.

2D-capable wpe_input_axis_event objects don't have usable axis and delta
values set on the base struct, but keep all that information on the more
detailed wpe_input_axis_2d_event struct.

For such events, the correct phase then has to be special-cased,
otherwise the default determination marks both axes as inactive and only
PhaseEnded events are dispatched into the engine.

* UIProcess/API/wpe/WPEView.cpp:
(WKWPE::m_backend):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.32/Source/WebKit/ChangeLog (279333 => 279334)


--- releases/WebKitGTK/webkit-2.32/Source/WebKit/ChangeLog	2021-06-28 12:20:21 UTC (rev 279333)
+++ releases/WebKitGTK/webkit-2.32/Source/WebKit/ChangeLog	2021-06-28 12:20:26 UTC (rev 279334)
@@ -1,3 +1,21 @@
+2021-05-28  Zan Dobersek  <[email protected]>
+
+        [WPE] Correctly compute wheel event phase for 2D axis events
+        https://bugs.webkit.org/show_bug.cgi?id=226370
+
+        Reviewed by Adrian Perez de Castro.
+
+        2D-capable wpe_input_axis_event objects don't have usable axis and delta
+        values set on the base struct, but keep all that information on the more
+        detailed wpe_input_axis_2d_event struct.
+
+        For such events, the correct phase then has to be special-cased,
+        otherwise the default determination marks both axes as inactive and only
+        PhaseEnded events are dispatched into the engine.
+
+        * UIProcess/API/wpe/WPEView.cpp:
+        (WKWPE::m_backend):
+
 2021-05-27  Alexander Mikhaylenko  <[email protected]>
 
         Transient quarter display with a HiDPI /4k screen and a 200% scaling

Modified: releases/WebKitGTK/webkit-2.32/Source/WebKit/UIProcess/API/wpe/WPEView.cpp (279333 => 279334)


--- releases/WebKitGTK/webkit-2.32/Source/WebKit/UIProcess/API/wpe/WPEView.cpp	2021-06-28 12:20:21 UTC (rev 279333)
+++ releases/WebKitGTK/webkit-2.32/Source/WebKit/UIProcess/API/wpe/WPEView.cpp	2021-06-28 12:20:26 UTC (rev 279334)
@@ -167,6 +167,27 @@
                 Horizontal
             };
 
+            // We treat an axis motion event with a value of zero to be equivalent
+            // to a 'stop' event. Motion events with zero motion don't exist naturally,
+            // so this allows a backend to express 'stop' events without changing API.
+            // The wheel event phase is adjusted accordingly.
+            WebWheelEvent::Phase phase = WebWheelEvent::Phase::PhaseChanged;
+            WebWheelEvent::Phase momentumPhase = WebWheelEvent::Phase::PhaseNone;
+
+#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);
+                view.m_horizontalScrollActive = !!event2D->x_axis;
+                view.m_verticalScrollActive = !!event2D->y_axis;
+                if (!view.m_horizontalScrollActive && !view.m_verticalScrollActive)
+                    phase = WebWheelEvent::Phase::PhaseEnded;
+
+                auto& page = view.page();
+                page.handleWheelEvent(WebKit::NativeWebWheelEvent(event, page.deviceScaleFactor(), phase, momentumPhase));
+                return;
+            }
+#endif
+
             switch (event->axis) {
             case Vertical:
                 view.m_horizontalScrollActive = !!event->value;
@@ -176,14 +197,16 @@
                 break;
             }
 
-            // We treat an axis motion event with a value of zero to be equivalent
-            // to a 'stop' event. Motion events with zero motion don't exist naturally,
-            // so this allows a backend to express 'stop' events without changing API.
-            auto& page = view.page();
-            if (event->value)
-                page.handleWheelEvent(WebKit::NativeWebWheelEvent(event, page.deviceScaleFactor(), WebWheelEvent::Phase::PhaseChanged, WebWheelEvent::Phase::PhaseNone));
-            else if (!view.m_horizontalScrollActive && !view.m_verticalScrollActive)
-                page.handleWheelEvent(WebKit::NativeWebWheelEvent(event, page.deviceScaleFactor(), WebWheelEvent::Phase::PhaseEnded, WebWheelEvent::Phase::PhaseNone));
+            bool shouldDispatch = !!event->value;
+            if (!view.m_horizontalScrollActive && !view.m_verticalScrollActive) {
+                shouldDispatch = true;
+                phase = WebWheelEvent::Phase::PhaseEnded;
+            }
+
+            if (shouldDispatch) {
+                auto& page = view.page();
+                page.handleWheelEvent(WebKit::NativeWebWheelEvent(event, page.deviceScaleFactor(), phase, momentumPhase));
+            }
         },
         // handle_touch_event
         [](void* data, struct wpe_input_touch_event* event)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to