Modified: trunk/Source/WebKit/ChangeLog (253881 => 253882)
--- trunk/Source/WebKit/ChangeLog 2019-12-23 09:19:50 UTC (rev 253881)
+++ trunk/Source/WebKit/ChangeLog 2019-12-23 10:06:29 UTC (rev 253882)
@@ -1,5 +1,18 @@
2019-12-23 Carlos Garcia Campos <[email protected]>
+ [GTK] InputMethod API unit tests don't work under X11
+ https://bugs.webkit.org/show_bug.cgi?id=205497
+
+ Reviewed by Žan Doberšek.
+
+ Assume the web view is always focused when running tests under Xvfb, since there isn't a window manager to focus
+ the toplevel window in that case.
+
+ * UIProcess/API/glib/InputMethodFilter.cpp:
+ (WebKit::InputMethodFilter::isViewFocused const):
+
+2019-12-23 Carlos Garcia Campos <[email protected]>
+
[GTK][WPE] Special combination characters doesn't respect the keystroke order when high CPU load
https://bugs.webkit.org/show_bug.cgi?id=185248
Modified: trunk/Source/WebKit/UIProcess/API/glib/InputMethodFilter.cpp (253881 => 253882)
--- trunk/Source/WebKit/UIProcess/API/glib/InputMethodFilter.cpp 2019-12-23 09:19:50 UTC (rev 253881)
+++ trunk/Source/WebKit/UIProcess/API/glib/InputMethodFilter.cpp 2019-12-23 10:06:29 UTC (rev 253882)
@@ -23,6 +23,7 @@
#include "WebKitInputMethodContextPrivate.h"
#include "WebKitWebViewPrivate.h"
#include "WebPageProxy.h"
+#include <WebCore/PlatformDisplay.h>
#include <wtf/SetForScope.h>
namespace WebKit {
@@ -112,6 +113,15 @@
if (!m_enabled || !m_context)
return false;
+#if ENABLE(DEVELOPER_MODE) && PLATFORM(X11)
+ // Xvfb doesn't support toplevel focus, so the WebView is never focused. We simply assume the WebView is focused
+ // since it's the only application running.
+ if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::X11) {
+ if (!g_strcmp0(g_getenv("UNDER_XVFB"), "yes"))
+ return true;
+ }
+#endif
+
auto* webView = webkitInputMethodContextGetWebView(m_context.get());
ASSERT(webView);
return webkitWebViewGetPage(webView).isViewFocused();
Modified: trunk/Tools/ChangeLog (253881 => 253882)
--- trunk/Tools/ChangeLog 2019-12-23 09:19:50 UTC (rev 253881)
+++ trunk/Tools/ChangeLog 2019-12-23 10:06:29 UTC (rev 253882)
@@ -1,5 +1,22 @@
2019-12-23 Carlos Garcia Campos <[email protected]>
+ [GTK] InputMethod API unit tests don't work under X11
+ https://bugs.webkit.org/show_bug.cgi?id=205497
+
+ Reviewed by Žan Doberšek.
+
+ Use a toplevel window instead of a popup for the input method tests, since that's required in X11 to get the web
+ view focused.
+
+ * TestWebKitAPI/Tests/WebKitGLib/TestInputMethodContext.cpp:
+ (testWebKitInputMethodContextSimple):
+ (testWebKitInputMethodContextSequence):
+ (testWebKitInputMethodContextInvalidSequence):
+ (testWebKitInputMethodContextCancelSequence):
+ (testWebKitInputMethodContextReset):
+
+2019-12-23 Carlos Garcia Campos <[email protected]>
+
[GTK][WPE] Special combination characters doesn't respect the keystroke order when high CPU load
https://bugs.webkit.org/show_bug.cgi?id=185248
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestInputMethodContext.cpp (253881 => 253882)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestInputMethodContext.cpp 2019-12-23 09:19:50 UTC (rev 253881)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestInputMethodContext.cpp 2019-12-23 10:06:29 UTC (rev 253882)
@@ -229,10 +229,12 @@
: m_context(adoptGRef(static_cast<WebKitInputMethodContextMock*>(g_object_new(webkit_input_method_context_mock_get_type(), nullptr))))
{
#if PLATFORM(GTK)
+ WebViewTest::showInWindowAndWaitUntilMapped(GTK_WINDOW_TOPLEVEL);
auto* defaultContext = webkit_web_view_get_input_method_context(m_webView);
g_assert_true(WEBKIT_IS_INPUT_METHOD_CONTEXT(defaultContext));
assertObjectIsDeletedWhenTestFinishes(G_OBJECT(defaultContext));
#elif PLATFORM(WPE)
+ WebViewTest::showInWindow();
g_assert_null(webkit_web_view_get_input_method_context(m_webView));
#endif
assertObjectIsDeletedWhenTestFinishes(G_OBJECT(m_context.get()));
@@ -316,9 +318,24 @@
g_main_loop_quit(m_mainLoop);
}
- void focusEditable()
+ void focusEditableAndWaitUntilInputMethodEnabled()
{
+ g_assert_false(m_context->enabled);
runJavaScriptAndWaitUntilFinished("document.getElementById('editable').focus()", nullptr);
+ if (m_context->enabled)
+ return;
+
+ g_idle_add([](gpointer userData) -> gboolean {
+ auto* test = static_cast<InputMethodTest*>(userData);
+ if (test->m_context->enabled) {
+ test->quitMainLoop();
+ return FALSE;
+ }
+
+ return TRUE;
+ }, this);
+ g_main_loop_run(m_mainLoop);
+ g_assert_true(m_context->enabled);
}
void resetEditable()
@@ -363,14 +380,10 @@
static void testWebKitInputMethodContextSimple(InputMethodTest* test, gconstpointer)
{
- webkit_settings_set_enable_developer_extras(webkit_web_view_get_settings(test->m_webView), TRUE);
- test->showInWindowAndWaitUntilMapped();
test->loadHtml(testHTML, nullptr);
test->waitUntilLoadFinished();
- g_assert_false(test->m_context->enabled);
- test->focusEditable();
- g_assert_true(test->m_context->enabled);
+ test->focusEditableAndWaitUntilInputMethodEnabled();
// Send a normal character not handled by IM.
test->keyStrokeAndWaitForEvents(KEY(a), 3);
@@ -413,14 +426,10 @@
static void testWebKitInputMethodContextSequence(InputMethodTest* test, gconstpointer)
{
- webkit_settings_set_enable_developer_extras(webkit_web_view_get_settings(test->m_webView), TRUE);
- test->showInWindowAndWaitUntilMapped();
test->loadHtml(testHTML, nullptr);
test->waitUntilLoadFinished();
- g_assert_false(test->m_context->enabled);
- test->focusEditable();
- g_assert_true(test->m_context->enabled);
+ test->focusEditableAndWaitUntilInputMethodEnabled();
// Compose w + gtk + Enter.
test->keyStrokeAndWaitForEvents(KEY(w), 4, CONTROL_MASK | SHIFT_MASK);
@@ -561,14 +570,11 @@
static void testWebKitInputMethodContextInvalidSequence(InputMethodTest* test, gconstpointer)
{
- webkit_settings_set_enable_developer_extras(webkit_web_view_get_settings(test->m_webView), TRUE);
- test->showInWindowAndWaitUntilMapped();
test->loadHtml(testHTML, nullptr);
test->waitUntilLoadFinished();
- g_assert_false(test->m_context->enabled);
- test->focusEditable();
- g_assert_true(test->m_context->enabled);
+ test->focusEditableAndWaitUntilInputMethodEnabled();
+
// Compose w + w + Space -> invalid sequence.
test->keyStrokeAndWaitForEvents(KEY(w), 4, CONTROL_MASK | SHIFT_MASK);
g_assert_true(test->m_events[0].type == InputMethodTest::Event::Type::KeyDown);
@@ -616,14 +622,11 @@
static void testWebKitInputMethodContextCancelSequence(InputMethodTest* test, gconstpointer)
{
- webkit_settings_set_enable_developer_extras(webkit_web_view_get_settings(test->m_webView), TRUE);
- test->showInWindowAndWaitUntilMapped();
test->loadHtml(testHTML, nullptr);
test->waitUntilLoadFinished();
- g_assert_false(test->m_context->enabled);
- test->focusEditable();
- g_assert_true(test->m_context->enabled);
+ test->focusEditableAndWaitUntilInputMethodEnabled();
+
// Compose w + w + Escape -> cancel sequence.
test->keyStrokeAndWaitForEvents(KEY(w), 4, CONTROL_MASK | SHIFT_MASK);
g_assert_true(test->m_events[0].type == InputMethodTest::Event::Type::KeyDown);
@@ -659,14 +662,11 @@
static void testWebKitInputMethodContextReset(InputMethodTest* test, gconstpointer)
{
- webkit_settings_set_enable_developer_extras(webkit_web_view_get_settings(test->m_webView), TRUE);
- test->showInWindowAndWaitUntilMapped();
test->loadHtml(testHTML, nullptr);
test->waitUntilLoadFinished();
- g_assert_false(test->m_context->enabled);
- test->focusEditable();
- g_assert_true(test->m_context->enabled);
+ test->focusEditableAndWaitUntilInputMethodEnabled();
+
// Compose w + w + click -> reset sequence.
test->keyStrokeAndWaitForEvents(KEY(w), 4, CONTROL_MASK | SHIFT_MASK);
g_assert_true(test->m_events[0].type == InputMethodTest::Event::Type::KeyDown);