Diff
Modified: trunk/LayoutTests/ChangeLog (246638 => 246639)
--- trunk/LayoutTests/ChangeLog 2019-06-20 17:04:43 UTC (rev 246638)
+++ trunk/LayoutTests/ChangeLog 2019-06-20 17:05:19 UTC (rev 246639)
@@ -1,5 +1,23 @@
2019-06-20 Alexander Mikhaylenko <[email protected]>
+ [GTK] Enable navigation swipe layout tests
+ https://bugs.webkit.org/show_bug.cgi?id=198995
+
+ Reviewed by Michael Catanzaro.
+
+ 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-20 Alexander Mikhaylenko <[email protected]>
+
[GTK] HTTP layout tests don't run in flatpak
https://bugs.webkit.org/show_bug.cgi?id=199067
Modified: trunk/LayoutTests/platform/gtk/TestExpectations (246638 => 246639)
--- trunk/LayoutTests/platform/gtk/TestExpectations 2019-06-20 17:04:43 UTC (rev 246638)
+++ trunk/LayoutTests/platform/gtk/TestExpectations 2019-06-20 17:05:19 UTC (rev 246639)
@@ -21,6 +21,7 @@
accessibility/gtk [ Pass ]
editing/pasteboard/gtk [ Pass ]
+swipe [ Pass ]
#//////////////////////////////////////////////////////////////////////////////////////////
# End platform-specific directories.
@@ -1220,6 +1221,9 @@
# 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 ]
+
#////////////////////////////////////////////////////////////////////////////////////////
# End of Expected failures.
#
@@ -2254,6 +2258,8 @@
webkit.org/b/198830 media/video-timeupdate-reverse-play.html [ Crash Pass ]
webkit.org/b/198830 media/video-trackmenu-selection.html [ Crash Timeout ]
+webkit.org/b/170484 swipe/main-frame-pinning-requirement.html [ Pass Failure ]
+
#////////////////////////////////////////////////////////////////////////////////////////
# End of Flaky tests
#////////////////////////////////////////////////////////////////////////////////////////
Modified: trunk/Source/WebKit/ChangeLog (246638 => 246639)
--- trunk/Source/WebKit/ChangeLog 2019-06-20 17:04:43 UTC (rev 246638)
+++ trunk/Source/WebKit/ChangeLog 2019-06-20 17:05:19 UTC (rev 246639)
@@ -1,3 +1,38 @@
+2019-06-20 Alexander Mikhaylenko <[email protected]>
+
+ [GTK] Enable navigation swipe layout tests
+ https://bugs.webkit.org/show_bug.cgi?id=198995
+
+ Reviewed by Michael Catanzaro.
+
+ 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-20 Charlie Turner <[email protected]>
[GTK] Make startup pause available in DEVELOPER_MODE rather than DEBUG.
Modified: trunk/Source/WebKit/UIProcess/API/C/gtk/WKView.cpp (246638 => 246639)
--- trunk/Source/WebKit/UIProcess/API/C/gtk/WKView.cpp 2019-06-20 17:04:43 UTC (rev 246638)
+++ trunk/Source/WebKit/UIProcess/API/C/gtk/WKView.cpp 2019-06-20 17:05:19 UTC (rev 246639)
@@ -48,3 +48,18 @@
{
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));
+}
Modified: trunk/Source/WebKit/UIProcess/API/C/gtk/WKViewPrivate.h (246638 => 246639)
--- trunk/Source/WebKit/UIProcess/API/C/gtk/WKViewPrivate.h 2019-06-20 17:04:43 UTC (rev 246638)
+++ trunk/Source/WebKit/UIProcess/API/C/gtk/WKViewPrivate.h 2019-06-20 17:05:19 UTC (rev 246639)
@@ -34,6 +34,12 @@
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
Modified: trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp (246638 => 246639)
--- trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp 2019-06-20 17:04:43 UTC (rev 246638)
+++ trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp 2019-06-20 17:05:19 UTC (rev 246639)
@@ -1263,6 +1263,22 @@
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;
Modified: trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBasePrivate.h (246638 => 246639)
--- trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBasePrivate.h 2019-06-20 17:04:43 UTC (rev 246638)
+++ trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBasePrivate.h 2019-06-20 17:05:19 UTC (rev 246639)
@@ -89,6 +89,9 @@
void webkitWebViewBaseSetEnableBackForwardNavigationGesture(WebKitWebViewBase*, bool enabled);
WebKit::ViewGestureController* webkitWebViewBaseViewGestureController(WebKitWebViewBase*);
+bool webkitWebViewBaseBeginBackSwipeForTesting(WebKitWebViewBase*);
+bool webkitWebViewBaseCompleteBackSwipeForTesting(WebKitWebViewBase*);
+
void webkitWebViewBaseDidStartProvisionalLoadForMainFrame(WebKitWebViewBase*);
void webkitWebViewBaseDidFirstVisuallyNonEmptyLayoutForMainFrame(WebKitWebViewBase*);
void webkitWebViewBaseDidFinishLoadForMainFrame(WebKitWebViewBase*);
Modified: trunk/Source/WebKit/UIProcess/ViewGestureController.h (246638 => 246639)
--- trunk/Source/WebKit/UIProcess/ViewGestureController.h 2019-06-20 17:04:43 UTC (rev 246638)
+++ trunk/Source/WebKit/UIProcess/ViewGestureController.h 2019-06-20 17:05:19 UTC (rev 246639)
@@ -409,6 +409,8 @@
SwipeProgressTracker m_swipeProgressTracker;
RefPtr<cairo_pattern_t> m_currentSwipeSnapshotPattern;
+
+ bool m_isSimulatedSwipe { false };
#endif
bool m_isConnectedToProcess { false };
Modified: trunk/Source/WebKit/UIProcess/gtk/ViewGestureControllerGtk.cpp (246638 => 246639)
--- trunk/Source/WebKit/UIProcess/gtk/ViewGestureControllerGtk.cpp 2019-06-20 17:04:43 UTC (rev 246638)
+++ trunk/Source/WebKit/UIProcess/gtk/ViewGestureControllerGtk.cpp 2019-06-20 17:05:19 UTC (rev 246639)
@@ -84,9 +84,9 @@
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)
@@ -412,14 +412,63 @@
m_swipeProgressTracker.reset();
}
-bool ViewGestureController::beginSimulatedSwipeInDirectionForTesting(SwipeDirection)
+static GUniquePtr<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);
+
+ GUniquePtr<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 = GDK_WINDOW(g_object_ref(window));
+ gdk_event_set_screen(event.get(), gdk_window_get_screen(window));
+ gdk_event_set_device(event.get(), gdk_device_manager_get_client_pointer(gdk_display_get_device_manager(gdk_window_get_display(window))));
+ gdk_event_set_source_device(event.get(), 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;
+
+ GUniquePtr<GdkEvent> event = createScrollEvent(m_webPageProxy.viewWidget(), delta, 0);
+ gtk_widget_event(m_webPageProxy.viewWidget(), event.get());
+
+ return true;
+}
+
bool ViewGestureController::completeSimulatedSwipeInDirectionForTesting(SwipeDirection)
{
- return false;
+ GUniquePtr<GdkEvent> event = createScrollEvent(m_webPageProxy.viewWidget(), 0, 0);
+ gtk_widget_event(m_webPageProxy.viewWidget(), event.get());
+
+ m_isSimulatedSwipe = false;
+
+ return true;
}
} // namespace WebKit
Modified: trunk/Tools/ChangeLog (246638 => 246639)
--- trunk/Tools/ChangeLog 2019-06-20 17:04:43 UTC (rev 246638)
+++ trunk/Tools/ChangeLog 2019-06-20 17:05:19 UTC (rev 246639)
@@ -1,5 +1,23 @@
2019-06-20 Alexander Mikhaylenko <[email protected]>
+ [GTK] Enable navigation swipe layout tests
+ https://bugs.webkit.org/show_bug.cgi?id=198995
+
+ Reviewed by Michael Catanzaro.
+
+ 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-20 Alexander Mikhaylenko <[email protected]>
+
[GTK] HTTP layout tests don't run in flatpak
https://bugs.webkit.org/show_bug.cgi?id=199067
Modified: trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp (246638 => 246639)
--- trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp 2019-06-20 17:04:43 UTC (rev 246638)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp 2019-06-20 17:05:19 UTC (rev 246639)
@@ -671,6 +671,7 @@
{
}
+#if !PLATFORM(GTK)
void UIScriptController::beginBackSwipe(JSValueRef callback)
{
}
@@ -678,6 +679,7 @@
void UIScriptController::completeBackSwipe(JSValueRef callback)
{
}
+#endif
void UIScriptController::setShareSheetCompletesImmediatelyWithResolution(bool)
{
Modified: trunk/Tools/WebKitTestRunner/PlatformGTK.cmake (246638 => 246639)
--- trunk/Tools/WebKitTestRunner/PlatformGTK.cmake 2019-06-20 17:04:43 UTC (rev 246638)
+++ trunk/Tools/WebKitTestRunner/PlatformGTK.cmake 2019-06-20 17:05:19 UTC (rev 246639)
@@ -10,6 +10,7 @@
${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
)
Modified: trunk/Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp (246638 => 246639)
--- trunk/Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp 2019-06-20 17:04:43 UTC (rev 246638)
+++ trunk/Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp 2019-06-20 17:05:19 UTC (rev 246639)
@@ -185,8 +185,9 @@
}, nullptr);
}
-void PlatformWebView::setNavigationGesturesEnabled(bool)
+void PlatformWebView::setNavigationGesturesEnabled(bool enabled)
{
+ WKViewSetEnableBackForwardNavigationGesture(platformView(), enabled);
}
bool PlatformWebView::drawsBackground() const
Copied: trunk/Tools/WebKitTestRunner/gtk/UIScriptControllerGtk.cpp (from rev 246638, trunk/Source/WebKit/UIProcess/API/C/gtk/WKViewPrivate.h) (0 => 246639)
--- trunk/Tools/WebKitTestRunner/gtk/UIScriptControllerGtk.cpp (rev 0)
+++ trunk/Tools/WebKitTestRunner/gtk/UIScriptControllerGtk.cpp 2019-06-20 17:05:19 UTC (rev 246639)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2019 Alexander Mikhaylenko <[email protected]>
+ *
+ * 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