[M108 Migration][Text Selection] Selection handles & Caret Selection
[platform/framework/web/chromium-efl.git] / tizen_src / chromium_impl / content / browser / selection / selection_controller_efl.h
index bfebbbd..7f34758 100644 (file)
@@ -25,6 +25,7 @@
 #include <libintl.h>
 
 namespace content {
+class RenderWidgetHostViewAura;
 class WebContents;
 class WebContentsImpl;
 
@@ -46,9 +47,12 @@ class CONTENT_EXPORT SelectionControllerEfl {
   };
 
  public:
-  explicit SelectionControllerEfl(Evas_Object* parent_view, WebContents& web_contents);
+  explicit SelectionControllerEfl(RenderWidgetHostViewAura* rwhva);
   ~SelectionControllerEfl();
 
+  SelectionControllerEfl(const SelectionControllerEfl&) = delete;
+  SelectionControllerEfl& operator=(const SelectionControllerEfl&) = delete;
+
   // Functions that handle long press, long press move and release
   bool HandleLongPressEvent(const gfx::Point& touch_point,
       const content::ContextMenuParams& params);
@@ -86,7 +90,6 @@ class CONTENT_EXPORT SelectionControllerEfl {
   // Clears the selection and hides context menu and handles
   void ClearSelection();
   bool ClearSelectionViaEWebView();
-  Evas_Object* GetParentView() const { return parent_view_; }
   void HideHandles();
   void HideHandleAndContextMenu();
   bool IsAnyHandleVisible() const;
@@ -120,6 +123,7 @@ class CONTENT_EXPORT SelectionControllerEfl {
     LongPressEnded,
     Tap,
     RequestedByContextMenu,
+    CaretModeForced,
     Irrelevant,
   };
   void SetWaitsForRendererSelectionChanges(
@@ -129,6 +133,20 @@ class CONTENT_EXPORT SelectionControllerEfl {
   void HandlePostponedGesture(int x, int y, ui::EventType type);
   void HandleGesture(blink::WebGestureEvent& event);
 
+  gfx::Rect GetVisibleViewportRect() const;
+
+  bool IsCaretModeForced() const { return is_caret_mode_forced_; }
+  void SetCustomVisibleViewRect(const gfx::Rect& custom_visible_view_rect) {
+    custom_visible_view_rect_ = custom_visible_view_rect;
+  }
+
+  void ToggleCaretAfterSelection();
+  void ShowHandleAndContextMenuIfRequired(
+      Reason explicit_reason = Reason::Irrelevant);
+
+  RenderWidgetHostViewAura* rwhva() const { return rwhva_; }
+  content::WebContents* web_contents() const;
+
  private:
   enum SelectionMode {
     None = 0,
@@ -145,16 +163,18 @@ class CONTENT_EXPORT SelectionControllerEfl {
 
   void HandleLongPressEventPrivate(const gfx::Point& touch_point);
 
-  void ShowHandleAndContextMenuIfRequired(Reason explicit_reason = Reason::Irrelevant);
-
   void Clear();
   bool IsSelectionValid(const gfx::Rect& left_rect, const gfx::Rect& right_rect);
 
   void ShowContextMenu();
   void CancelContextMenu(int request_id);
 
-  static void EvasParentViewMoveCallback(void *data, Evas *e, Evas_Object *obj, void *event_info)
-  { reinterpret_cast<SelectionControllerEfl*>(data)->OnParentParentViewMove(); }
+  static void EvasParentViewMoveCallback(void* data,
+                                         Evas* e,
+                                         Evas_Object* obj,
+                                         void* event_info) {
+    reinterpret_cast<SelectionControllerEfl*>(data)->OnParentParentViewMove();
+  }
 
 #if BUILDFLAG(IS_TIZEN)
   static void PlatformLanguageChanged(keynode_t* keynode, void* data);
@@ -162,20 +182,26 @@ class CONTENT_EXPORT SelectionControllerEfl {
 
   void OnParentParentViewMove();
 
-  Evas_Object* parent_view_;
+  static Eina_Bool EcoreEventFilterCallback(void* user_data,
+                                            void* loop_data,
+                                            int type,
+                                            void* event_info);
+
   // Is required to send back selction points and range extenstion co-ordinates
+  RenderWidgetHostViewAura* rwhva_;
 
   // Saves state so that selection controls are temporarily hidden due
   // to scrolling or zooming.
-  bool controls_temporarily_hidden_;
+  bool controls_temporarily_hidden_ = false;
 
   // Cache the reason of why browser has requested a text selection
   // change to the renderer. At the next composited selection update
   // the cache is handled and reset.
-  Reason selection_change_reason_;
+  Reason selection_change_reason_ = Reason::Irrelevant;
 
-  // Saves state so that handlers and context menu is not shown when seletion change event occurs.
-  bool long_mouse_press_;
+  // Saves state so that handlers and context menu is not shown when seletion
+  // change event occurs.
+  bool long_mouse_press_ = false;
 
   // Saves the data that are required to draw handle and context menu
   std::unique_ptr<SelectionBoxEfl> selection_data_;
@@ -198,13 +224,18 @@ class CONTENT_EXPORT SelectionControllerEfl {
   // Helper pointer to the stationary handle (during dragging).
   SelectionHandleEfl* stationary_handle_;
 
-  bool is_selection_visible_;
+  gfx::Rect custom_visible_view_rect_;
+
+  bool is_selection_visible_ = false;
+
+  bool handle_being_dragged_ = false;
 
-  bool handle_being_dragged_;
+  bool is_caret_mode_forced_ = false;
+  bool selection_on_empty_form_control_ = false;
 
-  bool selection_on_empty_form_control_;
+  Ecore_Event_Filter* ecore_events_filter_ = nullptr;
 
-  WebContents& web_contents_;
+  SelectionHandleEfl* dragged_handle_ = nullptr;
 
   enum SelectionMode selection_mode_;
   gfx::SelectionBound start_selection_;