Title: [253467] trunk
Revision
253467
Author
[email protected]
Date
2019-12-13 02:54:33 -0800 (Fri, 13 Dec 2019)

Log Message

[GTK] Several tests crashing after r247898 "Reorganize UIScriptController into platform-specific subclasses"
https://bugs.webkit.org/show_bug.cgi?id=200534

Reviewed by Alejandro G. Castro.

Tools:

Add implementation of several UIScriptController virtual methods to avoid crashes.

* WebKitTestRunner/gtk/PlatformWebViewGtk.cpp:
(WTR::PlatformWebView::~PlatformWebView):
(WTR::PlatformWebView::addToWindow):
(WTR::PlatformWebView::removeFromWindow):
* WebKitTestRunner/gtk/UIScriptControllerGtk.cpp:
(WTR::UIScriptControllerGtk::doAsyncTask):
(WTR::UIScriptControllerGtk::setContinuousSpellCheckingEnabled):
(WTR::UIScriptControllerGtk::copyText):
(WTR::UIScriptControllerGtk::dismissMenu):
(WTR::UIScriptControllerGtk::isShowingMenu const):
(WTR::UIScriptControllerGtk::activateAtPoint):
(WTR::UIScriptControllerGtk::activateDataListSuggestion):
(WTR::UIScriptControllerGtk::simulateAccessibilitySettingsChangeNotification):
(WTR::UIScriptControllerGtk::removeViewFromWindow):
(WTR::UIScriptControllerGtk::addViewToWindow):
* WebKitTestRunner/gtk/UIScriptControllerGtk.h:

LayoutTests:

Update expectations.

* platform/gtk/TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (253466 => 253467)


--- trunk/LayoutTests/ChangeLog	2019-12-13 08:40:48 UTC (rev 253466)
+++ trunk/LayoutTests/ChangeLog	2019-12-13 10:54:33 UTC (rev 253467)
@@ -1,3 +1,14 @@
+2019-12-13  Carlos Garcia Campos  <[email protected]>
+
+        [GTK] Several tests crashing after r247898 "Reorganize UIScriptController into platform-specific subclasses"
+        https://bugs.webkit.org/show_bug.cgi?id=200534
+
+        Reviewed by Alejandro G. Castro.
+
+        Update expectations.
+
+        * platform/gtk/TestExpectations:
+
 2019-12-12  Chris Dumez  <[email protected]>
 
         Re-sync service-workers web-platform-tests from upstream

Modified: trunk/LayoutTests/platform/gtk/TestExpectations (253466 => 253467)


--- trunk/LayoutTests/platform/gtk/TestExpectations	2019-12-13 08:40:48 UTC (rev 253466)
+++ trunk/LayoutTests/platform/gtk/TestExpectations	2019-12-13 10:54:33 UTC (rev 253467)
@@ -1079,6 +1079,11 @@
 webkit.org/b/177633 editing/pasteboard/copy-paste-across-shadow-boundaries-with-style-2.html [ Crash ]
 webkit.org/b/177633 editing/pasteboard/paste-text-with-style.html [ Failure Pass ]
 webkit.org/b/177633 editing/pasteboard/paste-without-nesting.html [ Failure Pass ]
+webkit.org/b/177633 editing/async-clipboard/clipboard-change-data-while-writing.html [ Failure ]
+webkit.org/b/177633 editing/async-clipboard/clipboard-read-text-from-platform.html [ Failure ]
+webkit.org/b/177633 editing/async-clipboard/clipboard-change-data-while-getting-type.html [ Timeout ]
+webkit.org/b/177633 editing/async-clipboard/clipboard-change-data-while-reading.html [ Timeout ]
+webkit.org/b/177633 editing/async-clipboard/clipboard-get-type-with-old-items.html [ Timeout ]
 webkit.org/b/177633 editing/async-clipboard/clipboard-read-basic.html [ Timeout ]
 webkit.org/b/177633 editing/async-clipboard/clipboard-read-text-same-origin.html [ Timeout ]
 webkit.org/b/177633 editing/async-clipboard/clipboard-write-basic.html [ Timeout ]
