[M108 Migration][Text Selection] Selection handles & Caret Selection
[platform/framework/web/chromium-efl.git] / tizen_src / ewk / efl_integration / browser / autofill_popup_view_efl.cc
index 2d36be4..3a221bf 100644 (file)
@@ -10,6 +10,7 @@
 #include "base/strings/utf_string_conversions.h"
 #include "components/autofill/core/browser/ui/popup_item_ids.h"
 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
+#include "content/browser/web_contents/web_contents_impl.h"
 #include "content/common/paths_efl.h"
 #include "eweb_view.h"
 #include "tizen/system_info.h"
@@ -41,13 +42,21 @@ AutofillPopupViewEfl::AutofillPopupViewEfl(EWebView* view)
       autofill_list_(nullptr),
       password_popup_(nullptr),
       selected_line_(-1) {
-  Evas_Object* widgetWin_ = elm_object_top_widget_get(
-      elm_object_parent_widget_get(view->evas_object()));
-  if (!widgetWin_)
-    widgetWin_ = view->evas_object();
-  autofill_popup_ = elm_layout_add(widgetWin_);
+  auto native_view =
+      static_cast<content::WebContentsImpl*>(&(webview_->web_contents()))
+          ->GetEflNativeView();
+
   if (!autofill_popup_)
     return;
+  auto smart_parent = evas_object_smart_parent_get(native_view);
+  if (!smart_parent) {
+    LOG(ERROR) << "Unable to get smart parent from native view";
+    evas_object_del(autofill_popup_);
+    autofill_popup_ = nullptr;
+    return;
+  }
+  evas_object_smart_member_add(autofill_popup_, smart_parent);
+  elm_object_part_content_set(smart_parent, "autofill_popup", autofill_popup_);
   base::FilePath edj_dir;
   base::FilePath autofill_edj;
   base::PathService::Get(PathsEfl::EDJE_RESOURCE_DIR, &edj_dir);
@@ -60,8 +69,10 @@ AutofillPopupViewEfl::AutofillPopupViewEfl(EWebView* view)
 
 AutofillPopupViewEfl::~AutofillPopupViewEfl()
 {
-  if (autofill_popup_)
+  if (autofill_popup_) {
+    evas_object_smart_member_del(autofill_popup_);
     evas_object_del(autofill_popup_);
+  }
   if (password_popup_)
     evas_object_del(password_popup_);
 }