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

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: Add more test expectations 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
Index: cc/layer_tree_host_impl.cc
diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc
index 089107401780114519a3e78a55b6554cc190772a..d6acf0633a13686dc1fca7da05d44101fa14361a 100644
--- a/cc/layer_tree_host_impl.cc
+++ b/cc/layer_tree_host_impl.cc
@@ -1387,7 +1387,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);
@@ -1528,7 +1528,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;
}
@@ -1568,6 +1568,7 @@ void LayerTreeHostImpl::ScrollEnd() {
if (top_controls_manager_)
top_controls_manager_->ScrollEnd();
ClearCurrentlyScrollingLayer();
+ StartScrollbarAnimation(base::TimeTicks::Now());
}
void LayerTreeHostImpl::PinchGestureBegin() {
@@ -1600,11 +1601,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();
@@ -1612,13 +1608,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();
}
@@ -1847,13 +1836,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;

Powered by Google App Engine
This is Rietveld 408576698