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

Unified Diff: ui/compositor/overscroll/ui_input_handler.cc

Issue 2194833002: Overscroll and Elasticity for views::ScrollView Base URL: https://chromium.googlesource.com/chromium/src.git@20160728-MacViews-RouteThroughInputHandler
Patch Set: Restore functionality and fix bugs \o/ Created 4 years, 1 month 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
« no previous file with comments | « ui/compositor/overscroll/ui_input_handler.h ('k') | ui/events/blink/input_handler_proxy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/overscroll/ui_input_handler.cc
diff --git a/ui/compositor/overscroll/ui_input_handler.cc b/ui/compositor/overscroll/ui_input_handler.cc
index 76e7e9018573f3410d70435c64eafbe698f46f9f..2564a639370742674401de9bc5866d0866294160 100644
--- a/ui/compositor/overscroll/ui_input_handler.cc
+++ b/ui/compositor/overscroll/ui_input_handler.cc
@@ -46,11 +46,15 @@ void UIInputHandler::WillShutdown() {
input_handler_ = nullptr;
}
-void UIInputHandler::Animate(base::TimeTicks time) {}
+void UIInputHandler::Animate(base::TimeTicks time) {
+ scroll_elasticity_controller_.Animate(time);
+}
void UIInputHandler::MainThreadHasStoppedFlinging() {}
-void UIInputHandler::ReconcileElasticOverscrollAndRootScroll() {}
+void UIInputHandler::ReconcileElasticOverscrollAndRootScroll() {
+ scroll_elasticity_controller_.ReconcileStretchAndScroll();
+}
void UIInputHandler::UpdateRootLayerStateForSynchronousInputHandler(
const gfx::ScrollOffset& total_scroll_offset,
@@ -64,12 +68,30 @@ void UIInputHandler::HandleScrollUpdate(const ScrollEvent& scroll,
cc::ElementId element) {
cc::ScrollState scroll_state = CreateScrollState(scroll, false);
scroll_state.data()->set_current_native_scrolling_element(element);
- input_handler_->ScrollBy(&scroll_state);
+ cc::InputHandlerScrollResult result = input_handler_->ScrollBy(&scroll_state);
+
+ base::WeakPtr<cc::ScrollElasticityHelper> overscroll_helper =
+ input_handler_->ScrollElasticityHelperForScrollingLayer();
+ if (!overscroll_helper)
+ return; // E.g., the scrolling layer doesn't support overscroll.
+
+ scroll_elasticity_controller_.SetActiveHelper(overscroll_helper);
+
+ gfx::Vector2dF event_delta(scroll_state.delta_x(), scroll_state.delta_y());
+ bool begin = scroll.momentum_phase() == EventMomentumPhase::MAY_BEGIN;
+ bool momentum_begin = event_delta.IsZero() &&
+ scroll.momentum_phase() == EventMomentumPhase::INERTIAL_UPDATE;
+
+ scroll_elasticity_controller_.ObserveRealScrollBegin(momentum_begin, begin);
+ scroll_elasticity_controller_.ObserveScrollUpdate(
+ event_delta, result.unused_scroll_delta, scroll.time_stamp(),
+ scroll_state.is_in_inertial_phase());
}
void UIInputHandler::HandleScrollEnd(const ScrollEvent& scroll) {
cc::ScrollState scroll_state = CreateScrollState(scroll, true);
input_handler_->ScrollEnd(&scroll_state);
+ scroll_elasticity_controller_.ObserveRealScrollEnd(scroll.time_stamp());
}
} // namespace ui
« no previous file with comments | « ui/compositor/overscroll/ui_input_handler.h ('k') | ui/events/blink/input_handler_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698