[M108 Migration][VD] Fix IME focus issue 72/288872/2
authorliuxd <xd123.liu@samsung.com>
Fri, 24 Feb 2023 01:39:34 +0000 (09:39 +0800)
committerBot Blink <blinkbot@samsung.com>
Mon, 27 Feb 2023 01:59:05 +0000 (01:59 +0000)
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 <xd123.liu@samsung.com>
third_party/blink/renderer/core/dom/element.cc
third_party/blink/renderer/core/frame/web_frame_widget_impl.cc
third_party/blink/renderer/core/frame/web_frame_widget_impl.h
third_party/blink/renderer/core/page/chrome_client.h
third_party/blink/renderer/core/page/chrome_client_impl.cc
third_party/blink/renderer/core/page/chrome_client_impl.h
third_party/blink/renderer/platform/widget/widget_base.cc
third_party/blink/renderer/platform/widget/widget_base.h

index 6f4a5a2..6b8d7dd 100644 (file)
@@ -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(
index f96ba43..3ed5097 100644 (file)
@@ -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);
 }
index 90e4b65..098e503 100644 (file)
@@ -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);
 
index bee1063..316b8e7 100644 (file)
@@ -502,6 +502,9 @@ class CORE_EXPORT ChromeClient : public GarbageCollected<ChromeClient> {
   // Input method editor related functions.
   virtual void ShowVirtualKeyboardOnElementFocus(LocalFrame&) {}
 
+#if BUILDFLAG(IS_EFL)
+  virtual void DidUpdateTextOfFocusedElementByNonUserInput(LocalFrame&) {}
+#endif
   virtual TransformationMatrix GetDeviceEmulationTransform() const {
     return TransformationMatrix();
   }
index ec0e285..434c4b3 100644 (file)
@@ -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())) {
index 76433dc..42933c6 100644 (file)
@@ -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;
index 5f2147f..dbeadca 100644 (file)
@@ -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;
index f701e65..e1bda87 100644 (file)
@@ -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);