fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: Kyrylo Hrechykhin <[email protected]>
  3. Date: Thu, 6 Oct 2022 18:30:53 +0200
  4. Subject: fix: on-screen-keyboard hides on input blur in webview
  5. Changes introduced by this patch fix issue where OSK does not hide on
  6. input rendered inside webview is blurred. This patch should be removed
  7. when proper fix in chromium repo is available.
  8. Note: the issue still occurs if input rendered in webview blurred due
  9. to touch outside of webview. It is caused by webview implementation
  10. details. Specificaly due to webview has its own tree nodes and focused
  11. node does not change in this case.
  12. chromium-bug: https://crbug.com/1369605
  13. 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
  14. index b190c86708d5ae7f207bae3e923609814bf68a52..16395c4b5fd5262885118095784db820508087dd 100644
  15. --- a/content/browser/renderer_host/render_widget_host_view_child_frame.cc
  16. +++ b/content/browser/renderer_host/render_widget_host_view_child_frame.cc
  17. @@ -1041,6 +1041,12 @@ RenderWidgetHostViewChildFrame::DidUpdateVisualProperties(
  18. return viz::ScopedSurfaceIdAllocator(std::move(allocation_task));
  19. }
  20. +void RenderWidgetHostViewChildFrame::FocusedNodeChanged(
  21. + bool is_editable_node,
  22. + const gfx::Rect& node_bounds_in_screen) {
  23. + NOTREACHED();
  24. +}
  25. +
  26. ui::TextInputType RenderWidgetHostViewChildFrame::GetTextInputType() const {
  27. if (!text_input_manager_)
  28. return ui::TEXT_INPUT_TYPE_NONE;
  29. 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
  30. index 648896b13ad4f811fdd196bd2fe5bdf62e7154ab..e2e3b414e73052b2b5b8e443ded18ae3f18fd916 100644
  31. --- a/content/browser/renderer_host/render_widget_host_view_child_frame.h
  32. +++ b/content/browser/renderer_host/render_widget_host_view_child_frame.h
  33. @@ -184,6 +184,8 @@ class CONTENT_EXPORT RenderWidgetHostViewChildFrame
  34. void DisableAutoResize(const gfx::Size& new_size) override;
  35. viz::ScopedSurfaceIdAllocator DidUpdateVisualProperties(
  36. const cc::RenderFrameMetadata& metadata) override;
  37. + void FocusedNodeChanged(bool is_editable_node,
  38. + const gfx::Rect& node_bounds_in_screen) override;
  39. // RenderFrameMetadataProvider::Observer implementation.
  40. void OnRenderFrameMetadataChangedBeforeActivation(
  41. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
  42. index e2e7b3e5cf8f581adee596903fc19886a23832c1..dd060f4207516af6b7db21593dcbed3848d47409 100644
  43. --- a/content/browser/web_contents/web_contents_impl.cc
  44. +++ b/content/browser/web_contents/web_contents_impl.cc
  45. @@ -8336,7 +8336,7 @@ void WebContentsImpl::OnFocusedElementChangedInFrame(
  46. "WebContentsImpl::OnFocusedElementChangedInFrame",
  47. "render_frame_host", frame);
  48. RenderWidgetHostViewBase* root_view =
  49. - static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView());
  50. + static_cast<RenderWidgetHostViewBase*>(GetTopLevelRenderWidgetHostView());
  51. if (!root_view || !frame->GetView())
  52. return;
  53. // Convert to screen coordinates from window coordinates by adding the