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

Unified Diff: ui/events/blink/input_scroll_elasticity_controller.cc

Issue 1749343004: Implement Wheel Gesture Scrolling on OSX. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ensure only high precision scroll begins are used Created 4 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: ui/events/blink/input_scroll_elasticity_controller.cc
diff --git a/ui/events/blink/input_scroll_elasticity_controller.cc b/ui/events/blink/input_scroll_elasticity_controller.cc
index d063093cc266a0d135c3ff0ac37c0a63e7a9e870..dedf7de60d55e7147b5cd4a639981dbce70e2609 100644
--- a/ui/events/blink/input_scroll_elasticity_controller.cc
+++ b/ui/events/blink/input_scroll_elasticity_controller.cc
@@ -167,6 +167,71 @@ void InputScrollElasticityController::ObserveWheelEventAndResult(
}
}
+void InputScrollElasticityController::ObserveGestureEventAndResult(
+ const blink::WebGestureEvent& gesture_event,
+ const cc::InputHandlerScrollResult& scroll_result) {
+ base::TimeTicks event_timestamp =
+ base::TimeTicks() +
+ base::TimeDelta::FromSecondsD(gesture_event.timeStampSeconds);
+
+ switch (gesture_event.type) {
+ case blink::WebInputEvent::GestureScrollBegin: {
+ if (gesture_event.data.scrollBegin.synthetic)
+ return;
+ if (gesture_event.data.scrollBegin.inertial) {
+ if (state_ == kStateInactive)
+ state_ = kStateMomentumScroll;
+ } else if (gesture_event.data.scrollBegin.deltaHintUnits ==
+ blink::WebGestureEvent::PrecisePixels) {
+ scroll_velocity = gfx::Vector2dF();
+ last_scroll_event_timestamp_ = base::TimeTicks();
+ state_ = kStateActiveScroll;
+ pending_overscroll_delta_ = gfx::Vector2dF();
+ }
+ break;
+ }
+ case blink::WebInputEvent::GestureScrollUpdate: {
+ gfx::Vector2dF event_delta(-gesture_event.data.scrollUpdate.deltaX,
+ -gesture_event.data.scrollUpdate.deltaY);
+ switch (state_) {
+ case kStateMomentumAnimated:
+ case kStateInactive:
+ break;
+ case kStateActiveScroll:
+ case kStateMomentumScroll:
+ UpdateVelocity(event_delta, event_timestamp);
+ Overscroll(event_delta, scroll_result.unused_scroll_delta);
+ if (gesture_event.data.scrollUpdate.inertial &&
+ !helper_->StretchAmount().IsZero()) {
+ EnterStateMomentumAnimated(event_timestamp);
+ }
+ break;
+ }
+ break;
+ }
+ case blink::WebInputEvent::GestureScrollEnd: {
+ if (gesture_event.data.scrollEnd.synthetic)
+ return;
+ switch (state_) {
+ case kStateMomentumAnimated:
+ case kStateInactive:
+ break;
+ case kStateActiveScroll:
+ case kStateMomentumScroll:
+ if (helper_->StretchAmount().IsZero()) {
+ EnterStateInactive();
+ } else {
+ EnterStateMomentumAnimated(event_timestamp);
+ }
+ break;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+}
+
void InputScrollElasticityController::UpdateVelocity(
const gfx::Vector2dF& event_delta,
const base::TimeTicks& event_timestamp) {
« no previous file with comments | « ui/events/blink/input_scroll_elasticity_controller.h ('k') | ui/events/blink/input_scroll_elasticity_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698