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

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

Issue 2742473002: gpu benchmarking swipe for touchpad
Patch Set: gpu benchmarking swipe for touchpad Created 3 years, 9 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/synthetic_smooth_move_gesture.cc
diff --git a/content/browser/renderer_host/input/synthetic_smooth_move_gesture.cc b/content/browser/renderer_host/input/synthetic_smooth_move_gesture.cc
index 26ad746f86b71b5d95f761f6ebe5e5cf2f5240dc..f626ecd99562fcfbb6459b848b761023e9bab71e 100644
--- a/content/browser/renderer_host/input/synthetic_smooth_move_gesture.cc
+++ b/content/browser/renderer_host/input/synthetic_smooth_move_gesture.cc
@@ -38,7 +38,8 @@ const int kDefaultSpeedInPixelsPerSec = 800;
} // namespace
SyntheticSmoothMoveGestureParams::SyntheticSmoothMoveGestureParams()
- : speed_in_pixels_s(kDefaultSpeedInPixelsPerSec),
+ : velocity(gfx::Vector2dF(0, 0)),
+ speed_in_pixels_s(kDefaultSpeedInPixelsPerSec),
prevent_fling(true),
add_slop(true) {}
@@ -177,18 +178,21 @@ void SyntheticSmoothMoveGesture::ForwardMouseWheelInputEvents(
if (!IsLastMoveSegment()) {
current_move_segment_total_delta_discrete_ = gfx::Vector2d();
ComputeNextMoveSegment();
- ForwardMouseWheelInputEvents(timestamp, target);
- } else {
+ } else if (params_.prevent_fling) {
state_ = DONE;
+ } else {
+ state_ = STOPPING;
}
}
} break;
+ case STOPPING: {
+ gfx::Vector2d velocity_discrete = FloorTowardZero(params_.velocity);
+ ForwardTouchpadFlingEvent(target, velocity_discrete, timestamp);
+ state_ = DONE;
+ } break;
case SETUP:
NOTREACHED() << "State SETUP invalid for synthetic scroll using mouse "
"wheel input.";
- case STOPPING:
- NOTREACHED() << "State STOPPING invalid for synthetic scroll using mouse "
- "wheel input.";
case DONE:
NOTREACHED()
<< "State DONE invalid for synthetic scroll using mouse wheel input.";
@@ -253,6 +257,23 @@ void SyntheticSmoothMoveGesture::ForwardMouseWheelEvent(
target->DispatchInputEventToPlatform(mouse_wheel_event);
}
+void SyntheticSmoothMoveGesture::ForwardTouchpadFlingEvent(
+ SyntheticGestureTarget* target,
+ const gfx::Vector2dF& velocity,
+ const base::TimeTicks& timestamp) const {
+ blink::WebGestureEvent fling_event =
+ SyntheticWebGestureEventBuilder::BuildFling(
+ velocity.x(), velocity.y(),
+ blink::WebGestureDevice::WebGestureDeviceTouchpad);
+
+ fling_event.x = current_move_segment_start_position_.x();
+ fling_event.y = current_move_segment_start_position_.y();
+
+ fling_event.setTimeStampSeconds(ConvertTimestampToSeconds(timestamp));
+
+ target->DispatchInputEventToPlatform(fling_event);
+}
+
void SyntheticSmoothMoveGesture::PressPoint(SyntheticGestureTarget* target,
const base::TimeTicks& timestamp) {
DCHECK_EQ(current_move_segment_, 0);

Powered by Google App Engine
This is Rietveld 408576698