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

Unified Diff: cc/layers/layer_impl.cc

Issue 571873003: [Android]Optimization of scrollbar animation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | « no previous file | cc/layers/scrollbar_layer_impl_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/layer_impl.cc
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc
index 5b39eb0e36262c2299be2fd73522def8ab8c897c..5c9eada05addd2181ad8ea1a5d9a46a83d15bff2 100644
--- a/cc/layers/layer_impl.cc
+++ b/cc/layers/layer_impl.cc
@@ -1275,17 +1275,25 @@ void LayerImpl::SetScrollbarPosition(ScrollbarLayerImplBase* scrollbar_layer,
current_offset.Scale(layer_tree_impl()->total_page_scale_factor());
}
- scrollbar_layer->SetVerticalAdjust(scrollbar_clip_layer->bounds_delta().y());
+ bool scrollbar_needs_animation = false;
+ scrollbar_needs_animation |= scrollbar_layer->SetVerticalAdjust(
+ scrollbar_clip_layer->bounds_delta().y());
if (scrollbar_layer->orientation() == HORIZONTAL) {
float visible_ratio = clip_rect.width() / scroll_rect.width();
- scrollbar_layer->SetCurrentPos(current_offset.x());
- scrollbar_layer->SetMaximum(scroll_rect.width() - clip_rect.width());
- scrollbar_layer->SetVisibleToTotalLengthRatio(visible_ratio);
+ scrollbar_needs_animation |=
+ scrollbar_layer->SetCurrentPos(current_offset.x());
+ scrollbar_needs_animation |=
+ scrollbar_layer->SetMaximum(scroll_rect.width() - clip_rect.width());
+ scrollbar_needs_animation |=
+ scrollbar_layer->SetVisibleToTotalLengthRatio(visible_ratio);
} else {
float visible_ratio = clip_rect.height() / scroll_rect.height();
- scrollbar_layer->SetCurrentPos(current_offset.y());
- scrollbar_layer->SetMaximum(scroll_rect.height() - clip_rect.height());
- scrollbar_layer->SetVisibleToTotalLengthRatio(visible_ratio);
+ scrollbar_needs_animation |=
+ scrollbar_layer->SetCurrentPos(current_offset.y());
+ scrollbar_needs_animation |=
+ scrollbar_layer->SetMaximum(scroll_rect.height() - clip_rect.height());
+ scrollbar_needs_animation |=
+ scrollbar_layer->SetVisibleToTotalLengthRatio(visible_ratio);
}
layer_tree_impl()->set_needs_update_draw_properties();
danakj 2014/09/22 14:41:25 Maybe for a follow up, but what happens if you als
@@ -1293,7 +1301,7 @@ void LayerImpl::SetScrollbarPosition(ScrollbarLayerImplBase* scrollbar_layer,
// activate for every scroll on the main frame, not just the scrolls that move
// the pinch virtual viewport (i.e. trigger from either inner or outer
// viewport).
- if (scrollbar_animation_controller_) {
+ if (scrollbar_animation_controller_ && scrollbar_needs_animation) {
// When both non-overlay and overlay scrollbars are both present, don't
// animate the overlay scrollbars when page scale factor is at the min.
// Non-overlay scrollbars also shouldn't trigger animations.
« no previous file with comments | « no previous file | cc/layers/scrollbar_layer_impl_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698