Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Unified Diff: content/browser/renderer_host/input/touch_event_queue.cc

Issue 220063002: [Android] Use DIP coordinates with MotionEventAndroid (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More fixes Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/input/touch_event_queue.cc
diff --git a/content/browser/renderer_host/input/touch_event_queue.cc b/content/browser/renderer_host/input/touch_event_queue.cc
index a6d8729f49c23f8df07303ebe487928a28d8cbb8..3251446a5c80f6b4a6284d912fc2aad869b66560 100644
--- a/content/browser/renderer_host/input/touch_event_queue.cc
+++ b/content/browser/renderer_host/input/touch_event_queue.cc
@@ -21,6 +21,11 @@ using ui::LatencyInfo;
namespace content {
namespace {
+// Using a small epsilon when comparing slop distances allows pixel perfect
+// slop determination when using fractional DPI coordinates (assuming the slop
tdresser 2014/04/09 14:00:01 fractional DPI -> fractional DIP
jdduke (slow) 2014/04/10 22:04:53 Done.
+// region and DPI scale are reasonably proportioned).
+const float SLOP_EPSILON = .05f;
+
typedef std::vector<TouchEventWithLatencyInfo> WebTouchEventWithLatencyList;
TouchEventWithLatencyInfo ObtainCancelEventForTouchEvent(
@@ -167,6 +172,8 @@ class TouchEventQueue::TouchTimeoutHandler {
// Provides touchmove slop suppression for a single touch that remains within
// a given slop region, unless the touchstart is preventDefault'ed.
+// TODO(jdduke): Use a flag bundled with each TouchEvent declaring whether it
+// has exceeded the slop region, removing duplicated slop determination logic.
class TouchEventQueue::TouchMoveSlopSuppressor {
public:
TouchMoveSlopSuppressor(double slop_suppression_length_dips)
@@ -288,8 +295,8 @@ TouchEventQueue::TouchEventQueue(TouchEventQueueClient* client,
dispatching_touch_(false),
touch_filtering_state_(TOUCH_FILTERING_STATE_DEFAULT),
ack_timeout_enabled_(false),
- touchmove_slop_suppressor_(
- new TouchMoveSlopSuppressor(touchmove_suppression_length_dips)),
+ touchmove_slop_suppressor_(new TouchMoveSlopSuppressor(
+ touchmove_suppression_length_dips + SLOP_EPSILON)),
absorbing_touch_moves_(false),
touch_scrolling_mode_(mode) {
DCHECK(client);

Powered by Google App Engine
This is Rietveld 408576698