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_impl.h" | 5 #include "cc/trees/layer_tree_impl.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "cc/animation/keyframed_animation_curve.h" | 8 #include "cc/animation/keyframed_animation_curve.h" |
9 #include "cc/animation/scrollbar_animation_controller.h" | 9 #include "cc/animation/scrollbar_animation_controller.h" |
| 10 #include "cc/base/math_util.h" |
| 11 #include "cc/base/util.h" |
10 #include "cc/debug/traced_value.h" | 12 #include "cc/debug/traced_value.h" |
11 #include "cc/layers/heads_up_display_layer_impl.h" | 13 #include "cc/layers/heads_up_display_layer_impl.h" |
12 #include "cc/layers/layer.h" | 14 #include "cc/layers/layer.h" |
13 #include "cc/layers/render_surface_impl.h" | 15 #include "cc/layers/render_surface_impl.h" |
14 #include "cc/layers/scrollbar_layer_impl_base.h" | 16 #include "cc/layers/scrollbar_layer_impl_base.h" |
15 #include "cc/trees/layer_tree_host_common.h" | 17 #include "cc/trees/layer_tree_host_common.h" |
16 #include "cc/trees/layer_tree_host_impl.h" | 18 #include "cc/trees/layer_tree_host_impl.h" |
17 #include "ui/gfx/size_conversions.h" | 19 #include "ui/gfx/size_conversions.h" |
18 #include "ui/gfx/vector2d_conversions.h" | 20 #include "ui/gfx/vector2d_conversions.h" |
19 | 21 |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 root_layer_scroll_offset_delegate_->SetTotalPageScaleFactor( | 233 root_layer_scroll_offset_delegate_->SetTotalPageScaleFactor( |
232 total_page_scale_factor()); | 234 total_page_scale_factor()); |
233 } | 235 } |
234 } | 236 } |
235 | 237 |
236 gfx::SizeF LayerTreeImpl::ScrollableViewportSize() const { | 238 gfx::SizeF LayerTreeImpl::ScrollableViewportSize() const { |
237 return gfx::ScaleSize(layer_tree_host_impl_->UnscaledScrollableViewportSize(), | 239 return gfx::ScaleSize(layer_tree_host_impl_->UnscaledScrollableViewportSize(), |
238 1.0f / total_page_scale_factor()); | 240 1.0f / total_page_scale_factor()); |
239 } | 241 } |
240 | 242 |
| 243 gfx::Rect LayerTreeImpl::RootScrollLayerDeviceViewportBounds() const { |
| 244 if (!root_scroll_layer_ || root_scroll_layer_->children().empty()) |
| 245 return gfx::Rect(); |
| 246 LayerImpl* layer = root_scroll_layer_->children()[0]; |
| 247 return MathUtil::MapClippedRect( |
| 248 layer->screen_space_transform(), |
| 249 gfx::Rect(layer->content_bounds())); |
| 250 } |
| 251 |
241 void LayerTreeImpl::UpdateMaxScrollOffset() { | 252 void LayerTreeImpl::UpdateMaxScrollOffset() { |
242 LayerImpl* root_scroll = RootScrollLayer(); | 253 LayerImpl* root_scroll = RootScrollLayer(); |
243 if (!root_scroll || !root_scroll->children().size()) | 254 if (!root_scroll || !root_scroll->children().size()) |
244 return; | 255 return; |
245 | 256 |
246 gfx::Vector2dF max_scroll = gfx::Rect(ScrollableSize()).bottom_right() - | 257 gfx::Vector2dF max_scroll = gfx::Rect(ScrollableSize()).bottom_right() - |
247 gfx::RectF(ScrollableViewportSize()).bottom_right(); | 258 gfx::RectF(ScrollableViewportSize()).bottom_right(); |
248 | 259 |
249 // The viewport may be larger than the contents in some cases, such as | 260 // The viewport may be larger than the contents in some cases, such as |
250 // having a vertical scrollbar but no horizontal overflow. | 261 // having a vertical scrollbar but no horizontal overflow. |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 const std::vector<LayerImpl*> LayerTreeImpl::LayersWithCopyOutputRequest() | 776 const std::vector<LayerImpl*> LayerTreeImpl::LayersWithCopyOutputRequest() |
766 const { | 777 const { |
767 // Only the active tree needs to know about layers with copy requests, as | 778 // Only the active tree needs to know about layers with copy requests, as |
768 // they are aborted if not serviced during draw. | 779 // they are aborted if not serviced during draw. |
769 DCHECK(IsActiveTree()); | 780 DCHECK(IsActiveTree()); |
770 | 781 |
771 return layers_with_copy_output_request_; | 782 return layers_with_copy_output_request_; |
772 } | 783 } |
773 | 784 |
774 } // namespace cc | 785 } // namespace cc |
OLD | NEW |