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 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 const gfx::Vector2d& target_offset, | 445 const gfx::Vector2d& target_offset, |
446 bool anchor_point, | 446 bool anchor_point, |
447 float page_scale, | 447 float page_scale, |
448 base::TimeDelta duration) { | 448 base::TimeDelta duration) { |
449 if (!InnerViewportScrollLayer()) | 449 if (!InnerViewportScrollLayer()) |
450 return; | 450 return; |
451 | 451 |
452 gfx::ScrollOffset scroll_total = active_tree_->TotalScrollOffset(); | 452 gfx::ScrollOffset scroll_total = active_tree_->TotalScrollOffset(); |
453 gfx::SizeF scaled_scrollable_size = active_tree_->ScrollableSize(); | 453 gfx::SizeF scaled_scrollable_size = active_tree_->ScrollableSize(); |
454 gfx::SizeF viewport_size = | 454 gfx::SizeF viewport_size = |
455 active_tree_->InnerViewportContainerLayer()->bounds(); | 455 gfx::SizeF(active_tree_->InnerViewportContainerLayer()->bounds()); |
456 | 456 |
457 // Easing constants experimentally determined. | 457 // Easing constants experimentally determined. |
458 scoped_ptr<TimingFunction> timing_function = | 458 scoped_ptr<TimingFunction> timing_function = |
459 CubicBezierTimingFunction::Create(.8, 0, .3, .9); | 459 CubicBezierTimingFunction::Create(.8, 0, .3, .9); |
460 | 460 |
461 // TODO(miletus) : Pass in ScrollOffset. | 461 // TODO(miletus) : Pass in ScrollOffset. |
462 page_scale_animation_ = PageScaleAnimation::Create( | 462 page_scale_animation_ = PageScaleAnimation::Create( |
463 ScrollOffsetToVector2dF(scroll_total), | 463 ScrollOffsetToVector2dF(scroll_total), |
464 active_tree_->current_page_scale_factor(), viewport_size, | 464 active_tree_->current_page_scale_factor(), viewport_size, |
465 scaled_scrollable_size, timing_function.Pass()); | 465 scaled_scrollable_size, timing_function.Pass()); |
(...skipping 1774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2240 if (pending_tree_) | 2240 if (pending_tree_) |
2241 active_tree_->SetViewportSizeInvalid(); | 2241 active_tree_->SetViewportSizeInvalid(); |
2242 | 2242 |
2243 device_viewport_size_ = device_viewport_size; | 2243 device_viewport_size_ = device_viewport_size; |
2244 | 2244 |
2245 UpdateViewportContainerSizes(); | 2245 UpdateViewportContainerSizes(); |
2246 client_->OnCanDrawStateChanged(CanDraw()); | 2246 client_->OnCanDrawStateChanged(CanDraw()); |
2247 SetFullRootLayerDamage(); | 2247 SetFullRootLayerDamage(); |
2248 active_tree_->set_needs_update_draw_properties(); | 2248 active_tree_->set_needs_update_draw_properties(); |
2249 active_tree_->property_trees()->clip_tree.SetViewportClip( | 2249 active_tree_->property_trees()->clip_tree.SetViewportClip( |
2250 gfx::RectF(device_viewport_size)); | 2250 gfx::RectF(gfx::SizeF(device_viewport_size))); |
2251 } | 2251 } |
2252 | 2252 |
2253 void LayerTreeHostImpl::SetDeviceScaleFactor(float device_scale_factor) { | 2253 void LayerTreeHostImpl::SetDeviceScaleFactor(float device_scale_factor) { |
2254 if (device_scale_factor == device_scale_factor_) | 2254 if (device_scale_factor == device_scale_factor_) |
2255 return; | 2255 return; |
2256 device_scale_factor_ = device_scale_factor; | 2256 device_scale_factor_ = device_scale_factor; |
2257 | 2257 |
2258 SetFullRootLayerDamage(); | 2258 SetFullRootLayerDamage(); |
2259 } | 2259 } |
2260 | 2260 |
(...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3600 if (active_tree()) { | 3600 if (active_tree()) { |
3601 LayerAnimationValueProvider* layer = active_tree()->LayerById(layer_id); | 3601 LayerAnimationValueProvider* layer = active_tree()->LayerById(layer_id); |
3602 if (layer) | 3602 if (layer) |
3603 return layer->ScrollOffsetForAnimation(); | 3603 return layer->ScrollOffsetForAnimation(); |
3604 } | 3604 } |
3605 | 3605 |
3606 return gfx::ScrollOffset(); | 3606 return gfx::ScrollOffset(); |
3607 } | 3607 } |
3608 | 3608 |
3609 } // namespace cc | 3609 } // namespace cc |
OLD | NEW |