| 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 2535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2546 } | 2546 } |
| 2547 } | 2547 } |
| 2548 | 2548 |
| 2549 void LayerTreeHostImpl::AnimateTopControls(base::TimeTicks time) { | 2549 void LayerTreeHostImpl::AnimateTopControls(base::TimeTicks time) { |
| 2550 if (!top_controls_manager_ || !RootScrollLayer()) | 2550 if (!top_controls_manager_ || !RootScrollLayer()) |
| 2551 return; | 2551 return; |
| 2552 gfx::Vector2dF scroll = top_controls_manager_->Animate(time); | 2552 gfx::Vector2dF scroll = top_controls_manager_->Animate(time); |
| 2553 UpdateMaxScrollOffset(); | 2553 UpdateMaxScrollOffset(); |
| 2554 if (RootScrollLayer()->TotalScrollOffset().y() == 0.f) | 2554 if (RootScrollLayer()->TotalScrollOffset().y() == 0.f) |
| 2555 return; | 2555 return; |
| 2556 RootScrollLayer()->ScrollBy(gfx::ScaleVector2d( | 2556 if (scroll.IsZero()) { |
| 2557 scroll, 1.f / active_tree_->total_page_scale_factor())); | 2557 // This may happen on the first animation step. Force redraw otherwise |
| 2558 // the animation would stop because of no new frames. |
| 2559 SetNeedsRedraw(); |
| 2560 } else { |
| 2561 RootScrollLayer()->ScrollBy(gfx::ScaleVector2d( |
| 2562 scroll, 1.f / active_tree_->total_page_scale_factor())); |
| 2563 } |
| 2558 } | 2564 } |
| 2559 | 2565 |
| 2560 void LayerTreeHostImpl::AnimateLayers(base::TimeTicks monotonic_time, | 2566 void LayerTreeHostImpl::AnimateLayers(base::TimeTicks monotonic_time, |
| 2561 base::Time wall_clock_time) { | 2567 base::Time wall_clock_time) { |
| 2562 if (!settings_.accelerated_animation_enabled || | 2568 if (!settings_.accelerated_animation_enabled || |
| 2563 animation_registrar_->active_animation_controllers().empty() || | 2569 animation_registrar_->active_animation_controllers().empty() || |
| 2564 !active_tree_->root_layer()) | 2570 !active_tree_->root_layer()) |
| 2565 return; | 2571 return; |
| 2566 | 2572 |
| 2567 TRACE_EVENT0("cc", "LayerTreeHostImpl::AnimateLayers"); | 2573 TRACE_EVENT0("cc", "LayerTreeHostImpl::AnimateLayers"); |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2907 swap_promise_monitor_.erase(monitor); | 2913 swap_promise_monitor_.erase(monitor); |
| 2908 } | 2914 } |
| 2909 | 2915 |
| 2910 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { | 2916 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { |
| 2911 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); | 2917 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); |
| 2912 for (; it != swap_promise_monitor_.end(); it++) | 2918 for (; it != swap_promise_monitor_.end(); it++) |
| 2913 (*it)->OnSetNeedsRedrawOnImpl(); | 2919 (*it)->OnSetNeedsRedrawOnImpl(); |
| 2914 } | 2920 } |
| 2915 | 2921 |
| 2916 } // namespace cc | 2922 } // namespace cc |
| OLD | NEW |