Simplify SelectionControllerEfl::OnMouseDown
authorAntonio Gomes <a1.gomes@samsung.com>
Wed, 19 Aug 2015 14:42:28 +0000 (10:42 -0400)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 06:57:09 +0000 (06:57 +0000)
By passing the SelectionHandleEfl object as a parameter
instead of its type, we can greatly simplify this method.

Original beta/m42 patch:
- http://165.213.202.130/gerrit/#/c/85427/ , reviewed by
Janusz Majnert and Arnaud Renevier.

Bug: http://107.108.218.239/bugzilla/show_bug.cgi?id=14304

Reviewed by: arno renevier, Janusz Majnert

Change-Id: I39617552aca386078d8ed110add788be650c5bdd
Signed-off-by: Antonio Gomes <a1.gomes@samsung.com>
tizen_src/chromium_impl/content/browser/selection/selection_controller_efl.cc
tizen_src/chromium_impl/content/browser/selection/selection_controller_efl.h
tizen_src/chromium_impl/content/browser/selection/selection_handle_efl.cc

index 68917da..c6ba17f 100644 (file)
@@ -396,8 +396,8 @@ bool SelectionControllerEfl::IsShowingMagnifier() {
   return false;
 }
 
-void SelectionControllerEfl::OnMouseDown(const gfx::Point& touch_point,
-    SelectionHandleEfl::HandleType handle) {
+void SelectionControllerEfl::OnMouseDown(
+    const gfx::Point& touch_point, SelectionHandleEfl* handle) {
   // Hide context menu on mouse down
   show_only_large_handle_ = false;
   CancelContextMenu(0);
@@ -406,24 +406,9 @@ void SelectionControllerEfl::OnMouseDown(const gfx::Point& touch_point,
 
   Evas_Coord x, y;
   evas_object_geometry_get(parent_view_, &x, &y, 0, 0);
-  gfx::Point magnifier_point;
-
-  switch (handle) {
-    case SelectionHandleEfl::HANDLE_TYPE_INPUT:
-      magnifier_point.set_x(input_handle_->GetBasePosition().x() + x);
-      magnifier_point.set_y(input_handle_->GetBasePosition().y() + y);
-      break;
-
-    case SelectionHandleEfl::HANDLE_TYPE_LEFT:
-      magnifier_point.set_x(start_handle_->GetBasePosition().x() + x);
-      magnifier_point.set_y(start_handle_->GetBasePosition().y() + y);
-      break;
-
-    case SelectionHandleEfl::HANDLE_TYPE_RIGHT:
-      magnifier_point.set_x(end_handle_->GetBasePosition().x() + x);
-      magnifier_point.set_y(end_handle_->GetBasePosition().y() + y);
-      break;
-  }
+  gfx::Point magnifier_point(
+      handle->GetBasePosition().x() + x,
+      handle->GetBasePosition().y() + y);
 
   magnifier_->UpdateLocation(magnifier_point);
   magnifier_->Move(magnifier_point);
index e9dacc1..0287d38 100644 (file)
@@ -77,7 +77,7 @@ class CONTENT_EXPORT SelectionControllerEfl {
       const gfx::Rect& right_rect, bool is_anchor_first, bool show = true);
   void GetSelectionBounds(gfx::Rect* left, gfx::Rect* right);
   // Handles the mouse press,move and relase events on selection handles
-  void OnMouseDown(const gfx::Point& touch_point, SelectionHandleEfl::HandleType);
+  void OnMouseDown(const gfx::Point& touch_point, SelectionHandleEfl*);
   void OnMouseMove(const gfx::Point& touch_point, SelectionHandleEfl::HandleType);
   void OnMouseUp(const gfx::Point& touch_point);
 
index a07dbf1..faaa33c 100644 (file)
@@ -105,7 +105,7 @@ void SelectionHandleEfl::OnMouseDown(void* data, Evas*, Evas_Object*, void* even
   handle->base_point_.SetPoint(delta_x, delta_y);
 
   handle->controller_.OnMouseDown(
-      gfx::Point(event->canvas.x , event->canvas.y ), handle->handle_type_);
+      gfx::Point(event->canvas.x , event->canvas.y), handle);
 }
 
 void SelectionHandleEfl::OnMouseMove(void* data, Evas*, Evas_Object*, void* event_info) {