Title: [260996] trunk/Source/WebKit
Revision
260996
Author
[email protected]
Date
2020-05-01 05:23:54 -0700 (Fri, 01 May 2020)

Log Message

[GTK] Move focus out of the web view when tab is pressed and there isn't a next element to focus
https://bugs.webkit.org/show_bug.cgi?id=211283

Reviewed by Adrian Perez de Castro.

Implement API::UIClient::takeFocus() that is called when WebCore wants to focus the chrome.

* UIProcess/API/glib/WebKitUIClient.cpp:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (260995 => 260996)


--- trunk/Source/WebKit/ChangeLog	2020-05-01 11:26:07 UTC (rev 260995)
+++ trunk/Source/WebKit/ChangeLog	2020-05-01 12:23:54 UTC (rev 260996)
@@ -1,3 +1,14 @@
+2020-05-01  Carlos Garcia Campos  <[email protected]>
+
+        [GTK] Move focus out of the web view when tab is pressed and there isn't a next element to focus
+        https://bugs.webkit.org/show_bug.cgi?id=211283
+
+        Reviewed by Adrian Perez de Castro.
+
+        Implement API::UIClient::takeFocus() that is called when WebCore wants to focus the chrome.
+
+        * UIProcess/API/glib/WebKitUIClient.cpp:
+
 2020-05-01  David Kilzer  <[email protected]>
 
         REGRESSION (r260214): Leak of _WKTextInputContext in -[WKContentView _isTextInputContextFocused:]

Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp (260995 => 260996)


--- trunk/Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp	2020-05-01 11:26:07 UTC (rev 260995)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp	2020-05-01 12:23:54 UTC (rev 260996)
@@ -294,6 +294,20 @@
     }
 
 #if PLATFORM(GTK)
+    bool takeFocus(WebPageProxy* page, WKFocusDirection direction) final
+    {
+        if (!gtk_widget_has_focus(GTK_WIDGET(m_webView))) {
+            focus(page);
+            return true;
+        }
+        return gtk_widget_child_focus(gtk_widget_get_toplevel(GTK_WIDGET(m_webView)), direction == kWKFocusDirectionBackward ? GTK_DIR_TAB_BACKWARD : GTK_DIR_TAB_FORWARD);
+    }
+
+    void focus(WebPageProxy*) final
+    {
+        gtk_widget_grab_focus(GTK_WIDGET(m_webView));
+    }
+
     void printFrame(WebPageProxy&, WebFrameProxy& frame, CompletionHandler<void()>&& completionHandler) final
     {
         webkitWebViewPrintFrame(m_webView, &frame);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to