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:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224567
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
2017-11-07 Carlos Garcia Campos <cgarcia@igalia.com>
+ 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 <cgarcia@igalia.com>
+
[GTK][WPE] Build inspector resources using copy-user-interface-resources.pl script
https://bugs.webkit.org/show_bug.cgi?id=179317
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);
+ });
}
/**
2017-11-07 Carlos Garcia Campos <cgarcia@igalia.com>
+ 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 <cgarcia@igalia.com>
+
[GTK][WPE] Build inspector resources using copy-user-interface-resources.pl script
https://bugs.webkit.org/show_bug.cgi?id=179317
, m_triesCount(0)
, m_editorState(nullptr)
{
+ showInWindowAndWaitUntilMapped(GTK_WINDOW_TOPLEVEL);
gtk_clipboard_clear(m_clipboard);
}
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)