[GTK] MiniBrowser: web view doesn't get the focus when new window is created
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 Aug 2018 08:15:54 +0000 (08:15 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 Aug 2018 08:15:54 +0000 (08:15 +0000)
https://bugs.webkit.org/show_bug.cgi?id=188546

Reviewed by Michael Catanzaro.

Tools:

When a new window is created, the first widget of the windo is getting the focus, the toolbar in this case. We
always want the WebView to grab the focus. In case of new empty tab, we want to the URL bar to be focused
instead. This was causing failures in WebDriver tests that create a popup window with an input element that is
filled with send keys command. The input element is marked as focused in the DOM, but the actual focused widget
is the toolbar, so key events are sent to the toolbar instead of the web view.

* MiniBrowser/gtk/BrowserWindow.c:
(webViewCreate):
(newTabCallback):
(openPrivateWindow):
(browser_window_get_or_create_web_view_for_automation):

WebDriverTests:

Remove expectations of the tests that pass now.

* TestExpectations.json:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234915 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/MiniBrowser/gtk/BrowserWindow.c
WebDriverTests/ChangeLog
WebDriverTests/TestExpectations.json

index b48cf79..5ace334 100644 (file)
@@ -1,5 +1,24 @@
 2018-08-16  Carlos Garcia Campos  <cgarcia@igalia.com>
 
+        [GTK] MiniBrowser: web view doesn't get the focus when new window is created
+        https://bugs.webkit.org/show_bug.cgi?id=188546
+
+        Reviewed by Michael Catanzaro.
+
+        When a new window is created, the first widget of the windo is getting the focus, the toolbar in this case. We
+        always want the WebView to grab the focus. In case of new empty tab, we want to the URL bar to be focused
+        instead. This was causing failures in WebDriver tests that create a popup window with an input element that is
+        filled with send keys command. The input element is marked as focused in the DOM, but the actual focused widget
+        is the toolbar, so key events are sent to the toolbar instead of the web view.
+
+        * MiniBrowser/gtk/BrowserWindow.c:
+        (webViewCreate):
+        (newTabCallback):
+        (openPrivateWindow):
+        (browser_window_get_or_create_web_view_for_automation):
+
+2018-08-16  Carlos Garcia Campos  <cgarcia@igalia.com>
+
         Unreviewed. Fix WebDriver tests after r234839.
 
         New pytest requires to autoinstall attrs too.
index 36b3065..d559835 100644 (file)
@@ -338,6 +338,7 @@ static GtkWidget *webViewCreate(WebKitWebView *webView, WebKitNavigationAction *
 
     GtkWidget *newWindow = browser_window_new(GTK_WINDOW(window), window->webContext);
     browser_window_append_view(BROWSER_WINDOW(newWindow), newWebView);
+    gtk_widget_grab_focus(GTK_WIDGET(newWebView));
     g_signal_connect(newWebView, "ready-to-show", G_CALLBACK(webViewReadyToShow), newWindow);
     g_signal_connect(newWebView, "run-as-modal", G_CALLBACK(webViewRunAsModal), newWindow);
     g_signal_connect(newWebView, "close", G_CALLBACK(webViewClose), newWindow);
@@ -528,6 +529,7 @@ static void newTabCallback(BrowserWindow *window)
         "user-content-manager", webkit_web_view_get_user_content_manager(webView),
         "is-controlled-by-automation", webkit_web_view_is_controlled_by_automation(webView),
         NULL)));
+    gtk_widget_grab_focus(window->uriEntry);
     gtk_notebook_set_current_page(GTK_NOTEBOOK(window->notebook), -1);
 }
 
@@ -548,6 +550,7 @@ static void openPrivateWindow(BrowserWindow *window)
         NULL));
     GtkWidget *newWindow = browser_window_new(GTK_WINDOW(window), window->webContext);
     browser_window_append_view(BROWSER_WINDOW(newWindow), newWebView);
+    gtk_widget_grab_focus(GTK_WIDGET(newWebView));
     gtk_widget_show(GTK_WIDGET(newWindow));
 }
 
@@ -1233,5 +1236,6 @@ WebKitWebView *browser_window_get_or_create_web_view_for_automation(void)
         "is-controlled-by-automation", TRUE,
         NULL));
     browser_window_append_view(window, newWebView);
+    gtk_widget_grab_focus(GTK_WIDGET(newWebView));
     return newWebView;
 }
index 0b468d8..e27d2b0 100644 (file)
@@ -1,3 +1,14 @@
+2018-08-16  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [GTK] MiniBrowser: web view doesn't get the focus when new window is created
+        https://bugs.webkit.org/show_bug.cgi?id=188546
+
+        Reviewed by Michael Catanzaro.
+
+        Remove expectations of the tests that pass now.
+
+        * TestExpectations.json:
+
 2018-08-14  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         Unreviewed gardening. Update several test expectations after r234839.
index 14cd22a..b33a22a 100644 (file)
             }
         }
     },
-    "imported/w3c/webdriver/tests/back/back.py": {
-        "subtests": {
-            "test_dismissed_beforeunload": {
-                "expected": {"all": {"status": ["TIMEOUT"], "bug": "webkit.org/b/188546"}}
-            }
-        }
-    },
     "imported/w3c/webdriver/tests/close_window/close.py": {
         "subtests": {
             "test_close_last_browsing_context": {
                 "expected": {"gtk": {"status": ["FAIL", "PASS"], "bug": "webkit.org/b/188118"}}
-            },
-            "test_close_browsing_context_with_dismissed_beforeunload_prompt": {
-                "expected": {"all": {"status": ["TIMEOUT"], "bug": "webkit.org/b/188546"}}
             }
         }
     },
             }
         }
     },
-    "imported/w3c/webdriver/tests/forward/forward.py": {
-        "subtests": {
-            "test_dismissed_beforeunload": {
-                "expected": {"all": {"status": ["TIMEOUT"], "bug": "webkit.org/b/188546"}}
-            }
-        }
-    },
     "imported/w3c/webdriver/tests/element_send_keys/events.py": {
         "subtests": {
             "test_file_upload": {