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

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

Issue 608223002: [Android]Increase Scrollbar fade delay on Resize. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added test case Created 6 years, 2 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
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 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1268 } 1268 }
1269 // TODO(wjmaclean) Once we move to a model where the two-viewport model is 1269 // TODO(wjmaclean) Once we move to a model where the two-viewport model is
1270 // turned on in all builds, remove the next two lines. For now however, the 1270 // turned on in all builds, remove the next two lines. For now however, the
1271 // page scale layer may coincide with the clip layer, and so this is 1271 // page scale layer may coincide with the clip layer, and so this is
1272 // necessary. 1272 // necessary.
1273 if (page_scale_layer == scrollbar_clip_layer) { 1273 if (page_scale_layer == scrollbar_clip_layer) {
1274 scroll_rect.Scale(layer_tree_impl()->total_page_scale_factor()); 1274 scroll_rect.Scale(layer_tree_impl()->total_page_scale_factor());
1275 current_offset.Scale(layer_tree_impl()->total_page_scale_factor()); 1275 current_offset.Scale(layer_tree_impl()->total_page_scale_factor());
1276 } 1276 }
1277 1277
1278 bool scrollbar_needs_animation = false; 1278 bool did_scrollbar_position_changed = false;
1279 scrollbar_needs_animation |= scrollbar_layer->SetVerticalAdjust( 1279 bool did_scrollbar_resize = false;
aelias_OOO_until_Jul13 2014/10/03 01:57:53 Sorry, one more thing. I just tried it locally an
MuVen 2014/10/03 13:01:37 Done.
1280 did_scrollbar_position_changed |= scrollbar_layer->SetVerticalAdjust(
1280 scrollbar_clip_layer->bounds_delta().y()); 1281 scrollbar_clip_layer->bounds_delta().y());
1281 if (scrollbar_layer->orientation() == HORIZONTAL) { 1282 if (scrollbar_layer->orientation() == HORIZONTAL) {
1282 float visible_ratio = clip_rect.width() / scroll_rect.width(); 1283 float visible_ratio = clip_rect.width() / scroll_rect.width();
1283 scrollbar_needs_animation |= 1284 did_scrollbar_position_changed |=
1284 scrollbar_layer->SetCurrentPos(current_offset.x()); 1285 scrollbar_layer->SetCurrentPos(current_offset.x());
1285 scrollbar_needs_animation |= 1286 did_scrollbar_resize |=
1286 scrollbar_layer->SetMaximum(scroll_rect.width() - clip_rect.width()); 1287 scrollbar_layer->SetMaximum(scroll_rect.width() - clip_rect.width());
1287 scrollbar_needs_animation |= 1288 did_scrollbar_resize |=
1288 scrollbar_layer->SetVisibleToTotalLengthRatio(visible_ratio); 1289 scrollbar_layer->SetVisibleToTotalLengthRatio(visible_ratio);
1289 } else { 1290 } else {
1290 float visible_ratio = clip_rect.height() / scroll_rect.height(); 1291 float visible_ratio = clip_rect.height() / scroll_rect.height();
1291 scrollbar_needs_animation |= 1292 did_scrollbar_position_changed |=
1292 scrollbar_layer->SetCurrentPos(current_offset.y()); 1293 scrollbar_layer->SetCurrentPos(current_offset.y());
1293 scrollbar_needs_animation |= 1294 did_scrollbar_resize |=
1294 scrollbar_layer->SetMaximum(scroll_rect.height() - clip_rect.height()); 1295 scrollbar_layer->SetMaximum(scroll_rect.height() - clip_rect.height());
1295 scrollbar_needs_animation |= 1296 did_scrollbar_resize |=
1296 scrollbar_layer->SetVisibleToTotalLengthRatio(visible_ratio); 1297 scrollbar_layer->SetVisibleToTotalLengthRatio(visible_ratio);
1297 } 1298 }
1298 if (scrollbar_needs_animation) { 1299 if (did_scrollbar_position_changed || did_scrollbar_resize) {
1299 layer_tree_impl()->set_needs_update_draw_properties(); 1300 layer_tree_impl()->set_needs_update_draw_properties();
1300 // TODO(wjmaclean) The scrollbar animator for the pinch-zoom scrollbars 1301 // TODO(wjmaclean) The scrollbar animator for the pinch-zoom scrollbars
1301 // should activate for every scroll on the main frame, not just the 1302 // should activate for every scroll on the main frame, not just the
1302 // scrolls that move the pinch virtual viewport (i.e. trigger from 1303 // scrolls that move the pinch virtual viewport (i.e. trigger from
1303 // either inner or outer viewport). 1304 // either inner or outer viewport).
1304 if (scrollbar_animation_controller_) { 1305 if (scrollbar_animation_controller_) {
1305 // When both non-overlay and overlay scrollbars are both present, don't 1306 // 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. 1307 // animate the overlay scrollbars when page scale factor is at the min.
1307 // Non-overlay scrollbars also shouldn't trigger animations. 1308 // Non-overlay scrollbars also shouldn't trigger animations.
1308 bool is_animatable_scrollbar = 1309 bool is_animatable_scrollbar =
1309 scrollbar_layer->is_overlay_scrollbar() && 1310 scrollbar_layer->is_overlay_scrollbar() &&
1310 ((layer_tree_impl()->total_page_scale_factor() > 1311 ((layer_tree_impl()->total_page_scale_factor() >
1311 layer_tree_impl()->min_page_scale_factor()) || 1312 layer_tree_impl()->min_page_scale_factor()) ||
1312 !layer_tree_impl()->settings().use_pinch_zoom_scrollbars); 1313 !layer_tree_impl()->settings().use_pinch_zoom_scrollbars);
1313 if (is_animatable_scrollbar) 1314 if (is_animatable_scrollbar)
1314 scrollbar_animation_controller_->DidScrollUpdate(); 1315 scrollbar_animation_controller_->DidScrollUpdate(did_scrollbar_resize);
1315 } 1316 }
1316 } 1317 }
1317 } 1318 }
1318 1319
1319 void LayerImpl::DidBecomeActive() { 1320 void LayerImpl::DidBecomeActive() {
1320 if (layer_tree_impl_->settings().scrollbar_animator == 1321 if (layer_tree_impl_->settings().scrollbar_animator ==
1321 LayerTreeSettings::NoAnimator) { 1322 LayerTreeSettings::NoAnimator) {
1322 return; 1323 return;
1323 } 1324 }
1324 1325
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1549 } 1550 }
1550 1551
1551 void LayerImpl::NotifyAnimationFinished( 1552 void LayerImpl::NotifyAnimationFinished(
1552 base::TimeTicks monotonic_time, 1553 base::TimeTicks monotonic_time,
1553 Animation::TargetProperty target_property) { 1554 Animation::TargetProperty target_property) {
1554 if (target_property == Animation::ScrollOffset) 1555 if (target_property == Animation::ScrollOffset)
1555 layer_tree_impl_->InputScrollAnimationFinished(); 1556 layer_tree_impl_->InputScrollAnimationFinished();
1556 } 1557 }
1557 1558
1558 } // namespace cc 1559 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/scrollbar_animation_controller_thinning_unittest.cc ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698