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 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 const gfx::Vector2d& target_offset, | 453 const gfx::Vector2d& target_offset, |
454 bool anchor_point, | 454 bool anchor_point, |
455 float page_scale, | 455 float page_scale, |
456 base::TimeDelta duration) { | 456 base::TimeDelta duration) { |
457 if (!InnerViewportScrollLayer()) | 457 if (!InnerViewportScrollLayer()) |
458 return; | 458 return; |
459 | 459 |
460 gfx::ScrollOffset scroll_total = active_tree_->TotalScrollOffset(); | 460 gfx::ScrollOffset scroll_total = active_tree_->TotalScrollOffset(); |
461 gfx::SizeF scaled_scrollable_size = active_tree_->ScrollableSize(); | 461 gfx::SizeF scaled_scrollable_size = active_tree_->ScrollableSize(); |
462 gfx::SizeF viewport_size = | 462 gfx::SizeF viewport_size = |
463 active_tree_->InnerViewportContainerLayer()->bounds(); | 463 gfx::SizeF(active_tree_->InnerViewportContainerLayer()->bounds()); |
464 | 464 |
465 // Easing constants experimentally determined. | 465 // Easing constants experimentally determined. |
466 scoped_ptr<TimingFunction> timing_function = | 466 scoped_ptr<TimingFunction> timing_function = |
467 CubicBezierTimingFunction::Create(.8, 0, .3, .9); | 467 CubicBezierTimingFunction::Create(.8, 0, .3, .9); |
468 | 468 |
469 // TODO(miletus) : Pass in ScrollOffset. | 469 // TODO(miletus) : Pass in ScrollOffset. |
470 page_scale_animation_ = PageScaleAnimation::Create( | 470 page_scale_animation_ = PageScaleAnimation::Create( |
471 ScrollOffsetToVector2dF(scroll_total), | 471 ScrollOffsetToVector2dF(scroll_total), |
472 active_tree_->current_page_scale_factor(), viewport_size, | 472 active_tree_->current_page_scale_factor(), viewport_size, |
473 scaled_scrollable_size, timing_function.Pass()); | 473 scaled_scrollable_size, timing_function.Pass()); |
(...skipping 1780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2254 if (pending_tree_) | 2254 if (pending_tree_) |
2255 active_tree_->SetViewportSizeInvalid(); | 2255 active_tree_->SetViewportSizeInvalid(); |
2256 | 2256 |
2257 device_viewport_size_ = device_viewport_size; | 2257 device_viewport_size_ = device_viewport_size; |
2258 | 2258 |
2259 UpdateViewportContainerSizes(); | 2259 UpdateViewportContainerSizes(); |
2260 client_->OnCanDrawStateChanged(CanDraw()); | 2260 client_->OnCanDrawStateChanged(CanDraw()); |
2261 SetFullRootLayerDamage(); | 2261 SetFullRootLayerDamage(); |
2262 active_tree_->set_needs_update_draw_properties(); | 2262 active_tree_->set_needs_update_draw_properties(); |
2263 active_tree_->property_trees()->clip_tree.SetViewportClip( | 2263 active_tree_->property_trees()->clip_tree.SetViewportClip( |
2264 gfx::RectF(device_viewport_size)); | 2264 gfx::RectF(gfx::SizeF(device_viewport_size))); |
2265 } | 2265 } |
2266 | 2266 |
2267 void LayerTreeHostImpl::SetDeviceScaleFactor(float device_scale_factor) { | 2267 void LayerTreeHostImpl::SetDeviceScaleFactor(float device_scale_factor) { |
2268 if (device_scale_factor == device_scale_factor_) | 2268 if (device_scale_factor == device_scale_factor_) |
2269 return; | 2269 return; |
2270 device_scale_factor_ = device_scale_factor; | 2270 device_scale_factor_ = device_scale_factor; |
2271 | 2271 |
2272 SetFullRootLayerDamage(); | 2272 SetFullRootLayerDamage(); |
2273 } | 2273 } |
2274 | 2274 |
(...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3614 if (active_tree()) { | 3614 if (active_tree()) { |
3615 LayerAnimationValueProvider* layer = active_tree()->LayerById(layer_id); | 3615 LayerAnimationValueProvider* layer = active_tree()->LayerById(layer_id); |
3616 if (layer) | 3616 if (layer) |
3617 return layer->ScrollOffsetForAnimation(); | 3617 return layer->ScrollOffsetForAnimation(); |
3618 } | 3618 } |
3619 | 3619 |
3620 return gfx::ScrollOffset(); | 3620 return gfx::ScrollOffset(); |
3621 } | 3621 } |
3622 | 3622 |
3623 } // namespace cc | 3623 } // namespace cc |
OLD | NEW |