[WRTJS][M120 Migration] Support for WRTContextMenuController 86/314886/6
authorManjeet <manjeet.1@partner.samsung.com>
Mon, 22 Jul 2024 19:03:32 +0000 (00:33 +0530)
committerBot Blink <blinkbot@samsung.com>
Fri, 20 Sep 2024 08:45:06 +0000 (08:45 +0000)
1. Support for WRTContextMenuController
2. Fixes Drag and Drop test
3. Replaced instances of #defined(USE_EFL)

Reference: https://review.tizen.org/gerrit/292781

Change-Id: Ifc306de444148aa338d95c297c152d527e599b74
Signed-off-by: Manjeet <manjeet.1@partner.samsung.com>
content/browser/renderer_host/render_widget_host_view_aura.cc
content/browser/renderer_host/render_widget_host_view_aura.h
content/ppapi_plugin/ppapi_plugin_main.cc
tizen_src/chromium_impl/content/browser/context_menu/context_menu_controller_base.cc
tizen_src/chromium_impl/content/browser/selection/selection_box_efl.h
tizen_src/chromium_impl/content/browser/selection/selection_controller_efl.cc
tizen_src/chromium_impl/content/browser/selection/selection_controller_efl.h
tizen_src/ewk/efl_integration/eweb_view.cc
wrt/src/browser/wrt_context_menu_controller.cc

index 9a39160fc0288d9d3b44ddfca6b1e2e7c196bb2e..12b880f80b9c7dc1a014a9438ff86e7a3d6269dc 100644 (file)
@@ -929,6 +929,12 @@ void RenderWidgetHostViewAura::CloseQRCode() {
     efl_helper_->CloseQRCode();
   }
 }
+std::u16string RenderWidgetHostViewAura::GetSelectionText() {
+  if (GetTextInputManager() && GetTextInputManager()->GetTextSelection(this)) {
+    return GetTextInputManager()->GetTextSelection(this)->text();
+  }
+  return std::u16string();
+}
 #endif
 
 #if BUILDFLAG(IS_WIN)
