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

Side by Side Diff: cc/layers/layer_impl.cc

Issue 595913002: [Android] Avoid setting update_draw_properties. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed review comments 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/layers/layer_impl.h" 5 #include "cc/layers/layer_impl.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/debug/trace_event_argument.h" 8 #include "base/debug/trace_event_argument.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 1277 matching lines...) Expand 10 before | Expand all | Expand 10 after
1288 scrollbar_layer->SetVisibleToTotalLengthRatio(visible_ratio); 1288 scrollbar_layer->SetVisibleToTotalLengthRatio(visible_ratio);
1289 } else { 1289 } else {
1290 float visible_ratio = clip_rect.height() / scroll_rect.height(); 1290 float visible_ratio = clip_rect.height() / scroll_rect.height();
1291 scrollbar_needs_animation |= 1291 scrollbar_needs_animation |=
1292 scrollbar_layer->SetCurrentPos(current_offset.y()); 1292 scrollbar_layer->SetCurrentPos(current_offset.y());
1293 scrollbar_needs_animation |= 1293 scrollbar_needs_animation |=
1294 scrollbar_layer->SetMaximum(scroll_rect.height() - clip_rect.height()); 1294 scrollbar_layer->SetMaximum(scroll_rect.height() - clip_rect.height());
1295 scrollbar_needs_animation |= 1295 scrollbar_needs_animation |=
1296 scrollbar_layer->SetVisibleToTotalLengthRatio(visible_ratio); 1296 scrollbar_layer->SetVisibleToTotalLengthRatio(visible_ratio);
1297 } 1297 }
1298 1298 if (scrollbar_needs_animation) {
1299 layer_tree_impl()->set_needs_update_draw_properties(); 1299 layer_tree_impl()->set_needs_update_draw_properties();
1300 // TODO(wjmaclean) The scrollbar animator for the pinch-zoom scrollbars should 1300 // TODO(wjmaclean) The scrollbar animator for the pinch-zoom scrollbars
1301 // activate for every scroll on the main frame, not just the scrolls that move 1301 // should activate for every scroll on the main frame, not just the
1302 // the pinch virtual viewport (i.e. trigger from either inner or outer 1302 // scrolls that move the pinch virtual viewport (i.e. trigger from
1303 // viewport). 1303 // either inner or outer viewport).
1304 if (scrollbar_animation_controller_ && scrollbar_needs_animation) { 1304 if (scrollbar_animation_controller_) {
1305 // When both non-overlay and overlay scrollbars are both present, don't 1305 // When both non-overlay and overlay scrollbars are both present, don't
1306 // animate the overlay scrollbars when page scale factor is at the min. 1306 // animate the overlay scrollbars when page scale factor is at the min.
1307 // Non-overlay scrollbars also shouldn't trigger animations. 1307 // Non-overlay scrollbars also shouldn't trigger animations.
1308 bool is_animatable_scrollbar = 1308 bool is_animatable_scrollbar =
1309 scrollbar_layer->is_overlay_scrollbar() && 1309 scrollbar_layer->is_overlay_scrollbar() &&
1310 ((layer_tree_impl()->total_page_scale_factor() > 1310 ((layer_tree_impl()->total_page_scale_factor() >
1311 layer_tree_impl()->min_page_scale_factor()) || 1311 layer_tree_impl()->min_page_scale_factor()) ||
1312 !layer_tree_impl()->settings().use_pinch_zoom_scrollbars); 1312 !layer_tree_impl()->settings().use_pinch_zoom_scrollbars);
1313 if (is_animatable_scrollbar) 1313 if (is_animatable_scrollbar)
1314 scrollbar_animation_controller_->DidScrollUpdate(); 1314 scrollbar_animation_controller_->DidScrollUpdate();
1315 }
1315 } 1316 }
1316 } 1317 }
1317 1318
1318 void LayerImpl::DidBecomeActive() { 1319 void LayerImpl::DidBecomeActive() {
1319 if (layer_tree_impl_->settings().scrollbar_animator == 1320 if (layer_tree_impl_->settings().scrollbar_animator ==
1320 LayerTreeSettings::NoAnimator) { 1321 LayerTreeSettings::NoAnimator) {
1321 return; 1322 return;
1322 } 1323 }
1323 1324
1324 bool need_scrollbar_animation_controller = scrollable() && scrollbars_; 1325 bool need_scrollbar_animation_controller = scrollable() && scrollbars_;
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
1548 } 1549 }
1549 1550
1550 void LayerImpl::NotifyAnimationFinished( 1551 void LayerImpl::NotifyAnimationFinished(
1551 base::TimeTicks monotonic_time, 1552 base::TimeTicks monotonic_time,
1552 Animation::TargetProperty target_property) { 1553 Animation::TargetProperty target_property) {
1553 if (target_property == Animation::ScrollOffset) 1554 if (target_property == Animation::ScrollOffset)
1554 layer_tree_impl_->InputScrollAnimationFinished(); 1555 layer_tree_impl_->InputScrollAnimationFinished();
1555 } 1556 }
1556 1557
1557 } // namespace cc 1558 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698