Only show selection handles when scrolling/flinging has stopped.
authorAntonio Gomes <a1.gomes@samsung.com>
Thu, 19 Feb 2015 16:58:11 +0000 (12:58 -0400)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 06:57:09 +0000 (06:57 +0000)
In text selection mode, handles and magnifier glance controls
are hidden while scrolling. That involves the two main scroll cases:

- user is flinging, i.e. kinetic scrolling;
- user is panning, i.e. dragging the page content around
  without lifting his finger off the screen.

In our current implementation, the following case is broken:
- load a scrollable page and enter text selection mode (by
long press, for example).
- start kinetic scroll the page

One will notice that when he lifts off his finger from the screen
text selection controls are prematurely shown while scrolling is
still active, and it becomes junky.

This happens because when user lifts off his finger a GESTURE_END type
of event is emitted and handled by RWHVEfl::HandleGestureEnd. There,
it is assumed to mean "scroll has stopped, and text selection controls
can be shown". Although it covers the panning case well, it fails for
the flinging case.

Patch fix this by moving the panning-stop code from ::HandleGestureEnd
to ::HandleGesture, when a 'ScrollEnd' type of event is emitted.
The kinetic scrolling case is then alread properly handled by the
RenderWidgetHostView hook named 'DidStopFling'.

Bug: http://web.sec.samsung.net/bugzilla/show_bug.cgi?id=8773
Reviewed by: Piotr Grad, Piotr Tworek, arno renevier

Change-Id: I2ac1569ebf3a7812c5ae71b17aa11decbf5a5c9d

tizen_src/impl/browser/renderer_host/render_widget_host_view_efl.cc

index dbc631d..10acbd4 100644 (file)
@@ -1395,24 +1395,12 @@ void RenderWidgetHostViewEfl::HandleGestureBegin() {
 
 void RenderWidgetHostViewEfl::HandleGestureEnd() {
   if (GetSelectionController()) {
-    if (GetSelectionController()->GetScrollStatus())
-      GetSelectionController()->SetScrollStatus(false);
-
     if (should_restore_selection_menu_ && !was_scrolled_ &&
         !selection_acked_on_tap_ &&
         !(single_tap_performed_ &&
           GetSelectionController()->GetSelectionEditable())) {
       should_restore_selection_menu_ = false;
       GetSelectionController()->HideHandleAndContextMenu();
-    } else if (GetSelectionController()->GetSelectionStatus()) {
-      GetSelectionController()->SetShowOnlyLargeHandler(
-          single_tap_performed_ || restore_showing_large_handler_);
-
-      GetSelectionController()->UpdateSelectionDataAndShow(
-          GetSelectionController()->GetLeftRect(),
-          GetSelectionController()->GetRightRect(),
-          false /* unused */,
-          should_restore_selection_menu_);
     }
   }
   single_tap_performed_ = false;
@@ -1490,6 +1478,22 @@ void RenderWidgetHostViewEfl::HandleGesture(
     was_scrolled_ = true;
     if (GetSelectionController())
       GetSelectionController()->SetScrollStatus(true);
+  } else if (event.type == blink::WebInputEvent::GestureScrollEnd) {
+    if (GetSelectionController()) {
+      if (GetSelectionController()->GetScrollStatus())
+        GetSelectionController()->SetScrollStatus(false);
+
+      if (GetSelectionController()->GetSelectionStatus()) {
+        GetSelectionController()->SetShowOnlyLargeHandler(
+            single_tap_performed_ || restore_showing_large_handler_);
+
+        GetSelectionController()->UpdateSelectionDataAndShow(
+            GetSelectionController()->GetLeftRect(),
+            GetSelectionController()->GetRightRect(),
+            false /* unused */,
+            should_restore_selection_menu_);
+      }
+    }
   } else if (web_view_ && event.type == blink::WebInputEvent::GestureScrollUpdate) {
 #ifdef TIZEN_EDGE_EFFECT
     if (event.data.scrollUpdate.deltaX < 0)