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

Side by Side Diff: ui/events/gesture_detection/gesture_provider.cc

Issue 660173002: Type conversion fixes, ui/ edition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 2 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 unified diff | Download patch
« no previous file with comments | « ui/events/event.cc ('k') | ui/events/gesture_detection/velocity_tracker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/events/gesture_detection/gesture_provider.h" 5 #include "ui/events/gesture_detection/gesture_provider.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 274
275 virtual bool OnScroll(const MotionEvent& e1, 275 virtual bool OnScroll(const MotionEvent& e1,
276 const MotionEvent& e2, 276 const MotionEvent& e2,
277 float raw_distance_x, 277 float raw_distance_x,
278 float raw_distance_y) override { 278 float raw_distance_y) override {
279 float distance_x = raw_distance_x; 279 float distance_x = raw_distance_x;
280 float distance_y = raw_distance_y; 280 float distance_y = raw_distance_y;
281 if (!scroll_event_sent_) { 281 if (!scroll_event_sent_) {
282 // Remove the touch slop region from the first scroll event to avoid a 282 // Remove the touch slop region from the first scroll event to avoid a
283 // jump. 283 // jump.
284 double distance = 284 float distance =
285 std::sqrt(distance_x * distance_x + distance_y * distance_y); 285 std::sqrt(distance_x * distance_x + distance_y * distance_y);
286 double epsilon = 1e-3; 286 float epsilon = 1e-3f;
287 if (distance > epsilon) { 287 if (distance > epsilon) {
288 double ratio = 288 float ratio =
289 std::max(0., 289 std::max(0.f,
290 distance - config_.gesture_detector_config.touch_slop) / 290 distance - config_.gesture_detector_config.touch_slop) /
291 distance; 291 distance;
292 distance_x *= ratio; 292 distance_x *= ratio;
293 distance_y *= ratio; 293 distance_y *= ratio;
294 } 294 }
295 295
296 // Note that scroll start hints are in distance traveled, where 296 // Note that scroll start hints are in distance traveled, where
297 // scroll deltas are in the opposite direction. 297 // scroll deltas are in the opposite direction.
298 GestureEventDetails scroll_details( 298 GestureEventDetails scroll_details(
299 ET_GESTURE_SCROLL_BEGIN, -raw_distance_x, -raw_distance_y); 299 ET_GESTURE_SCROLL_BEGIN, -raw_distance_x, -raw_distance_y);
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 // null'ing of the listener until the sequence has ended. 813 // null'ing of the listener until the sequence has ended.
814 if (current_down_event_) 814 if (current_down_event_)
815 return; 815 return;
816 816
817 const bool double_tap_enabled = 817 const bool double_tap_enabled =
818 double_tap_support_for_page_ && double_tap_support_for_platform_; 818 double_tap_support_for_page_ && double_tap_support_for_platform_;
819 gesture_listener_->SetDoubleTapEnabled(double_tap_enabled); 819 gesture_listener_->SetDoubleTapEnabled(double_tap_enabled);
820 } 820 }
821 821
822 } // namespace ui 822 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/event.cc ('k') | ui/events/gesture_detection/velocity_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698