@@ -1270,26 +1275,6 @@
 
 webkit.org/b/199440 fast/mediastream/mediastreamtrack-video-clone.html [ Failure Timeout Crash ]
 
-# UIScriptController missing implementations
-webkit.org/b/200534 editing/input/delete-text-in-composition.html [ Crash ]
-webkit.org/b/200534 editing/secure-input/password-input-changed-type.html [ Crash ]
-webkit.org/b/200534 editing/secure-input/password-input-focusing.html [ Crash ]
-webkit.org/b/200534 editing/secure-input/removed-password-input.html [ Crash ]
-webkit.org/b/200534 editing/secure-input/reset-state-on-navigation.html [ Crash ]
-webkit.org/b/200534 fast/media/mq-prefers-reduced-motion-matchMedia.html [ Crash ]
-webkit.org/b/200534 editing/pasteboard/paste-and-sanitize.html [ Crash ]
-webkit.org/b/200534 fast/forms/contenteditable-font-optical-size.html [ Crash ]
-webkit.org/b/200534 legacy-animation-engine/compositing/transitions/add-remove-transition.html [ Crash ]
-webkit.org/b/200534 editing/async-clipboard/clipboard-change-data-while-getting-type.html [ Crash ]
-webkit.org/b/200534 editing/async-clipboard/clipboard-change-data-while-reading.html [ Crash ]
-webkit.org/b/200534 editing/async-clipboard/clipboard-get-type-with-old-items.html [ Crash ]
-webkit.org/b/200534 editing/async-clipboard/clipboard-read-text-from-platform.html [ Crash ]
-webkit.org/b/200534 editing/async-clipboard/clipboard-do-not-read-text-from-platform-if-text-changes.html [ Crash ]
-webkit.org/b/200534 editing/async-clipboard/clipboard-change-data-while-writing.html [ Crash ]
-webkit.org/b/200534 editing/spelling/toggle-spellchecking.html [ Crash ]
-webkit.org/b/200534 fast/forms/datalist/datalist-click-crash.html [ Crash ]
-webkit.org/b/200534 fast/media/mq-inverted-colors.html [ Crash ]
-
 webkit.org/b/201275 fast/events/focus-anchor-with-tabindex-hang.html [ Crash ]
 
 # Known issues that were fixed by the WebKitMediaSrc rework that is now reverted.

Modified: trunk/Tools/ChangeLog (253466 => 253467)


--- trunk/Tools/ChangeLog	2019-12-13 08:40:48 UTC (rev 253466)
+++ trunk/Tools/ChangeLog	2019-12-13 10:54:33 UTC (rev 253467)
@@ -1,3 +1,29 @@
+2019-12-13  Carlos Garcia Campos  <[email protected]>
+
+        [GTK] Several tests crashing after r247898 "Reorganize UIScriptController into platform-specific subclasses"
+        https://bugs.webkit.org/show_bug.cgi?id=200534
+
+        Reviewed by Alejandro G. Castro.
+
+        Add implementation of several UIScriptController virtual methods to avoid crashes.
+
+        * WebKitTestRunner/gtk/PlatformWebViewGtk.cpp:
+        (WTR::PlatformWebView::~PlatformWebView):
+        (WTR::PlatformWebView::addToWindow):
+        (WTR::PlatformWebView::removeFromWindow):
+        * WebKitTestRunner/gtk/UIScriptControllerGtk.cpp:
+        (WTR::UIScriptControllerGtk::doAsyncTask):
+        (WTR::UIScriptControllerGtk::setContinuousSpellCheckingEnabled):
+        (WTR::UIScriptControllerGtk::copyText):
+        (WTR::UIScriptControllerGtk::dismissMenu):
+        (WTR::UIScriptControllerGtk::isShowingMenu const):
+        (WTR::UIScriptControllerGtk::activateAtPoint):
+        (WTR::UIScriptControllerGtk::activateDataListSuggestion):
+        (WTR::UIScriptControllerGtk::simulateAccessibilitySettingsChangeNotification):
+        (WTR::UIScriptControllerGtk::removeViewFromWindow):
+        (WTR::UIScriptControllerGtk::addViewToWindow):
+        * WebKitTestRunner/gtk/UIScriptControllerGtk.h:
+
 2019-12-12  Simon Fraser  <[email protected]>
 
         Move WKWebView code related to testing to new files, with new private "for testing" headers.

