| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 3009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3020 client_->SetNeedsCommitOnImplThread(); | 3020 client_->SetNeedsCommitOnImplThread(); |
| 3021 client_->RenewTreePriority(); | 3021 client_->RenewTreePriority(); |
| 3022 } else { | 3022 } else { |
| 3023 SetNeedsAnimate(); | 3023 SetNeedsAnimate(); |
| 3024 } | 3024 } |
| 3025 } | 3025 } |
| 3026 | 3026 |
| 3027 void LayerTreeHostImpl::AnimateTopControls(base::TimeTicks time) { | 3027 void LayerTreeHostImpl::AnimateTopControls(base::TimeTicks time) { |
| 3028 if (!top_controls_manager_ || !top_controls_manager_->animation()) | 3028 if (!top_controls_manager_ || !top_controls_manager_->animation()) |
| 3029 return; | 3029 return; |
| 3030 |
| 3030 gfx::Vector2dF scroll = top_controls_manager_->Animate(time); | 3031 gfx::Vector2dF scroll = top_controls_manager_->Animate(time); |
| 3032 |
| 3033 if (top_controls_manager_->animation()) |
| 3034 SetNeedsAnimate(); |
| 3035 |
| 3031 if (active_tree_->TotalScrollOffset().y() == 0.f) | 3036 if (active_tree_->TotalScrollOffset().y() == 0.f) |
| 3032 return; | 3037 return; |
| 3033 if (!scroll.IsZero()) { | 3038 |
| 3034 ScrollViewportBy(gfx::ScaleVector2d( | 3039 if (scroll.IsZero()) |
| 3035 scroll, 1.f / active_tree_->total_page_scale_factor())); | 3040 return; |
| 3036 SetNeedsRedraw(); | 3041 |
| 3037 } | 3042 ScrollViewportBy(gfx::ScaleVector2d( |
| 3038 SetNeedsAnimate(); | 3043 scroll, 1.f / active_tree_->total_page_scale_factor())); |
| 3044 SetNeedsRedraw(); |
| 3045 client_->SetNeedsCommitOnImplThread(); |
| 3046 client_->RenewTreePriority(); |
| 3039 } | 3047 } |
| 3040 | 3048 |
| 3041 void LayerTreeHostImpl::AnimateLayers(base::TimeTicks monotonic_time) { | 3049 void LayerTreeHostImpl::AnimateLayers(base::TimeTicks monotonic_time) { |
| 3042 if (!settings_.accelerated_animation_enabled || | 3050 if (!settings_.accelerated_animation_enabled || |
| 3043 !needs_animate_layers() || | 3051 !needs_animate_layers() || |
| 3044 !active_tree_->root_layer()) | 3052 !active_tree_->root_layer()) |
| 3045 return; | 3053 return; |
| 3046 | 3054 |
| 3047 TRACE_EVENT0("cc", "LayerTreeHostImpl::AnimateLayers"); | 3055 TRACE_EVENT0("cc", "LayerTreeHostImpl::AnimateLayers"); |
| 3048 AnimationRegistrar::AnimationControllerMap copy = | 3056 AnimationRegistrar::AnimationControllerMap copy = |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3369 } | 3377 } |
| 3370 | 3378 |
| 3371 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { | 3379 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { |
| 3372 std::vector<PictureLayerImpl*>::iterator it = | 3380 std::vector<PictureLayerImpl*>::iterator it = |
| 3373 std::find(picture_layers_.begin(), picture_layers_.end(), layer); | 3381 std::find(picture_layers_.begin(), picture_layers_.end(), layer); |
| 3374 DCHECK(it != picture_layers_.end()); | 3382 DCHECK(it != picture_layers_.end()); |
| 3375 picture_layers_.erase(it); | 3383 picture_layers_.erase(it); |
| 3376 } | 3384 } |
| 3377 | 3385 |
| 3378 } // namespace cc | 3386 } // namespace cc |
| OLD | NEW |