From 77bc03e051624987a5864e12791c33579aad0fdb Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Tue, 11 Oct 2022 23:20:11 +0200 Subject: [PATCH] fix: on-screen-keyboard hides on input blurred in webview (#35982) * fix: on-screen-keyboard hides on input blurred in webview Co-authored-by: Kyrylo Hrechykhin * chore: update patches Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Kyrylo Hrechykhin Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> --- patches/chromium/.patches | 1 + ...board_hides_on_input_blur_in_webview.patch | 59 +++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch diff --git a/patches/chromium/.patches b/patches/chromium/.patches index bd0340c00135a..5d4cdbaa54944 100644 --- a/patches/chromium/.patches +++ b/patches/chromium/.patches @@ -124,3 +124,4 @@ fix_the_gn_gen_for_components_segmentation_platform.patch fix_crash_loading_non-standard_schemes_in_iframes.patch create_browser_v8_snapshot_file_name_fuse.patch cherry-pick-c83640db21b5.patch +fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch diff --git a/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch b/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch new file mode 100644 index 0000000000000..f501a3b7786e3 --- /dev/null +++ b/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch @@ -0,0 +1,59 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Kyrylo Hrechykhin +Date: Thu, 6 Oct 2022 18:30:53 +0200 +Subject: fix: on-screen-keyboard hides on input blur in webview + +Changes introduced by this patch fix issue where OSK does not hide on +input rendered inside webview is blurred. This patch should be removed +when proper fix in chromium repo is available. + +Note: the issue still occurs if input rendered in webview blurred due +to touch outside of webview. It is caused by webview implementation +details. Specificaly due to webview has its own tree nodes and focused +node does not change in this case. + +chromium-bug: https://crbug.com/1369605 + +diff --git a/content/browser/renderer_host/render_widget_host_view_child_frame.cc b/content/browser/renderer_host/render_widget_host_view_child_frame.cc +index 4e6d62be68d59c8a49159fda4d1e68f101a6f0a3..cfd5a01ea84a1f454a5172da3e96e66a50c82939 100644 +--- a/content/browser/renderer_host/render_widget_host_view_child_frame.cc ++++ b/content/browser/renderer_host/render_widget_host_view_child_frame.cc +@@ -992,6 +992,12 @@ RenderWidgetHostViewChildFrame::DidUpdateVisualProperties( + return viz::ScopedSurfaceIdAllocator(std::move(allocation_task)); + } + ++void RenderWidgetHostViewChildFrame::FocusedNodeChanged( ++ bool is_editable_node, ++ const gfx::Rect& node_bounds_in_screen) { ++ NOTREACHED(); ++} ++ + ui::TextInputType RenderWidgetHostViewChildFrame::GetTextInputType() const { + if (!text_input_manager_) + return ui::TEXT_INPUT_TYPE_NONE; +diff --git a/content/browser/renderer_host/render_widget_host_view_child_frame.h b/content/browser/renderer_host/render_widget_host_view_child_frame.h +index 70b151bcb8e3b1964d316bf2e169dbe0f28f24c7..c3857298974a0c2761efcd3924587607997e3117 100644 +--- a/content/browser/renderer_host/render_widget_host_view_child_frame.h ++++ b/content/browser/renderer_host/render_widget_host_view_child_frame.h +@@ -181,6 +181,8 @@ class CONTENT_EXPORT RenderWidgetHostViewChildFrame + void DisableAutoResize(const gfx::Size& new_size) override; + viz::ScopedSurfaceIdAllocator DidUpdateVisualProperties( + const cc::RenderFrameMetadata& metadata) override; ++ void FocusedNodeChanged(bool is_editable_node, ++ const gfx::Rect& node_bounds_in_screen) override; + + // RenderFrameMetadataProvider::Observer implementation. + void OnRenderFrameMetadataChangedBeforeActivation( +diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc +index 74993d461cbd0885a709cf8b663b9c69650aa3cf..940045d9bbb62676811f55f5d30a93a352f43ede 100644 +--- a/content/browser/web_contents/web_contents_impl.cc ++++ b/content/browser/web_contents/web_contents_impl.cc +@@ -7928,7 +7928,7 @@ void WebContentsImpl::OnFocusedElementChangedInFrame( + "WebContentsImpl::OnFocusedElementChangedInFrame", + "render_frame_host", frame); + RenderWidgetHostViewBase* root_view = +- static_cast(GetRenderWidgetHostView()); ++ static_cast(GetTopLevelRenderWidgetHostView()); + if (!root_view || !frame->GetView()) + return; + // Convert to screen coordinates from window coordinates by adding the