Modified: trunk/Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp (253466 => 253467)


--- trunk/Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp	2019-12-13 08:40:48 UTC (rev 253466)
+++ trunk/Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp	2019-12-13 10:54:33 UTC (rev 253467)
@@ -56,6 +56,9 @@
 
 PlatformWebView::~PlatformWebView()
 {
+    if (gtk_bin_get_child(GTK_BIN(m_window)) != GTK_WIDGET(m_view))
+        g_object_unref(GTK_WIDGET(m_view));
+
     gtk_widget_destroy(m_window);
     if (m_otherWindow)
         gtk_widget_destroy(m_otherWindow);
@@ -139,10 +142,19 @@
 
 void PlatformWebView::addToWindow()
 {
+    if (gtk_bin_get_child(GTK_BIN(m_window)) == GTK_WIDGET(m_view))
+        return;
+
+    gtk_container_add(GTK_CONTAINER(m_window), GTK_WIDGET(m_view));
+    g_object_unref(GTK_WIDGET(m_view));
 }
 
 void PlatformWebView::removeFromWindow()
 {
+    if (gtk_bin_get_child(GTK_BIN(m_window)) == GTK_WIDGET(m_view)) {
+        g_object_ref(GTK_WIDGET(m_view));
+        gtk_container_remove(GTK_CONTAINER(m_window), GTK_WIDGET(m_view));
+    }
 }
 
 void PlatformWebView::makeWebViewFirstResponder()

Modified: trunk/Tools/WebKitTestRunner/gtk/UIScriptControllerGtk.cpp (253466 => 253467)


--- trunk/Tools/WebKitTestRunner/gtk/UIScriptControllerGtk.cpp	2019-12-13 08:40:48 UTC (rev 253466)
+++ trunk/Tools/WebKitTestRunner/gtk/UIScriptControllerGtk.cpp	2019-12-13 10:54:33 UTC (rev 253467)
@@ -26,10 +26,15 @@
 #include "config.h"
 #include "UIScriptControllerGtk.h"
 
+#include "EventSenderProxy.h"
 #include "PlatformWebView.h"
 #include "TestController.h"
+#include "TextChecker.h"
+#include "UIScriptContext.h"
+#include <_javascript_Core/OpaqueJSString.h>
 #include <WebKit/WKViewPrivate.h>
 #include <gtk/gtk.h>
+#include <wtf/RunLoop.h>
 
 namespace WTR {
 
@@ -60,4 +65,97 @@
     return false;
 }
 
+void UIScriptControllerGtk::doAsyncTask(JSValueRef callback)
+{
+    unsigned callbackID = m_context->prepareForAsyncTask(callback, CallbackTypeNonPersistent);
+    RunLoop::main().dispatch([this, protectedThis = makeRef(*this), callbackID] {
+        if (!m_context)
+            return;
+        m_context->asyncTaskComplete(callbackID);
+    });
+}
+
+void UIScriptControllerGtk::setContinuousSpellCheckingEnabled(bool enabled)
+{
+    WebKit::TextChecker::setContinuousSpellCheckingEnabled(enabled);
+}
+
+void UIScriptControllerGtk::copyText(JSStringRef text)
+{
+    auto string = text->string().utf8();
+    gtk_clipboard_set_text(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD), string.data(), string.length());
+}
+
+void UIScriptControllerGtk::dismissMenu()
+{
+    // FIXME: implement.
+}
+
+bool UIScriptControllerGtk::isShowingMenu() const
+{
+    // FIXME: implement.
+    return false;
+}
+
+void UIScriptControllerGtk::activateAtPoint(long x, long y, JSValueRef callback)
+{
+    auto* eventSender = TestController::singleton().eventSenderProxy();
+    if (!eventSender) {
+        ASSERT_NOT_REACHED();
+        return;
+    }
+
+    unsigned callbackID = m_context->prepareForAsyncTask(callback, CallbackTypeNonPersistent);
+
+    eventSender->mouseMoveTo(x, y);
+    eventSender->mouseDown(0, 0);
+    eventSender->mouseUp(0, 0);
+
+    RunLoop::main().dispatch([this, protectedThis = makeRef(*this), callbackID] {
+        if (!m_context)
+            return;
+        m_context->asyncTaskComplete(callbackID);
+    });
+}
+
+void UIScriptControllerGtk::activateDataListSuggestion(unsigned index, JSValueRef callback)
+{
+    // FIXME: implement.
+    UNUSED_PARAM(index);
+
+    doAsyncTask(callback);
+}
+
+void UIScriptControllerGtk::simulateAccessibilitySettingsChangeNotification(JSValueRef callback)
+{
+    // FIXME: implement.
+    doAsyncTask(callback);
+}
+
+void UIScriptControllerGtk::removeViewFromWindow(JSValueRef callback)
+{
+    unsigned callbackID = m_context->prepareForAsyncTask(callback, CallbackTypeNonPersistent);
+    auto* mainWebView = TestController::singleton().mainWebView();
+    mainWebView->removeFromWindow();
+
+    RunLoop::main().dispatch([this, protectedThis = makeRef(*this), callbackID] {
+        if (!m_context)
+            return;
+        m_context->asyncTaskComplete(callbackID);
+    });
+}
+
+void UIScriptControllerGtk::addViewToWindow(JSValueRef callback)
+{
+    unsigned callbackID = m_context->prepareForAsyncTask(callback, CallbackTypeNonPersistent);
+    auto* mainWebView = TestController::singleton().mainWebView();
+    mainWebView->addToWindow();
+
+    RunLoop::main().dispatch([this, protectedThis = makeRef(*this), callbackID] {
+        if (!m_context)
+            return;
+        m_context->asyncTaskComplete(callbackID);
+    });
+}
+
 } // namespace WTR

Modified: trunk/Tools/WebKitTestRunner/gtk/UIScriptControllerGtk.h (253466 => 253467)


--- trunk/Tools/WebKitTestRunner/gtk/UIScriptControllerGtk.h	2019-12-13 08:40:48 UTC (rev 253466)
+++ trunk/Tools/WebKitTestRunner/gtk/UIScriptControllerGtk.h	2019-12-13 10:54:33 UTC (rev 253467)
@@ -42,6 +42,16 @@
     void beginBackSwipe(JSValueRef) override;
     void completeBackSwipe(JSValueRef) override;
     bool isShowingDataListSuggestions() const override;
+    void doAsyncTask(JSValueRef) override;
+    void setContinuousSpellCheckingEnabled(bool) override;
+    void copyText(JSStringRef) override;
+    void dismissMenu() override;
+    bool isShowingMenu() const override;
+    void activateAtPoint(long x, long y, JSValueRef callback) override;
+    void activateDataListSuggestion(unsigned index, JSValueRef callback) override;
+    void simulateAccessibilitySettingsChangeNotification(JSValueRef) override;
+    void removeViewFromWindow(JSValueRef) override;
+    void addViewToWindow(JSValueRef) override;
 };
 
 } // namespace WTR
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to