Filter out events jittery for single-touch gestures.
authorSanghyup Lee <sh53.lee@samsung.com>
Fri, 4 Dec 2015 02:04:50 +0000 (11:04 +0900)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 07:55:23 +0000 (07:55 +0000)
In the majority of cases when user taps on the screen, many touch move events
are generated from platform. These unexpected touch move events cause frequent
calling seek on media player.

It looks too sensitive compared with Android browser.

This patch dispatches first move event if distance from last pressed position
exceeds scroll threshold.

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

Reviewed by: a1.gomes, sns.park

Change-Id: Ia491beb54c1cf32df78d9af8b7e7a212c7f54e61
Signed-off-by: Sanghyup Lee <sh53.lee@samsung.com>
tizen_src/chromium_impl/content/browser/renderer_host/render_widget_host_view_efl.cc
tizen_src/chromium_impl/content/browser/renderer_host/render_widget_host_view_efl.h

index 6c0c994..03fae68 100755 (executable)
@@ -190,6 +190,7 @@ RenderWidgetHostViewEfl::RenderWidgetHostViewEfl(RenderWidgetHost* widget,
     surface_id_(0),
     is_modifier_key_(false),
     touch_events_enabled_(false),
+    should_check_move_threshold_(false),
     web_contents_(web_contents),
     compositor_(NULL),
     root_layer_(new ui::Layer(ui::LAYER_SOLID_COLOR)),
@@ -1560,6 +1561,25 @@ void RenderWidgetHostViewEfl::ProcessTouchEvents() {
     evas_touch_point_list_nth_xy_get(evas_, i, &pt.x, &pt.y);
     state = evas_touch_point_list_nth_state_get(evas_, i);
 
+    // Filter out events jittery for single-touch gestures.
+    if (count == 1) {
+      if (state == EVAS_TOUCH_POINT_DOWN) {
+        should_check_move_threshold_ = true;
+        last_single_press_down_position_ = gfx::Point(pt.x, pt.y);
+      } else if (should_check_move_threshold_ &&
+                 state == EVAS_TOUCH_POINT_MOVE) {
+        gfx::Point current_point(pt.x, pt.y);
+        gfx::Vector2d diff = current_point - last_single_press_down_position_;
+
+        unsigned threshold =
+            elm_config_scroll_thumbscroll_threshold_get();
+        if (diff.LengthSquared() < threshold * threshold)
+          return;
+
+        should_check_move_threshold_ = false;
+      }
+    }
+
     ui::TouchEvent touch_event = MakeTouchEvent(pt, state, id, content_image_);
     HandleTouchEvent(&touch_event);
   }
index 094d7c4..b7a7050 100755 (executable)
@@ -402,6 +402,9 @@ class CONTENT_EXPORT RenderWidgetHostViewEfl
 
   bool touch_events_enabled_;
 
+  gfx::Point last_single_press_down_position_;
+  bool should_check_move_threshold_;
+
   // The last scroll offset of the view.
   gfx::Vector2dF last_scroll_offset_;