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

Unified Diff: cc/trees/layer_tree_impl.cc

Issue 2611013002: Show Overlay Scrollbar when GestureScrollUpdate (Closed)
Patch Set: rebase & merge 2716453005 & fix tests Created 3 years, 10 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/trees/layer_tree_impl.cc
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc
index 7c338a4f8ec0e094768027c90fdfaa58fddb2515..fbe2261e5cbd56ab6ed11a80d96e3ba3e6c3f8da 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -242,19 +242,20 @@ 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 |=
+ scrollbar_needs_animation |= clip_layer_size_did_change |=
bokan 2017/02/27 23:34:17 Nit: separate this into separate lines.
chaopeng 2017/02/28 01:51:12 This is formatted by clang-format.
bokan 2017/02/28 14:16:07 I mean separate statements. Turn it in to this: c
scrollbar->SetClipLayerLength(clip_size.width());
scrollbar_needs_animation |= 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 |=
+ scrollbar_needs_animation |= clip_layer_size_did_change |=
scrollbar->SetClipLayerLength(clip_size.height());
scrollbar_needs_animation |= scroll_layer_size_did_change |=
scrollbar->SetScrollLayerLength(scroll_size.height());
@@ -271,8 +272,14 @@ 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;
+
+ if (clip_layer_size_did_change || scroll_layer_size_did_change) {
+ controller->DidResize();
+ } else {
+ controller->WillUpdateScroll();
+ }
}
}
« cc/trees/layer_tree_host_impl_unittest.cc ('K') | « 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