@@ -2450,7 +2456,7 @@ void RenderWidgetHostViewAura::FocusedNodeChanged(
     input_method->CancelComposition(this);
   has_composition_text_ = false;
 
-#if defined(USE_EFL)
+#if BUILDFLAG(IS_EFL)
   if (efl_helper_) {
     efl_helper_->FocusedNodeChanged(
 #if BUILDFLAG(IS_TIZEN_TV)
index ed61ea23ec52c51b530e940640945cb2722b4f40..6030efd74272d1e961df4f6bd25c65f3b5039538 100644 (file)
@@ -229,7 +229,7 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
                           ,
                           bool is_radio_or_checkbox
 #endif
-#if defined(USE_EFL)
+#if BUILDFLAG(IS_EFL)
                           ,
                           bool is_content_editable
 #endif
@@ -531,6 +531,9 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
 #if BUILDFLAG(IS_EFL)
   void DisplayQRCode(std::string contents) override;
   void CloseQRCode() override;
+  // Returns the text including the selection which might include
+  // several characters before and after it.
+  std::u16string GetSelectionText();
 #endif
 
   // May be overridden in tests.
index 734f8904f347b776addf5470a7e59a6e339cd000..892e357ba4b9c63a04da86d5addf8abb3c6491f5 100644 (file)
@@ -139,7 +139,7 @@ int PpapiPluginMain(MainFunctionParams parameters) {
   setenv("HOME", homedir.value().c_str(), 1);
 #endif
 
-#if defined(USE_EFL) && defined(TIZEN_PEPPER_EXTENSIONS)
+#if defined(TIZEN_PEPPER_EXTENSIONS)
   base::SingleThreadTaskExecutor main_thread_task_executor(
       base::MessagePumpType::ECORE);
 #else
index 893e7b29ed83fe9246d554e1c989752f1c295506..839c99867081767d8c1c359f7956527a46f7f958 100644 (file)
@@ -81,8 +81,10 @@ bool ContextMenuControllerBase::CreateContextMenu(
 #endif
     elm_object_tree_focus_allow_set(popup_, false);
   } else {
-    top_widget_ =
-        elm_object_top_widget_get(elm_object_parent_widget_get(ewk_view()));
+    if (auto parent = elm_object_parent_widget_get(ewk_view()))
+      top_widget_ = elm_object_top_widget_get(parent);
+    else
+      top_widget_ = elm_object_top_widget_get(ewk_view());
     evas_object_data_set(top_widget_, "ContextMenuContollerEfl", this);
     popup_ = elm_popup_add(top_widget_);
 
index aa4c8dea8a639a945e9afd3c6242b68f571ad022..5e67a32c57370785b64606ac19b0e6c7eba2bb79 100644 (file)
@@ -11,8 +11,6 @@
 #include "ui/gfx/geometry/rect.h"
 #include "ui/gfx/range/range.h"
 
-class EWebView;
-
 namespace content {
 
 class RenderWidgetHostViewAura;
index 06a79ccf121562fa2339264fb6ea89ea8b7363e3..b564265bb2e11499634141c6dff59bb4484f39d4 100644 (file)
@@ -97,7 +97,7 @@ SelectionControllerEfl::~SelectionControllerEfl() {
 #endif
 
   if (GetSelectionStatus())
-    ClearSelectionViaEWebView();
+    ClearSelectionViaWebViewDelegate();
   HideHandleAndContextMenu();
 
   if (rwhva_->offscreen_helper()) {
@@ -125,7 +125,7 @@ void SelectionControllerEfl::PlatformLanguageChanged(keynode_t* keynode, void* d
     return;
 
   if (selection_controller->GetSelectionStatus())
-    selection_controller->ClearSelectionViaEWebView();
+    selection_controller->ClearSelectionViaWebViewDelegate();
   selection_controller->HideHandleAndContextMenu();
 }
 #endif
@@ -260,7 +260,7 @@ void SelectionControllerEfl::UpdateSelectionData(const std::u16string& text) {
   selection_data_->UpdateSelectStringData(text);
 }
 
-bool SelectionControllerEfl::ClearSelectionViaEWebView() {
+bool SelectionControllerEfl::ClearSelectionViaWebViewDelegate() {
   if (!GetSelectionStatus() || !web_contents()->GetRenderViewHost() ||
       web_contents()->IsBeingDestroyed()) {
     return false;
@@ -471,6 +471,8 @@ void SelectionControllerEfl::ShowContextMenu() {
   // TODO(a1.gomes): In case of EWK apps, the call below end up calling
   // EWebView::ShowContextMenu. We have to make sure parameters
   // are correct.
+  // In case of WRTJS, this ends up calling ShowContextMenu but
+  // through WRTJS components similar to EWebView's implementation
   WebContentsImpl* wci = static_cast<WebContentsImpl*>(web_contents());
   if (!wci || !wci->GetEflDelegate()) {
     return;
@@ -717,7 +719,7 @@ void SelectionControllerEfl::HandlePostponedGesture(int x,
     point = rwhva_->aura_efl_helper()->ConvertPointInViewPix(point);
   switch (type) {
     case ui::ET_GESTURE_LONG_PRESS: {
-      ClearSelectionViaEWebView();
+      ClearSelectionViaWebViewDelegate();
       HideHandleAndContextMenu();
       // Long press data will call to WebContentsViewDelegateEfl.
       // It is called by the chain that handles FrameHostMsg_ContextMenu.
@@ -729,7 +731,7 @@ void SelectionControllerEfl::HandlePostponedGesture(int x,
       break;
     }
     default:
-      ClearSelectionViaEWebView();
+      ClearSelectionViaWebViewDelegate();
       break;
   }
 }
index c687da453473aa4b35553ba1291a963970eb0909..1349b7dcad10fbb531afb5d722ffb383b19e4117 100644 (file)
@@ -81,7 +81,7 @@ class CONTENT_EXPORT SelectionControllerEfl {
 
   // Clears the selection and hides context menu and handles
   void ClearSelection();
-  bool ClearSelectionViaEWebView();
+  bool ClearSelectionViaWebViewDelegate();
   void HideHandles();
   void HideHandleAndContextMenu();
   bool IsAnyHandleVisible() const;
index 8bd2c981ef664bd6c81b82a34ba79e4504afb787..6af2f7663468df4d869be1fd3f073078e48b7189 100644 (file)
@@ -1970,7 +1970,7 @@ Eina_Bool EWebView::ClearSelection() {
 
   if (GetSelectionController())
     return GetSelectionController()
-        ->ClearSelectionViaEWebView();  // LCOV_EXCL_LINE
+        ->ClearSelectionViaWebViewDelegate();  // LCOV_EXCL_LINE
 
   return EINA_FALSE;
 }
index 961bd4a708ae61b3f6c80c5f50653409b3810adc..bece639ee238bbc8f97800042d1fdea72da24015 100755 (executable)
@@ -247,8 +247,8 @@ void WRTContextMenuController::GetSelectionRange(
 
 void WRTContextMenuController::MoveCaret(const gfx::Point& point) {
 #if !defined(WRT_JS_BRINGUP)
-  if (rwhva() && rwhva()->aura_efl_helper())
-    rwhva()->aura_efl_helper()->MoveCaret(point);
+  if (rwhva() && rwhva()->offscreen_helper())
+    rwhva()->offscreen_helper()->MoveCaret(point);
 #endif
 }