WebKit Bugzilla
Attachment 372455 Details for
Bug 198995
: [GTK] Enable navigation swipe layout tests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-198995-20190619174757.patch (text/plain), 17.47 KB, created by
Alice Mikhaylenko
on 2019-06-19 05:47:58 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Alice Mikhaylenko
Created:
2019-06-19 05:47:58 PDT
Size:
17.47 KB
patch
obsolete
>Subversion Revision: 246536 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 5f21dbdbff30847cc3f9d43c34489b134cc5b0ad..b1641df73dc872003b60a0783d302e9b56eee7b5 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,38 @@ >+2019-06-19 Alexander Mikhaylenko <exalm7659@gmail.com> >+ >+ [GTK] Enable navigation swipe layout tests >+ https://bugs.webkit.org/show_bug.cgi?id=198995 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Implement API for enabling and controlling swipes from WebKitTestRunner. >+ >+ Implement beginSimulatedSwipeInDirectionForTesting() and completeSimulatedSwipeInDirectionForTesting() >+ in ViewGestureController for controlling the test swipes. Add functions in WebKitWebViewBase for calling >+ them. >+ >+ Simulate the gesture by generating two scroll events: one to begin the gesture and one to complete it. >+ >+ Since there's no reliable way to set source device type of the generated events to touchpad, don't check >+ source device type for simulated swipes. >+ >+ * UIProcess/API/C/gtk/WKView.cpp: >+ (WKViewSetEnableBackForwardNavigationGesture): Added. >+ (WKViewBeginBackSwipeForTesting): Added. >+ (WKViewCompleteBackSwipeForTesting): Added. >+ * UIProcess/API/C/gtk/WKViewPrivate.h: >+ * UIProcess/API/gtk/WebKitWebViewBase.cpp: >+ (webkitWebViewBaseBeginBackSwipeForTesting): Added. >+ (webkitWebViewBaseCompleteBackSwipeForTesting): Added. >+ * UIProcess/API/gtk/WebKitWebViewBasePrivate.h: >+ * UIProcess/ViewGestureController.h: >+ * UIProcess/gtk/ViewGestureControllerGtk.cpp: >+ (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanInfluenceSwipe): >+ Skip source device type check for simulated swipes. Also, remove an incorrect FIXME. >+ (WebKit::createScrollEvent): Added. >+ (WebKit::ViewGestureController::beginSimulatedSwipeInDirectionForTesting): Implemented. >+ (WebKit::ViewGestureController::completeSimulatedSwipeInDirectionForTesting): Implemented. >+ > 2019-06-18 Dean Jackson <dino@apple.com> > > Attachment elements are missing context menu previews >diff --git a/Source/WebKit/UIProcess/API/C/gtk/WKView.cpp b/Source/WebKit/UIProcess/API/C/gtk/WKView.cpp >index 48c41ac77b1aae29b7c7c9e0732a74a12baf9ff2..501c164c009d2e7b4af235b2e78874375d57f535 100644 >--- a/Source/WebKit/UIProcess/API/C/gtk/WKView.cpp >+++ b/Source/WebKit/UIProcess/API/C/gtk/WKView.cpp >@@ -48,3 +48,18 @@ void WKViewSetFocus(WKViewRef viewRef, bool focused) > { > webkitWebViewBaseSetFocus(toImpl(viewRef), focused); > } >+ >+void WKViewSetEnableBackForwardNavigationGesture(WKViewRef viewRef, bool enabled) >+{ >+ webkitWebViewBaseSetEnableBackForwardNavigationGesture(toImpl(viewRef), enabled); >+} >+ >+bool WKViewBeginBackSwipeForTesting(WKViewRef viewRef) >+{ >+ return webkitWebViewBaseBeginBackSwipeForTesting(toImpl(viewRef)); >+} >+ >+bool WKViewCompleteBackSwipeForTesting(WKViewRef viewRef) >+{ >+ return webkitWebViewBaseCompleteBackSwipeForTesting(toImpl(viewRef)); >+} >diff --git a/Source/WebKit/UIProcess/API/C/gtk/WKViewPrivate.h b/Source/WebKit/UIProcess/API/C/gtk/WKViewPrivate.h >index acabfd3af19826d67b7e1199e76bff104b3c85b7..aafd6575328e409726e3e01b38bbb05ba220dba1 100644 >--- a/Source/WebKit/UIProcess/API/C/gtk/WKViewPrivate.h >+++ b/Source/WebKit/UIProcess/API/C/gtk/WKViewPrivate.h >@@ -34,6 +34,12 @@ extern "C" { > > WK_EXPORT void WKViewSetFocus(WKViewRef viewRef, bool focused); > >+WK_EXPORT void WKViewSetEnableBackForwardNavigationGesture(WKViewRef viewRef, bool enabled); >+ >+WK_EXPORT bool WKViewBeginBackSwipeForTesting(WKViewRef viewRef); >+ >+WK_EXPORT bool WKViewCompleteBackSwipeForTesting(WKViewRef viewRef); >+ > #ifdef __cplusplus > } > #endif >diff --git a/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp b/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp >index 25b937d297ad3a7b36369c02d6d3a822ca3e0ae9..2d7818159cc588a6765376fa10cb84ecae1ada6f 100644 >--- a/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp >+++ b/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp >@@ -1264,6 +1264,22 @@ ViewGestureController* webkitWebViewBaseViewGestureController(WebKitWebViewBase* > return webViewBase->priv->viewGestureController.get(); > } > >+bool webkitWebViewBaseBeginBackSwipeForTesting(WebKitWebViewBase* webViewBase) >+{ >+ if (auto* gestureController = webkitWebViewBaseViewGestureController(webViewBase)) >+ return gestureController->beginSimulatedSwipeInDirectionForTesting(ViewGestureController::SwipeDirection::Back); >+ >+ return FALSE; >+} >+ >+bool webkitWebViewBaseCompleteBackSwipeForTesting(WebKitWebViewBase* webViewBase) >+{ >+ if (auto* gestureController = webkitWebViewBaseViewGestureController(webViewBase)) >+ return gestureController->completeSimulatedSwipeInDirectionForTesting(ViewGestureController::SwipeDirection::Back); >+ >+ return FALSE; >+} >+ > static gboolean webkitWebViewBaseQueryTooltip(GtkWidget* widget, gint /* x */, gint /* y */, gboolean keyboardMode, GtkTooltip* tooltip) > { > WebKitWebViewBasePrivate* priv = WEBKIT_WEB_VIEW_BASE(widget)->priv; >diff --git a/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBasePrivate.h b/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBasePrivate.h >index c00e07df44273bc8353a965a8718455f5542b19b..c76a4841dd4124a00597eedbe9e101b27eae36e4 100644 >--- a/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBasePrivate.h >+++ b/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBasePrivate.h >@@ -87,6 +87,9 @@ RefPtr<WebKit::ViewSnapshot> webkitWebViewBaseTakeViewSnapshot(WebKitWebViewBase > void webkitWebViewBaseSetEnableBackForwardNavigationGesture(WebKitWebViewBase*, bool enabled); > WebKit::ViewGestureController* webkitWebViewBaseViewGestureController(WebKitWebViewBase*); > >+bool webkitWebViewBaseBeginBackSwipeForTesting(WebKitWebViewBase*); >+bool webkitWebViewBaseCompleteBackSwipeForTesting(WebKitWebViewBase*); >+ > void webkitWebViewBaseDidStartProvisionalLoadForMainFrame(WebKitWebViewBase*); > void webkitWebViewBaseDidFirstVisuallyNonEmptyLayoutForMainFrame(WebKitWebViewBase*); > void webkitWebViewBaseDidFinishLoadForMainFrame(WebKitWebViewBase*); >diff --git a/Source/WebKit/UIProcess/ViewGestureController.h b/Source/WebKit/UIProcess/ViewGestureController.h >index c1670d3a94cef3d906af4949cd5413604947630b..f3df32faab9c4bb9e6af8532c79b46cc0b3d0573 100644 >--- a/Source/WebKit/UIProcess/ViewGestureController.h >+++ b/Source/WebKit/UIProcess/ViewGestureController.h >@@ -409,6 +409,8 @@ private: > SwipeProgressTracker m_swipeProgressTracker; > > RefPtr<cairo_pattern_t> m_currentSwipeSnapshotPattern; >+ >+ bool m_isSimulatedSwipe { false }; > #endif > > bool m_isConnectedToProcess { false }; >diff --git a/Source/WebKit/UIProcess/gtk/ViewGestureControllerGtk.cpp b/Source/WebKit/UIProcess/gtk/ViewGestureControllerGtk.cpp >index 9d0ba2205c704fd42a39d7b4ce974e88cd9a56c9..640bccc6911a324b19838426cc9f048a93bb1e3a 100644 >--- a/Source/WebKit/UIProcess/gtk/ViewGestureControllerGtk.cpp >+++ b/Source/WebKit/UIProcess/gtk/ViewGestureControllerGtk.cpp >@@ -84,9 +84,9 @@ bool ViewGestureController::PendingSwipeTracker::scrollEventCanInfluenceSwipe(Gd > GdkDevice* device = gdk_event_get_source_device(reinterpret_cast<GdkEvent*>(event)); > GdkInputSource source = gdk_device_get_source(device); > >- // FIXME: Should it maybe be allowed on mice/trackpoints as well? The GDK_SCROLL_SMOOTH >- // requirement already filters out most mice, and it works pretty well on a trackpoint >- return gdk_event_get_scroll_deltas(reinterpret_cast<GdkEvent*>(event), nullptr, nullptr) && (source == GDK_SOURCE_TOUCHPAD || source == GDK_SOURCE_TOUCHSCREEN); >+ bool isDeviceAllowed = source == GDK_SOURCE_TOUCHPAD || source == GDK_SOURCE_TOUCHSCREEN || m_viewGestureController.m_isSimulatedSwipe; >+ >+ return gdk_event_get_scroll_deltas(reinterpret_cast<GdkEvent*>(event), nullptr, nullptr) && isDeviceAllowed; > } > > static bool isTouchEvent(GdkEventScroll* event) >@@ -397,14 +397,63 @@ void ViewGestureController::removeSwipeSnapshot() > m_swipeProgressTracker.reset(); > } > >-bool ViewGestureController::beginSimulatedSwipeInDirectionForTesting(SwipeDirection) >+static GdkEvent* createScrollEvent(GtkWidget* widget, double xDelta, double yDelta) > { >- return false; >+ GdkWindow* window = gtk_widget_get_window(widget); >+ >+ int x, y; >+ gdk_window_get_root_origin(window, &x, &y); >+ >+ int width = gdk_window_get_width(window); >+ int height = gdk_window_get_height(window); >+ >+ GdkEvent* event = gdk_event_new(GDK_SCROLL); >+ event->scroll.time = GDK_CURRENT_TIME; >+ event->scroll.x = width / 2; >+ event->scroll.y = height / 2; >+ event->scroll.x_root = x + width / 2; >+ event->scroll.y_root = y + height / 2; >+ event->scroll.direction = GDK_SCROLL_SMOOTH; >+ event->scroll.delta_x = xDelta; >+ event->scroll.delta_y = yDelta; >+ event->scroll.state = 0; >+#if GTK_CHECK_VERSION(3, 20, 0) >+ event->scroll.is_stop = !xDelta && !yDelta; >+#endif >+ event->scroll.window = window; >+ gdk_event_set_screen(event, gdk_window_get_screen(window)); >+ gdk_event_set_device(event, gdk_device_manager_get_client_pointer(gdk_display_get_device_manager(gdk_window_get_display(window)))); >+ gdk_event_set_source_device(event, gdk_device_manager_get_client_pointer(gdk_display_get_device_manager(gdk_window_get_display(window)))); >+ >+ return event; >+} >+ >+bool ViewGestureController::beginSimulatedSwipeInDirectionForTesting(SwipeDirection direction) >+{ >+ if (!canSwipeInDirection(direction)) >+ return false; >+ >+ m_isSimulatedSwipe = true; >+ >+ double delta = swipeTouchpadBaseWidth / gtkScrollDeltaMultiplier * 0.75; >+ >+ if (isPhysicallySwipingLeft(direction)) >+ delta = -delta; >+ >+ GdkEvent* event = createScrollEvent(m_webPageProxy.viewWidget(), delta, 0); >+ gtk_widget_event(m_webPageProxy.viewWidget(), event); >+ >+ return true; > } > > bool ViewGestureController::completeSimulatedSwipeInDirectionForTesting(SwipeDirection) > { >- return false; >+ GdkEvent* event = createScrollEvent(m_webPageProxy.viewWidget(), 0, 0); >+ gtk_widget_event(m_webPageProxy.viewWidget(), event); >+ >+ m_isSimulatedSwipe = false; >+ >+ return true; > } > > } // namespace WebKit >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 09cccc2467edeb892ac4b5b13a63f3638741f7f5..a4d9dabeeac6950c9d61fe84ee0ef3e60c9f7e9e 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,21 @@ >+2019-06-19 Alexander Mikhaylenko <exalm7659@gmail.com> >+ >+ [GTK] Enable navigation swipe layout tests >+ https://bugs.webkit.org/show_bug.cgi?id=198995 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add a way for tests to enable and then control swipe gesture on GTK. >+ >+ * TestRunnerShared/UIScriptContext/UIScriptController.cpp: Hide >+ empty implementations of beginBackSwipe() and completeBackSwipe() for GTK. >+ * WebKitTestRunner/PlatformGTK.cmake: >+ * WebKitTestRunner/gtk/PlatformWebViewGtk.cpp: >+ (WTR::PlatformWebView::setNavigationGesturesEnabled): Implemented. >+ * WebKitTestRunner/gtk/UIScriptControllerGtk.cpp: Added. >+ (WTR::UIScriptController::beginBackSwipe): >+ (WTR::UIScriptController::completeBackSwipe): >+ > 2019-06-18 Dan Bernstein <mitz@apple.com> > > Revert workaround for bug 198904 from run-webkit-archive >diff --git a/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp b/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp >index 39efca16b556bb16907abcb9af24517c1871bad6..1bedd7eb16f7459616199885a4fd210a3eeb76d5 100644 >--- a/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp >+++ b/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp >@@ -671,6 +671,7 @@ void UIScriptController::addViewToWindow(JSValueRef) > { > } > >+#if !PLATFORM(GTK) > void UIScriptController::beginBackSwipe(JSValueRef callback) > { > } >@@ -678,6 +679,7 @@ void UIScriptController::beginBackSwipe(JSValueRef callback) > void UIScriptController::completeBackSwipe(JSValueRef callback) > { > } >+#endif > > void UIScriptController::setShareSheetCompletesImmediatelyWithResolution(bool) > { >diff --git a/Tools/WebKitTestRunner/PlatformGTK.cmake b/Tools/WebKitTestRunner/PlatformGTK.cmake >index beda87bc229c80d3454895906752d2753dfd9407..0b7832f588959685c6bab770116ff6fda5eb080a 100644 >--- a/Tools/WebKitTestRunner/PlatformGTK.cmake >+++ b/Tools/WebKitTestRunner/PlatformGTK.cmake >@@ -10,6 +10,7 @@ list(APPEND WebKitTestRunner_SOURCES > ${WEBKIT_TESTRUNNER_DIR}/gtk/EventSenderProxyGtk.cpp > ${WEBKIT_TESTRUNNER_DIR}/gtk/PlatformWebViewGtk.cpp > ${WEBKIT_TESTRUNNER_DIR}/gtk/TestControllerGtk.cpp >+ ${WEBKIT_TESTRUNNER_DIR}/gtk/UIScriptControllerGtk.cpp > ${WEBKIT_TESTRUNNER_DIR}/gtk/main.cpp > ) > >diff --git a/Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp b/Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp >index b3668441a5c774cdf3f550bbe2e021409284b00d..d4a262918f239cdd5b1149350ade53340f2a5014 100644 >--- a/Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp >+++ b/Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp >@@ -185,8 +185,9 @@ void PlatformWebView::dismissAllPopupMenus() > }, nullptr); > } > >-void PlatformWebView::setNavigationGesturesEnabled(bool) >+void PlatformWebView::setNavigationGesturesEnabled(bool enabled) > { >+ WKViewSetEnableBackForwardNavigationGesture(platformView(), enabled); > } > > bool PlatformWebView::drawsBackground() const >diff --git a/Tools/WebKitTestRunner/gtk/UIScriptControllerGtk.cpp b/Tools/WebKitTestRunner/gtk/UIScriptControllerGtk.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..6321cceb07c6f123759eddc98e3dfa1d32e4f68d >--- /dev/null >+++ b/Tools/WebKitTestRunner/gtk/UIScriptControllerGtk.cpp >@@ -0,0 +1,49 @@ >+/* >+ * Copyright (C) 2019 Alexander Mikhaylenko <exalm7659@gmail.com> >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "UIScriptController.h" >+ >+#include "PlatformWebView.h" >+#include "TestController.h" >+#include <WebKit/WKViewPrivate.h> >+ >+namespace WTR { >+ >+void UIScriptController::beginBackSwipe(JSValueRef callback) >+{ >+ auto* webView = TestController::singleton().mainWebView()->platformView(); >+ >+ WKViewBeginBackSwipeForTesting(webView); >+} >+ >+void UIScriptController::completeBackSwipe(JSValueRef callback) >+{ >+ auto* webView = TestController::singleton().mainWebView()->platformView(); >+ >+ WKViewCompleteBackSwipeForTesting(webView); >+} >+ >+} // namespace WTR >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index d1e54ad899621f3835893af328d16393bf6d3905..6f51e3afcb502881312f20a899917425aead9e7a 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,21 @@ >+2019-06-19 Alexander Mikhaylenko <exalm7659@gmail.com> >+ >+ [GTK] Enable navigation swipe layout tests >+ https://bugs.webkit.org/show_bug.cgi?id=198995 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Enable the existing tests for the swipe gesture. >+ >+ swipe/pushState-programmatic-back-while-swiping-crash.html is not applicable because >+ it deals with NSEvents directly, skip it. >+ >+ swipe/main-frame-pinning-requirement.html is flaky, same as on Mac. >+ >+ swipe/pushstate-with-manual-scrollrestoration.html passes, don't mark it as failure. >+ >+ * platform/gtk/TestExpectations: >+ > 2019-06-18 Zan Dobersek <zdobersek@igalia.com> > > [WebGL] Extensions3DOpenGLES::bindVertexArrayOES() should allow zero array object >diff --git a/LayoutTests/platform/gtk/TestExpectations b/LayoutTests/platform/gtk/TestExpectations >index ee995068d9777e41e91529b7df15ca4dd66ea7d5..a43051f492603f9866b99c02ccaae0d7b56698be 100644 >--- a/LayoutTests/platform/gtk/TestExpectations >+++ b/LayoutTests/platform/gtk/TestExpectations >@@ -21,6 +21,7 @@ > > accessibility/gtk [ Pass ] > editing/pasteboard/gtk [ Pass ] >+swipe [ Pass ] > > #////////////////////////////////////////////////////////////////////////////////////////// > # End platform-specific directories. >@@ -1220,6 +1221,12 @@ fast/mediastream/screencapture-user-gesture.html [ Skip ] > # No different rendering for text-rendering: optimizeLegibility > fast/text/variations/optical-sizing-trak-2.html [ Skip ] > >+# The test directly sends Cocoa events >+swipe/pushState-programmatic-back-while-swiping-crash.html [ Skip ] >+ >+# Flaky, the order of lines in the output may change. >+webkit.org/b/170484 swipe/main-frame-pinning-requirement.html [ Pass Failure ] >+ > #//////////////////////////////////////////////////////////////////////////////////////// > # End of Expected failures. > #
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 198995
:
372455
|
372547
|
372559