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

Unified Diff: cc/layer_tree_host_impl.cc

Issue 12408028: cc: Delay start of scrollbar animation setNeedsRedraw. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to 188682 Created 7 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
« no previous file with comments | « cc/layer_tree_host_impl.h ('k') | cc/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/layer_tree_host_impl.cc
diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc
index 32290c44076e0ed3b2d96ffd8c25dd3f4409f5b6..327070275493216f45886cbb563e5992d83e2b8f 100644
--- a/cc/layer_tree_host_impl.cc
+++ b/cc/layer_tree_host_impl.cc
@@ -1392,7 +1392,7 @@ InputHandlerClient::ScrollStatus LayerTreeHostImpl::ScrollBegin(
}
if (potentially_scrolling_layer_impl) {
- active_tree_->set_currently_scrolling_layer(
+ active_tree_->SetCurrentlyScrollingLayer(
potentially_scrolling_layer_impl);
should_bubble_scrolls_ = (type != NonBubblingGesture);
wheel_scrolling_ = (type == Wheel);
@@ -1534,7 +1534,7 @@ bool LayerTreeHostImpl::ScrollBy(gfx::Point viewport_point,
did_scroll = true;
did_lock_scrolling_layer_ = true;
if (!should_bubble_scrolls_) {
- active_tree_->set_currently_scrolling_layer(layer_impl);
+ active_tree_->SetCurrentlyScrollingLayer(layer_impl);
break;
}
@@ -1576,6 +1576,7 @@ void LayerTreeHostImpl::ScrollEnd() {
top_controls_manager_->ScrollEnd();
ClearCurrentlyScrollingLayer();
active_tree()->DidEndScroll();
+ StartScrollbarAnimation(base::TimeTicks::Now());
}
void LayerTreeHostImpl::PinchGestureBegin() {
@@ -1608,11 +1609,6 @@ void LayerTreeHostImpl::PinchGestureUpdate(float magnify_delta,
RootScrollLayer()->ScrollBy(move);
- if (RootScrollLayer()->scrollbar_animation_controller()) {
- RootScrollLayer()->scrollbar_animation_controller()->
- didPinchGestureUpdate(base::TimeTicks::Now());
- }
-
client_->SetNeedsCommitOnImplThread();
client_->SetNeedsRedrawOnImplThread();
client_->RenewTreePriority();
@@ -1620,13 +1616,6 @@ void LayerTreeHostImpl::PinchGestureUpdate(float magnify_delta,
void LayerTreeHostImpl::PinchGestureEnd() {
pinch_gesture_active_ = false;
-
- if (RootScrollLayer() &&
- RootScrollLayer()->scrollbar_animation_controller()) {
- RootScrollLayer()->scrollbar_animation_controller()->
- didPinchGestureEnd(base::TimeTicks::Now());
- }
-
client_->SetNeedsCommitOnImplThread();
}
@@ -1855,13 +1844,40 @@ void LayerTreeHostImpl::AnimateScrollbarsRecursive(LayerImpl* layer,
ScrollbarAnimationController* scrollbar_controller =
layer->scrollbar_animation_controller();
- if (scrollbar_controller && scrollbar_controller->animate(time))
+ if (scrollbar_controller && scrollbar_controller->animate(time)) {
+ TRACE_EVENT_INSTANT0(
+ "cc", "LayerTreeHostImpl::SetNeedsRedraw due to AnimateScrollbars");
client_->SetNeedsRedrawOnImplThread();
+ }
for (size_t i = 0; i < layer->children().size(); ++i)
AnimateScrollbarsRecursive(layer->children()[i], time);
}
+void LayerTreeHostImpl::StartScrollbarAnimation(base::TimeTicks time) {
+ TRACE_EVENT0("cc", "LayerTreeHostImpl::StartScrollbarAnimation");
+ StartScrollbarAnimationRecursive(RootLayer(), time);
+}
+
+void LayerTreeHostImpl::StartScrollbarAnimationRecursive(LayerImpl* layer,
+ base::TimeTicks time) {
+ if (!layer)
+ return;
+
+ ScrollbarAnimationController* scrollbar_controller =
+ layer->scrollbar_animation_controller();
+ if (scrollbar_controller && scrollbar_controller->isAnimating()) {
+ base::TimeDelta delay = scrollbar_controller->delayBeforeStart(time);
+ if (delay > base::TimeDelta())
+ client_->RequestScrollbarAnimationOnImplThread(delay);
+ else if (scrollbar_controller->animate(time))
+ client_->SetNeedsRedrawOnImplThread();
+ }
+
+ for (size_t i = 0; i < layer->children().size(); ++i)
+ StartScrollbarAnimationRecursive(layer->children()[i], time);
+}
+
void LayerTreeHostImpl::SetTreePriority(TreePriority priority) {
if (!tile_manager_)
return;
« no previous file with comments | « cc/layer_tree_host_impl.h ('k') | cc/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698