WebKit Bugzilla
Attachment 373316 Details for
Bug 199401
: [GTK] Support cancelling touchscreen back/forward gesture
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-199401-20190702171936.patch (text/plain), 6.93 KB, created by
Alice Mikhaylenko
on 2019-07-02 05:19:38 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Alice Mikhaylenko
Created:
2019-07-02 05:19:38 PDT
Size:
6.93 KB
patch
obsolete
>Subversion Revision: 247011 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 6cdb05b067a299fd9b9cdd4c067f83eeba6903b4..a12421a2396de936d69e12cef06cba889f8b43fe 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,28 @@ >+2019-07-02 Alexander Mikhaylenko <exalm7659@gmail.com> >+ >+ [GTK] Support cancelling touchscreen back/forward gesture >+ https://bugs.webkit.org/show_bug.cgi?id=199401 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ It should be possible to cancel the gesture when performing it on >+ touchscreen, for example, by moving pen too far from the screen. >+ Handle this case properly. >+ >+ Only DragGesture in GestureController needs to handle this, >+ SwipeGesture simply won't emit the relevant event in this case. >+ >+ * UIProcess/API/gtk/WebKitWebViewBase.cpp: >+ * UIProcess/ViewGestureController.h: >+ * UIProcess/gtk/GestureController.cpp: >+ (WebKit::GestureController::DragGesture::cancelDrag): >+ (WebKit::GestureController::DragGesture::cancel): >+ (WebKit::GestureController::DragGesture::DragGesture): >+ * UIProcess/gtk/GestureController.h: >+ * UIProcess/gtk/ViewGestureControllerGtk.cpp: >+ (WebKit::ViewGestureController::platformTeardown): >+ (WebKit::ViewGestureController::cancelSwipe): >+ > 2019-07-01 Per Arne Vollan <pvollan@apple.com> > > Perform less work when a pre-warmed WebProcess is suspended or resumed. >diff --git a/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp b/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp >index 0992f363be5d58b4caef47e90d3c0e7d7dfc3d8f..4a33a564871ed29b5dc2e1c2e6deef0de43c1a9f 100644 >--- a/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp >+++ b/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp >@@ -1177,6 +1177,12 @@ private: > webkitWebViewBaseHandleWheelEvent(m_webView, scrollEvent.get(), WebWheelEvent::Phase::PhaseChanged); > } > >+ void cancelDrag() final >+ { >+ if (auto* controller = webkitWebViewBaseViewGestureController(m_webView)) >+ controller->cancelSwipe(); >+ } >+ > void swipe(GdkEventTouch* event, const FloatPoint& velocity) final > { > double x, y; >diff --git a/Source/WebKit/UIProcess/ViewGestureController.h b/Source/WebKit/UIProcess/ViewGestureController.h >index f3df32faab9c4bb9e6af8532c79b46cc0b3d0573..7b020ef5f0631f08a87115005cb8afcb88cad2a4 100644 >--- a/Source/WebKit/UIProcess/ViewGestureController.h >+++ b/Source/WebKit/UIProcess/ViewGestureController.h >@@ -165,6 +165,7 @@ public: > bool isSwipeGestureEnabled() { return m_swipeGestureEnabled; } > > #if PLATFORM(GTK) >+ void cancelSwipe(); > void draw(cairo_t*, cairo_pattern_t*); > #endif > >diff --git a/Source/WebKit/UIProcess/gtk/GestureController.cpp b/Source/WebKit/UIProcess/gtk/GestureController.cpp >index 9e8be1f3747491f47b536713d80aa12b68ff7f2c..76498b801584486d6c7a5bb6e2927258b85f7882 100644 >--- a/Source/WebKit/UIProcess/gtk/GestureController.cpp >+++ b/Source/WebKit/UIProcess/gtk/GestureController.cpp >@@ -95,6 +95,12 @@ void GestureController::DragGesture::handleDrag(GdkEvent* event, double x, doubl > FloatPoint::narrowPrecision((m_offset.x() - x) / Scrollbar::pixelsPerLineStep(), (m_offset.y() - y) / Scrollbar::pixelsPerLineStep())); > } > >+void GestureController::DragGesture::cancelDrag() >+{ >+ ASSERT(m_inDrag); >+ m_client.cancelDrag(); >+} >+ > void GestureController::DragGesture::handleTap(GdkEvent* event) > { > ASSERT(!m_inDrag); >@@ -145,6 +151,12 @@ void GestureController::DragGesture::end(DragGesture* dragGesture, GdkEventSeque > } > } > >+void GestureController::DragGesture::cancel(DragGesture* dragGesture, GdkEventSequence* sequence, GtkGesture* gesture) >+{ >+ dragGesture->m_longPressTimeout.stop(); >+ dragGesture->cancelDrag(); >+} >+ > void GestureController::DragGesture::longPressFired() > { > m_inDrag = true; >@@ -158,6 +170,7 @@ GestureController::DragGesture::DragGesture(GtkWidget* widget, GestureController > g_signal_connect_swapped(m_gesture.get(), "drag-begin", G_CALLBACK(begin), this); > g_signal_connect_swapped(m_gesture.get(), "drag-update", G_CALLBACK(update), this); > g_signal_connect_swapped(m_gesture.get(), "end", G_CALLBACK(end), this); >+ g_signal_connect_swapped(m_gesture.get(), "cancel", G_CALLBACK(cancel), this); > } > > void GestureController::SwipeGesture::startMomentumScroll(GdkEvent* event, double velocityX, double velocityY) >diff --git a/Source/WebKit/UIProcess/gtk/GestureController.h b/Source/WebKit/UIProcess/gtk/GestureController.h >index c7105bf5342816ce0837e073eb85c33280a262d8..2addbcd59c01327fcef34eafd8a8629ca3af0b61 100644 >--- a/Source/WebKit/UIProcess/gtk/GestureController.h >+++ b/Source/WebKit/UIProcess/gtk/GestureController.h >@@ -45,6 +45,7 @@ public: > > virtual void startDrag(GdkEventTouch*, const WebCore::FloatPoint&) = 0; > virtual void drag(GdkEventTouch*, const WebCore::FloatPoint&, const WebCore::FloatPoint&) = 0; >+ virtual void cancelDrag() = 0; > > virtual void swipe(GdkEventTouch*, const WebCore::FloatPoint&) = 0; > >@@ -94,12 +95,14 @@ private: > // Notify that a drag started, allowing to stop kinetic deceleration. > void startDrag(GdkEvent*); > void handleDrag(GdkEvent*, double x, double y); >+ void cancelDrag(); > void handleTap(GdkEvent*); > void longPressFired(); > > static void begin(DragGesture*, double x, double y, GtkGesture*); > static void update(DragGesture*, double x, double y, GtkGesture*); > static void end(DragGesture*, GdkEventSequence*, GtkGesture*); >+ static void cancel(DragGesture*, GdkEventSequence*, GtkGesture*); > > WebCore::FloatPoint m_start; > WebCore::FloatPoint m_offset; >diff --git a/Source/WebKit/UIProcess/gtk/ViewGestureControllerGtk.cpp b/Source/WebKit/UIProcess/gtk/ViewGestureControllerGtk.cpp >index 52825ec48e66c63e8ecec40db1d4ccd0bae7ab33..cee8306f77980910d6f1cc03fde74b199d616999 100644 >--- a/Source/WebKit/UIProcess/gtk/ViewGestureControllerGtk.cpp >+++ b/Source/WebKit/UIProcess/gtk/ViewGestureControllerGtk.cpp >@@ -59,10 +59,7 @@ static bool isEventStop(GdkEventScroll* event) > > void ViewGestureController::platformTeardown() > { >- m_swipeProgressTracker.reset(); >- >- if (m_activeGestureType == ViewGestureType::Swipe) >- removeSwipeSnapshot(); >+ cancelSwipe(); > } > > bool ViewGestureController::PendingSwipeTracker::scrollEventCanStartSwipe(GdkEventScroll*) >@@ -328,6 +325,16 @@ void ViewGestureController::handleSwipeGesture(WebBackForwardListItem*, double, > gtk_widget_queue_draw(m_webPageProxy.viewWidget()); > } > >+void ViewGestureController::cancelSwipe() >+{ >+ m_pendingSwipeTracker.reset("cancelling swipe"); >+ >+ if (m_activeGestureType == ViewGestureType::Swipe) { >+ m_swipeProgressTracker.reset(); >+ removeSwipeSnapshot(); >+ } >+} >+ > void ViewGestureController::draw(cairo_t* cr, cairo_pattern_t* pageGroup) > { > bool swipingLeft = isPhysicallySwipingLeft(m_swipeProgressTracker.direction());
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 199401
: 373316