[M120 Migration][VD] Fix ewk_view_focus_set fail issue 76/307076/3
authorfang fengrong <fr.fang@samsung.com>
Mon, 4 Mar 2024 12:09:26 +0000 (20:09 +0800)
committerBot Blink <blinkbot@samsung.com>
Tue, 5 Mar 2024 05:15:33 +0000 (05:15 +0000)
WebBrowser set focus through ewk_view_focus_set api not work at
first launch. Because when set focus, the offscreen_helper haven't
been created, it cause don't SetFocus.

So pending send focus till RenderFrameLive.
refer:
https://review.tizen.org/gerrit/#/c/298820/

Change-Id: I6a0722bd7853aefce9547864642383dc199ba7b5
Signed-off-by: fang fengrong <fr.fang@samsung.com>
tizen_src/ewk/efl_integration/eweb_view.cc
tizen_src/ewk/efl_integration/eweb_view.h

index c6f8160..7e64d85 100644 (file)
@@ -537,19 +537,23 @@ void EWebView::ResetContextMenuController() {
 
 #if BUILDFLAG(IS_TIZEN_TV)
 void EWebView::RunPendingSetFocus(Eina_Bool focus) {
-  if (!web_contents_ || !rwhva() || (HasFocus() == focus))
+  SetFocusInternal(focus);
+}
+
+void EWebView::SetFocusInternal(Eina_Bool focus) {
+  if (!rwhva() || !rwhva()->offscreen_helper() || (HasFocus() == focus))
     return;
   rwhva()->offscreen_helper()->Focus(focus);
 }
 #endif
 
 void EWebView::SetFocus(Eina_Bool focus) {
-  if (!web_contents_ || !rwhva() || (HasFocus() == focus))
+  if (!web_contents_)
     return;
 
 #if BUILDFLAG(IS_TIZEN_TV)
   if (web_contents_->GetPrimaryMainFrame()->IsRenderFrameLive()) {
-    rwhva()->offscreen_helper()->Focus(focus);
+    SetFocusInternal(focus);
 
     if (pending_setfocus_closure_)
       pending_setfocus_closure_.Reset();
@@ -564,7 +568,7 @@ void EWebView::SetFocus(Eina_Bool focus) {
 }
 
 Eina_Bool EWebView::HasFocus() const {
-  if (!rwhva())
+  if (!rwhva() || !rwhva()->offscreen_helper())
     return EINA_FALSE;
 
   return rwhva()->offscreen_helper()->HasFocus() ? EINA_TRUE : EINA_FALSE;
index de4f3d8..055fd05 100644 (file)
@@ -811,6 +811,7 @@ class EWebView {
   void InitInspectorServer();
 
   void RunPendingSetFocus(Eina_Bool focus);
+  void SetFocusInternal(Eina_Bool focus);
 #endif
 
   JavaScriptDialogManagerEfl* GetJavaScriptDialogManagerEfl();