From 59e9bb5ecc915c1d0bad687770c8bd60b122db06 Mon Sep 17 00:00:00 2001 From: liuxd Date: Fri, 24 Feb 2023 09:39:34 +0800 Subject: [PATCH] [M108 Migration][VD] Fix IME focus issue 1. Add WebView focus and Widget show state check 2. Fix WebPage auto focus to input,ime have not focus in issue. refer: https://review.tizen.org/gerrit/#/c/282680/ Change-Id: I7c55cf139766af540119d4633a952816e264032d Signed-off-by: liuxd --- third_party/blink/renderer/core/dom/element.cc | 10 ++++++++++ .../blink/renderer/core/frame/web_frame_widget_impl.cc | 5 +++++ .../blink/renderer/core/frame/web_frame_widget_impl.h | 3 +++ third_party/blink/renderer/core/page/chrome_client.h | 3 +++ .../blink/renderer/core/page/chrome_client_impl.cc | 9 +++++++++ .../blink/renderer/core/page/chrome_client_impl.h | 3 +++ .../blink/renderer/platform/widget/widget_base.cc | 18 +++++++++++++++++- .../blink/renderer/platform/widget/widget_base.h | 5 +++++ 8 files changed, 55 insertions(+), 1 deletion(-) diff --git a/third_party/blink/renderer/core/dom/element.cc b/third_party/blink/renderer/core/dom/element.cc index 6f4a5a2..6b8d7dd 100644 --- a/third_party/blink/renderer/core/dom/element.cc +++ b/third_party/blink/renderer/core/dom/element.cc @@ -5688,6 +5688,16 @@ void Element::Focus(const FocusParams& params) { chrome_client.ClearKeyboardTriggeredTooltip(*GetDocument().GetFrame()); } } +#if BUILDFLAG(IS_EFL) + if (!LocalFrame::HasTransientUserActivation(nullptr)) { + // Called when value of focused text field gets dirty, + // e.g. value is modified by script, not by user input. + GetDocument() + .GetPage() + ->GetChromeClient() + .DidUpdateTextOfFocusedElementByNonUserInput(*GetDocument().GetFrame()); + } +#endif } void Element::UpdateSelectionOnFocus( diff --git a/third_party/blink/renderer/core/frame/web_frame_widget_impl.cc b/third_party/blink/renderer/core/frame/web_frame_widget_impl.cc index f96ba43..3ed5097 100644 --- a/third_party/blink/renderer/core/frame/web_frame_widget_impl.cc +++ b/third_party/blink/renderer/core/frame/web_frame_widget_impl.cc @@ -3510,6 +3510,11 @@ void WebFrameWidgetImpl::ShowVirtualKeyboardOnElementFocus() { widget_base_->ShowVirtualKeyboardOnElementFocus(); } +#if BUILDFLAG(IS_EFL) +void WebFrameWidgetImpl::DidUpdateTextOfFocusedElementByNonUserInput() { + widget_base_->DidUpdateTextOfFocusedElementByNonUserInput(); +} +#endif void WebFrameWidgetImpl::ProcessTouchAction(WebTouchAction touch_action) { widget_base_->ProcessTouchAction(touch_action); } diff --git a/third_party/blink/renderer/core/frame/web_frame_widget_impl.h b/third_party/blink/renderer/core/frame/web_frame_widget_impl.h index 90e4b65..098e503 100644 --- a/third_party/blink/renderer/core/frame/web_frame_widget_impl.h +++ b/third_party/blink/renderer/core/frame/web_frame_widget_impl.h @@ -544,6 +544,9 @@ class CORE_EXPORT WebFrameWidgetImpl void ClearKeyboardTriggeredTooltip(); void ShowVirtualKeyboardOnElementFocus(); +#if BUILDFLAG(IS_EFL) + void DidUpdateTextOfFocusedElementByNonUserInput(); +#endif void ProcessTouchAction(WebTouchAction touch_action); void SetPanAction(mojom::blink::PanAction pan_action); diff --git a/third_party/blink/renderer/core/page/chrome_client.h b/third_party/blink/renderer/core/page/chrome_client.h index bee1063..316b8e7 100644 --- a/third_party/blink/renderer/core/page/chrome_client.h +++ b/third_party/blink/renderer/core/page/chrome_client.h @@ -502,6 +502,9 @@ class CORE_EXPORT ChromeClient : public GarbageCollected { // Input method editor related functions. virtual void ShowVirtualKeyboardOnElementFocus(LocalFrame&) {} +#if BUILDFLAG(IS_EFL) + virtual void DidUpdateTextOfFocusedElementByNonUserInput(LocalFrame&) {} +#endif virtual TransformationMatrix GetDeviceEmulationTransform() const { return TransformationMatrix(); } diff --git a/third_party/blink/renderer/core/page/chrome_client_impl.cc b/third_party/blink/renderer/core/page/chrome_client_impl.cc index ec0e285..434c4b3 100644 --- a/third_party/blink/renderer/core/page/chrome_client_impl.cc +++ b/third_party/blink/renderer/core/page/chrome_client_impl.cc @@ -1194,6 +1194,15 @@ void ChromeClientImpl::ShowVirtualKeyboardOnElementFocus(LocalFrame& frame) { ->ShowVirtualKeyboardOnElementFocus(); } +#if BUILDFLAG(IS_EFL) +void ChromeClientImpl::DidUpdateTextOfFocusedElementByNonUserInput( + LocalFrame& frame) { + WebLocalFrameImpl::FromFrame(frame) + ->LocalRootFrameWidget() + ->DidUpdateTextOfFocusedElementByNonUserInput(); +} +#endif + void ChromeClientImpl::OnMouseDown(Node& mouse_down_node) { if (auto* fill_client = AutofillClientFromFrame(mouse_down_node.GetDocument().GetFrame())) { diff --git a/third_party/blink/renderer/core/page/chrome_client_impl.h b/third_party/blink/renderer/core/page/chrome_client_impl.h index 76433dc..42933c6 100644 --- a/third_party/blink/renderer/core/page/chrome_client_impl.h +++ b/third_party/blink/renderer/core/page/chrome_client_impl.h @@ -268,6 +268,9 @@ class CORE_EXPORT ChromeClientImpl final : public ChromeClient { void ShowVirtualKeyboardOnElementFocus(LocalFrame&) override; +#if BUILDFLAG(IS_EFL) + void DidUpdateTextOfFocusedElementByNonUserInput(LocalFrame&) override; +#endif TransformationMatrix GetDeviceEmulationTransform() const override; void OnMouseDown(Node&) override; diff --git a/third_party/blink/renderer/platform/widget/widget_base.cc b/third_party/blink/renderer/platform/widget/widget_base.cc index 5f2147f..dbeadca 100644 --- a/third_party/blink/renderer/platform/widget/widget_base.cc +++ b/third_party/blink/renderer/platform/widget/widget_base.cc @@ -1210,8 +1210,15 @@ void WidgetBase::ShowVirtualKeyboardOnElementFocus() { UpdateTextInputState(); #elif BUILDFLAG(IS_EFL) // If webview hasn't focus, IME shouldn't be shown. - if (has_focus_) + if (has_focus_) { +#if BUILDFLAG(IS_TIZEN_TV) + LOG(INFO) << __FUNCTION__; + DidUpdateTextOfFocusedElementByNonUserInput(); +#else ShowVirtualKeyboard(); +#endif // endif defined(OS_TIZEN_TV_PRODUCT) + } + #else ShowVirtualKeyboard(); #endif @@ -1223,6 +1230,15 @@ void WidgetBase::ShowVirtualKeyboardOnElementFocus() { #endif } +#if BUILDFLAG(IS_EFL) +void WidgetBase::DidUpdateTextOfFocusedElementByNonUserInput() { + if (GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE) { + LOG(INFO) << __FUNCTION__ << " set is_user_action_ FALSE"; + is_user_action_ = false; + ShowVirtualKeyboard(); + } +} +#endif void WidgetBase::ProcessTouchAction(cc::TouchAction touch_action) { if (!input_handler_.ProcessTouchAction(touch_action)) return; diff --git a/third_party/blink/renderer/platform/widget/widget_base.h b/third_party/blink/renderer/platform/widget/widget_base.h index f701e65..e1bda87 100644 --- a/third_party/blink/renderer/platform/widget/widget_base.h +++ b/third_party/blink/renderer/platform/widget/widget_base.h @@ -223,6 +223,11 @@ class PLATFORM_EXPORT WidgetBase : public mojom::blink::Widget, // Dispatch the virtual keyboard and update text input state. void ShowVirtualKeyboardOnElementFocus(); +#if BUILDFLAG(IS_EFL) + // Called when value of focused text field gets dirty, e.g. value is modified + // by script, not by user input. + void DidUpdateTextOfFocusedElementByNonUserInput(); +#endif // Process the touch action. void ProcessTouchAction(cc::TouchAction touch_action); -- 2.7.4