Title: [224567] trunk
Revision
224567
Author
[email protected]
Date
2017-11-07 23:25:40 -0800 (Tue, 07 Nov 2017)

Log Message

REGRESSION(r224179): [GTK] Several WebViewEditor tests are failing since r224179
https://bugs.webkit.org/show_bug.cgi?id=179366

Reviewed by Michael Catanzaro.

Source/WebKit:

In r224179, webkit_web_view_can_execute_editing_command() was optimized to use the sync path for commands
supported by the WebViewEditorState, but the state requires a redraw to be up to date. We can't know if
WebViewEditorState is in sync, when webkit_web_view_can_execute_editing_command() is called, so we always need
to ask the web process.

* UIProcess/API/glib/WebKitWebView.cpp:
(webkit_web_view_can_execute_editing_command):

Tools:

Use always a toplevel window for WebViewEditor tests instead of creating and destroying one only to flush editor
state.

* TestWebKitAPI/Tests/WebKitGtk/TestWebViewEditor.cpp:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (224566 => 224567)


--- trunk/Source/WebKit/ChangeLog	2017-11-08 07:23:38 UTC (rev 224566)
+++ trunk/Source/WebKit/ChangeLog	2017-11-08 07:25:40 UTC (rev 224567)
@@ -1,5 +1,20 @@
 2017-11-07  Carlos Garcia Campos  <[email protected]>
 
+        REGRESSION(r224179): [GTK] Several WebViewEditor tests are failing since r224179
+        https://bugs.webkit.org/show_bug.cgi?id=179366
+
+        Reviewed by Michael Catanzaro.
+
+        In r224179, webkit_web_view_can_execute_editing_command() was optimized to use the sync path for commands
+        supported by the WebViewEditorState, but the state requires a redraw to be up to date. We can't know if
+        WebViewEditorState is in sync, when webkit_web_view_can_execute_editing_command() is called, so we always need
+        to ask the web process.
+
+        * UIProcess/API/glib/WebKitWebView.cpp:
+        (webkit_web_view_can_execute_editing_command):
+
+2017-11-07  Carlos Garcia Campos  <[email protected]>
+
         [GTK][WPE] Build inspector resources using copy-user-interface-resources.pl script
         https://bugs.webkit.org/show_bug.cgi?id=179317
 

Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp (224566 => 224567)


--- trunk/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp	2017-11-08 07:23:38 UTC (rev 224566)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp	2017-11-08 07:25:40 UTC (rev 224567)
@@ -3087,24 +3087,10 @@
     g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
     g_return_if_fail(command);
 
-    GTask* task = g_task_new(webView, cancellable, callback, userData);
-    WebKitEditorState* state = webkit_web_view_get_editor_state(webView);
-
-    if (!strcmp(command, WEBKIT_EDITING_COMMAND_CUT))
-        g_task_return_boolean(adoptGRef(task).get(), webkit_editor_state_is_cut_available(state));
-    else if (!strcmp(command, WEBKIT_EDITING_COMMAND_COPY))
-        g_task_return_boolean(adoptGRef(task).get(), webkit_editor_state_is_copy_available(state));
-    else if (!strcmp(command, WEBKIT_EDITING_COMMAND_PASTE))
-        g_task_return_boolean(adoptGRef(task).get(), webkit_editor_state_is_paste_available(state));
-    else if (!strcmp(command, WEBKIT_EDITING_COMMAND_UNDO))
-        g_task_return_boolean(adoptGRef(task).get(), webkit_editor_state_is_undo_available(state));
-    else if (!strcmp(command, WEBKIT_EDITING_COMMAND_REDO))
-        g_task_return_boolean(adoptGRef(task).get(), webkit_editor_state_is_redo_available(state));
-    else {
-        getPage(webView).validateCommand(String::fromUTF8(command), [task](const String&, bool isEnabled, int32_t, WebKit::CallbackBase::Error) {
-            g_task_return_boolean(adoptGRef(task).get(), isEnabled);        
-        });
-    }
+    GRefPtr<GTask> task = adoptGRef(g_task_new(webView, cancellable, callback, userData));
+    getPage(webView).validateCommand(String::fromUTF8(command), [task = WTFMove(task)](const String&, bool isEnabled, int32_t, WebKit::CallbackBase::Error) {
+        g_task_return_boolean(task.get(), isEnabled);
+    });
 }
 
 /**

Modified: trunk/Tools/ChangeLog (224566 => 224567)


--- trunk/Tools/ChangeLog	2017-11-08 07:23:38 UTC (rev 224566)
+++ trunk/Tools/ChangeLog	2017-11-08 07:25:40 UTC (rev 224567)
@@ -1,5 +1,17 @@
 2017-11-07  Carlos Garcia Campos  <[email protected]>
 
+        REGRESSION(r224179): [GTK] Several WebViewEditor tests are failing since r224179
+        https://bugs.webkit.org/show_bug.cgi?id=179366
+
+        Reviewed by Michael Catanzaro.
+
+        Use always a toplevel window for WebViewEditor tests instead of creating and destroying one only to flush editor
+        state.
+
+        * TestWebKitAPI/Tests/WebKitGtk/TestWebViewEditor.cpp:
+
+2017-11-07  Carlos Garcia Campos  <[email protected]>
+
         [GTK][WPE] Build inspector resources using copy-user-interface-resources.pl script
         https://bugs.webkit.org/show_bug.cgi?id=179317
 

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitGtk/TestWebViewEditor.cpp (224566 => 224567)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitGtk/TestWebViewEditor.cpp	2017-11-08 07:23:38 UTC (rev 224566)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitGtk/TestWebViewEditor.cpp	2017-11-08 07:25:40 UTC (rev 224567)
@@ -34,6 +34,7 @@
         , m_triesCount(0)
         , m_editorState(nullptr)
     {
+        showInWindowAndWaitUntilMapped(GTK_WINDOW_TOPLEVEL);
         gtk_clipboard_clear(m_clipboard);
     }
 
@@ -40,22 +41,15 @@
     static gboolean webViewDrawCallback(GMainLoop* mainLoop)
     {
         g_main_loop_quit(mainLoop);
-        return G_SOURCE_REMOVE;
+        return FALSE;
     }
 
     void flushEditorState()
     {
-        // FIXME: It would be better to call WebViewTest::showInWindowAndWaitUntilMapped
-        // at the start of the test, rather than creating and destroying temporary windows.
-        showInWindow(GTK_WINDOW_TOPLEVEL);
-
-        g_signal_connect_swapped(m_webView, "draw", G_CALLBACK(webViewDrawCallback), m_mainLoop);
+        auto signalID = g_signal_connect_swapped(m_webView, "draw", G_CALLBACK(webViewDrawCallback), m_mainLoop);
         gtk_widget_queue_draw(GTK_WIDGET(m_webView));
         g_main_loop_run(m_mainLoop);
-
-        gtk_container_remove(GTK_CONTAINER(m_parentWindow), GTK_WIDGET(m_webView));
-        gtk_widget_destroy(m_parentWindow);
-        m_parentWindow = nullptr;
+        g_signal_handler_disconnect(m_webView, signalID);
     }
 
     static void canExecuteEditingCommandReadyCallback(GObject*, GAsyncResult* result, EditorTest* test)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to