Title: [234915] trunk
Revision
234915
Author
carlo...@webkit.org
Date
2018-08-16 01:15:54 -0700 (Thu, 16 Aug 2018)

Log Message

[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.

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:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (234914 => 234915)


--- trunk/Tools/ChangeLog	2018-08-16 08:14:41 UTC (rev 234914)
+++ trunk/Tools/ChangeLog	2018-08-16 08:15:54 UTC (rev 234915)
@@ -1,5 +1,24 @@
 2018-08-16  Carlos Garcia Campos  <cgar...@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  <cgar...@igalia.com>
+
         Unreviewed. Fix WebDriver tests after r234839.
 
         New pytest requires to autoinstall attrs too.

Modified: trunk/Tools/MiniBrowser/gtk/BrowserWindow.c (234914 => 234915)


--- trunk/Tools/MiniBrowser/gtk/BrowserWindow.c	2018-08-16 08:14:41 UTC (rev 234914)
+++ trunk/Tools/MiniBrowser/gtk/BrowserWindow.c	2018-08-16 08:15:54 UTC (rev 234915)
@@ -338,6 +338,7 @@
 
     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 @@
         "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 @@
         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 @@
         "is-controlled-by-automation", TRUE,
         NULL));
     browser_window_append_view(window, newWebView);
+    gtk_widget_grab_focus(GTK_WIDGET(newWebView));
     return newWebView;
 }

Modified: trunk/WebDriverTests/ChangeLog (234914 => 234915)


--- trunk/WebDriverTests/ChangeLog	2018-08-16 08:14:41 UTC (rev 234914)
+++ trunk/WebDriverTests/ChangeLog	2018-08-16 08:15:54 UTC (rev 234915)
@@ -1,3 +1,14 @@
+2018-08-16  Carlos Garcia Campos  <cgar...@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  <cgar...@igalia.com>
 
         Unreviewed gardening. Update several test expectations after r234839.

Modified: trunk/WebDriverTests/TestExpectations.json (234914 => 234915)


--- trunk/WebDriverTests/TestExpectations.json	2018-08-16 08:14:41 UTC (rev 234914)
+++ trunk/WebDriverTests/TestExpectations.json	2018-08-16 08:15:54 UTC (rev 234915)
@@ -478,20 +478,10 @@
             }
         }
     },
-    "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"}}
             }
         }
     },
@@ -607,13 +597,6 @@
             }
         }
     },
-    "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": {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to