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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 1063853005: Unify Android Webview and Chrome's fling (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@master
Patch Set: add proguard Created 5 years, 6 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
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_impl.cc
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 6dc9043559c3df4eeb2c286e7b6baf4f1f2dbecf..8f15e8804fb23dde9040a76ca707c2aafc1e8f4a 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -402,8 +402,11 @@ void LayerTreeHostImpl::Animate(base::TimeTicks monotonic_time) {
// DCHECK(!current_begin_frame_tracker_.HasFinished());
// DCHECK(monotonic_time == current_begin_frame_tracker_.Current().frame_time)
// << "Called animate with unknown frame time!?";
- if (input_handler_client_)
- input_handler_client_->Animate(monotonic_time);
+ if (!root_layer_scroll_offset_delegate_ ||
+ (CurrentlyScrollingLayer() != InnerViewportScrollLayer() &&
+ CurrentlyScrollingLayer() != OuterViewportScrollLayer())) {
+ AnimateInput(monotonic_time);
+ }
AnimatePageScale(monotonic_time);
AnimateLayers(monotonic_time);
AnimateScrollbars(monotonic_time);
@@ -462,6 +465,22 @@ void LayerTreeHostImpl::StartPageScaleAnimation(
client_->RenewTreePriority();
}
+void LayerTreeHostImpl::SetNeedsAnimateInput() {
+ if (root_layer_scroll_offset_delegate_ &&
+ (CurrentlyScrollingLayer() == InnerViewportScrollLayer() ||
+ CurrentlyScrollingLayer() == OuterViewportScrollLayer())) {
+ if (root_layer_animation_callback_.is_null()) {
+ root_layer_animation_callback_ =
+ base::Bind(&LayerTreeHostImpl::AnimateInput, AsWeakPtr());
+ }
+ root_layer_scroll_offset_delegate_->SetNeedsAnimate(
+ root_layer_animation_callback_);
+ return;
+ }
+
+ SetNeedsAnimate();
+}
+
bool LayerTreeHostImpl::IsCurrentlyScrollingLayerAt(
const gfx::Point& viewport_point,
InputHandler::ScrollInputType type) {
@@ -1824,9 +1843,9 @@ LayerImpl* LayerTreeHostImpl::CurrentlyScrollingLayer() const {
bool LayerTreeHostImpl::IsActivelyScrolling() const {
return (did_lock_scrolling_layer_ && CurrentlyScrollingLayer()) ||
(InnerViewportScrollLayer() &&
- InnerViewportScrollLayer()->IsExternalFlingActive()) ||
+ InnerViewportScrollLayer()->IsExternalScrollActive()) ||
(OuterViewportScrollLayer() &&
- OuterViewportScrollLayer()->IsExternalFlingActive());
+ OuterViewportScrollLayer()->IsExternalScrollActive());
}
// Content layers can be either directly scrollable or contained in an outer
@@ -2804,13 +2823,6 @@ InputHandler::ScrollStatus LayerTreeHostImpl::FlingScrollBegin() {
if (!active_tree_->CurrentlyScrollingLayer())
return SCROLL_IGNORED;
- if (settings_.ignore_root_layer_flings &&
- (active_tree_->CurrentlyScrollingLayer() == InnerViewportScrollLayer() ||
- active_tree_->CurrentlyScrollingLayer() == OuterViewportScrollLayer())) {
- ClearCurrentlyScrollingLayer();
- return SCROLL_IGNORED;
- }
-
if (!wheel_scrolling_) {
// Allow the fling to lock to the first layer that moves after the initial
// fling |ScrollBy()| event.
@@ -3043,6 +3055,12 @@ void LayerTreeHostImpl::ScrollViewportBy(gfx::Vector2dF scroll_delta) {
InnerViewportScrollLayer()->ScrollBy(unused_delta);
}
+void LayerTreeHostImpl::AnimateInput(base::TimeTicks monotonic_time) {
+ DCHECK(proxy_->IsImplThread());
+ if (input_handler_client_)
+ input_handler_client_->Animate(monotonic_time);
+}
+
void LayerTreeHostImpl::AnimatePageScale(base::TimeTicks monotonic_time) {
if (!page_scale_animation_)
return;
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698