OLD | NEW |
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 should_flatten_transform_(true), | 54 should_flatten_transform_(true), |
55 layer_property_changed_(false), | 55 layer_property_changed_(false), |
56 masks_to_bounds_(false), | 56 masks_to_bounds_(false), |
57 contents_opaque_(false), | 57 contents_opaque_(false), |
58 is_root_for_isolated_group_(false), | 58 is_root_for_isolated_group_(false), |
59 use_parent_backface_visibility_(false), | 59 use_parent_backface_visibility_(false), |
60 draw_checkerboard_for_missing_tiles_(false), | 60 draw_checkerboard_for_missing_tiles_(false), |
61 draws_content_(false), | 61 draws_content_(false), |
62 hide_layer_and_subtree_(false), | 62 hide_layer_and_subtree_(false), |
63 force_render_surface_(false), | 63 force_render_surface_(false), |
| 64 delay_scrollbar_animation_(false), |
64 transform_is_invertible_(true), | 65 transform_is_invertible_(true), |
65 is_container_for_fixed_position_layers_(false), | 66 is_container_for_fixed_position_layers_(false), |
66 background_color_(0), | 67 background_color_(0), |
67 opacity_(1.0), | 68 opacity_(1.0), |
68 blend_mode_(SkXfermode::kSrcOver_Mode), | 69 blend_mode_(SkXfermode::kSrcOver_Mode), |
69 num_descendants_that_draw_content_(0), | 70 num_descendants_that_draw_content_(0), |
70 draw_depth_(0.f), | 71 draw_depth_(0.f), |
71 needs_push_properties_(false), | 72 needs_push_properties_(false), |
72 num_dependents_need_push_properties_(0), | 73 num_dependents_need_push_properties_(0), |
73 sorting_context_id_(0), | 74 sorting_context_id_(0), |
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 return gfx::ToCeiledSize(gfx::SizeF(bounds_.width() + bounds_delta_.x(), | 776 return gfx::ToCeiledSize(gfx::SizeF(bounds_.width() + bounds_delta_.x(), |
776 bounds_.height() + bounds_delta_.y())); | 777 bounds_.height() + bounds_delta_.y())); |
777 } | 778 } |
778 | 779 |
779 void LayerImpl::SetBounds(const gfx::Size& bounds) { | 780 void LayerImpl::SetBounds(const gfx::Size& bounds) { |
780 if (bounds_ == bounds) | 781 if (bounds_ == bounds) |
781 return; | 782 return; |
782 | 783 |
783 bounds_ = bounds; | 784 bounds_ = bounds; |
784 | 785 |
| 786 delay_scrollbar_animation_ = true; |
785 ScrollbarParametersDidChange(); | 787 ScrollbarParametersDidChange(); |
| 788 delay_scrollbar_animation_ = false; |
786 if (masks_to_bounds()) | 789 if (masks_to_bounds()) |
787 NoteLayerPropertyChangedForSubtree(); | 790 NoteLayerPropertyChangedForSubtree(); |
788 else | 791 else |
789 NoteLayerPropertyChanged(); | 792 NoteLayerPropertyChanged(); |
790 } | 793 } |
791 | 794 |
792 void LayerImpl::SetBoundsDelta(const gfx::Vector2dF& bounds_delta) { | 795 void LayerImpl::SetBoundsDelta(const gfx::Vector2dF& bounds_delta) { |
793 if (bounds_delta_ == bounds_delta) | 796 if (bounds_delta_ == bounds_delta) |
794 return; | 797 return; |
795 | 798 |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1303 // either inner or outer viewport). | 1306 // either inner or outer viewport). |
1304 if (scrollbar_animation_controller_) { | 1307 if (scrollbar_animation_controller_) { |
1305 // When both non-overlay and overlay scrollbars are both present, don't | 1308 // 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. | 1309 // animate the overlay scrollbars when page scale factor is at the min. |
1307 // Non-overlay scrollbars also shouldn't trigger animations. | 1310 // Non-overlay scrollbars also shouldn't trigger animations. |
1308 bool is_animatable_scrollbar = | 1311 bool is_animatable_scrollbar = |
1309 scrollbar_layer->is_overlay_scrollbar() && | 1312 scrollbar_layer->is_overlay_scrollbar() && |
1310 ((layer_tree_impl()->total_page_scale_factor() > | 1313 ((layer_tree_impl()->total_page_scale_factor() > |
1311 layer_tree_impl()->min_page_scale_factor()) || | 1314 layer_tree_impl()->min_page_scale_factor()) || |
1312 !layer_tree_impl()->settings().use_pinch_zoom_scrollbars); | 1315 !layer_tree_impl()->settings().use_pinch_zoom_scrollbars); |
1313 if (is_animatable_scrollbar) | 1316 if (is_animatable_scrollbar) { |
| 1317 base::TimeDelta delay; |
| 1318 if (delay_scrollbar_animation_) |
| 1319 delay = base::TimeDelta::FromMilliseconds( |
| 1320 layer_tree_impl()->settings().scrollbar_fade_extra_delay_ms); |
| 1321 else |
| 1322 delay = base::TimeDelta::FromMilliseconds( |
| 1323 layer_tree_impl()->settings().scrollbar_fade_delay_ms); |
| 1324 scrollbar_animation_controller_->SetDelayOnScrollbarAnimation(delay); |
1314 scrollbar_animation_controller_->DidScrollUpdate(); | 1325 scrollbar_animation_controller_->DidScrollUpdate(); |
| 1326 } |
1315 } | 1327 } |
1316 } | 1328 } |
1317 } | 1329 } |
1318 | 1330 |
1319 void LayerImpl::DidBecomeActive() { | 1331 void LayerImpl::DidBecomeActive() { |
1320 if (layer_tree_impl_->settings().scrollbar_animator == | 1332 if (layer_tree_impl_->settings().scrollbar_animator == |
1321 LayerTreeSettings::NoAnimator) { | 1333 LayerTreeSettings::NoAnimator) { |
1322 return; | 1334 return; |
1323 } | 1335 } |
1324 | 1336 |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1549 } | 1561 } |
1550 | 1562 |
1551 void LayerImpl::NotifyAnimationFinished( | 1563 void LayerImpl::NotifyAnimationFinished( |
1552 base::TimeTicks monotonic_time, | 1564 base::TimeTicks monotonic_time, |
1553 Animation::TargetProperty target_property) { | 1565 Animation::TargetProperty target_property) { |
1554 if (target_property == Animation::ScrollOffset) | 1566 if (target_property == Animation::ScrollOffset) |
1555 layer_tree_impl_->InputScrollAnimationFinished(); | 1567 layer_tree_impl_->InputScrollAnimationFinished(); |
1556 } | 1568 } |
1557 | 1569 |
1558 } // namespace cc | 1570 } // namespace cc |
OLD | NEW |