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

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') | cc/layers/scrollbar_layer_impl_base.h » ('J')
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..c4ae48085e9c8b28ef35996c51340baf9d4293ea 100644
--- a/cc/layers/layer_impl.cc
+++ b/cc/layers/layer_impl.cc
@@ -1275,18 +1275,25 @@ void LayerImpl::SetScrollbarPosition(ScrollbarLayerImplBase* scrollbar_layer,
current_offset.Scale(layer_tree_impl()->total_page_scale_factor());
}
+ float vertical_adjust = scrollbar_clip_layer->bounds_delta().y();
bokan 2014/09/15 17:29:55 I think this should only affect the vertical scrol
+ float current_pos = (scrollbar_layer->orientation() == HORIZONTAL)
weiliangc 2014/09/15 17:14:37 nit: Prefer one if statement than three ternary op
bokan 2014/09/15 17:29:55 Agreed.
MuVen 2014/09/15 17:48:42 Done.
+ ? current_offset.x()
+ : current_offset.y();
+ int maximum = (scrollbar_layer->orientation() == HORIZONTAL)
+ ? (scroll_rect.width() - clip_rect.width())
+ : (scroll_rect.height() - clip_rect.height());
+ float visible_ratio = (scrollbar_layer->orientation() == HORIZONTAL)
bokan 2014/09/15 17:29:55 Do we need this? I think if the maximum changes th
MuVen 2014/09/15 17:48:42 if maximum changes, visible ration also changes as
+ ? (clip_rect.width() / scroll_rect.width())
+ : (clip_rect.height() / scroll_rect.height());
+
+ if (!scrollbar_layer->ScrollbarNeedsUpdate(
weiliangc 2014/09/15 17:14:37 As per comment in scrollbar_layer_impl_base file,
MuVen 2014/09/15 17:48:41 Yes i agree weiliangc, Setter functions are alread
+ vertical_adjust, current_pos, maximum, visible_ratio))
+ return;
+
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);
- } 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_layer->SetCurrentPos(current_pos);
+ scrollbar_layer->SetMaximum(maximum);
+ scrollbar_layer->SetVisibleToTotalLengthRatio(visible_ratio);
layer_tree_impl()->set_needs_update_draw_properties();
weiliangc 2014/09/15 17:14:37 The four Setter function seems to call this line w
bokan 2014/09/15 17:29:55 I think his idea is that we need to skip the DidSc
MuVen 2014/09/15 17:48:42 Yes bokan, Main idea is to skip DidScrollUpdate ca
MuVen 2014/09/15 17:48:42 Done.
MuVen 2014/09/15 17:57:07 or may be can i use LayerPropertyChanged() ??
danakj 2014/09/15 18:04:56 That's not the same thing. When something changes
// TODO(wjmaclean) The scrollbar animator for the pinch-zoom scrollbars should
« no previous file with comments | « no previous file | cc/layers/scrollbar_layer_impl_base.h » ('j') | cc/layers/scrollbar_layer_impl_base.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698