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

Unified Diff: cc/trees/layer_tree_impl.cc

Issue 2770733002: Reland of Show Overlay Scrollbar when GestureScrollUpdate (Closed)
Patch Set: fix for gpu memory issue Created 3 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/trees/layer_tree_host_impl_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_impl.cc
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc
index 8a89c8504f5698093ef436ff2f3afafdc92a5b35..59ce942f5476e440b8a3e4611b1ceba2c11a396c 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -243,27 +243,31 @@ void LayerTreeImpl::UpdateScrollbars(int scroll_layer_id, int clip_layer_id) {
}
bool scrollbar_needs_animation = false;
+ bool clip_layer_size_did_change = false;
bool scroll_layer_size_did_change = false;
bool y_offset_did_change = false;
for (ScrollbarLayerImplBase* scrollbar : ScrollbarsFor(scroll_layer_id)) {
if (scrollbar->orientation() == HORIZONTAL) {
scrollbar_needs_animation |= scrollbar->SetCurrentPos(current_offset.x());
- scrollbar_needs_animation |=
+ clip_layer_size_did_change |=
scrollbar->SetClipLayerLength(clip_size.width());
- scrollbar_needs_animation |= scroll_layer_size_did_change |=
+ scroll_layer_size_did_change |=
scrollbar->SetScrollLayerLength(scroll_size.width());
} else {
scrollbar_needs_animation |= y_offset_did_change |=
scrollbar->SetCurrentPos(current_offset.y());
- scrollbar_needs_animation |=
+ clip_layer_size_did_change |=
scrollbar->SetClipLayerLength(clip_size.height());
- scrollbar_needs_animation |= scroll_layer_size_did_change |=
+ scroll_layer_size_did_change |=
scrollbar->SetScrollLayerLength(scroll_size.height());
}
scrollbar_needs_animation |=
scrollbar->SetVerticalAdjust(clip_layer->bounds_delta().y());
}
+ scrollbar_needs_animation |=
+ (clip_layer_size_did_change || scroll_layer_size_did_change);
+
if (y_offset_did_change && IsViewportLayerId(scroll_layer_id))
TRACE_COUNTER_ID1("cc", "scroll_offset_y", scroll_layer->id(),
current_offset.y());
@@ -272,8 +276,16 @@ void LayerTreeImpl::UpdateScrollbars(int scroll_layer_id, int clip_layer_id) {
ScrollbarAnimationController* controller =
layer_tree_host_impl_->ScrollbarAnimationControllerForId(
scroll_layer_id);
- if (controller)
- controller->DidScrollUpdate(scroll_layer_size_did_change);
+ if (!controller)
+ return;
+
+ // TODO(chaopeng) clip_layer_size_did_change should call DidResize after
+ // crbug.com/701810 got fixed.
+ if (scroll_layer_size_did_change) {
+ controller->DidResize();
+ } else {
+ controller->DidScrollUpdate();
+ }
}
}
« no previous file with comments | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698