Chromium Code Reviews| 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_) | |
| 245 return gfx::Rect(); | |
| 246 return MathUtil::MapClippedRect( | |
| 247 root_scroll_layer_->screen_space_transform(), | |
| 248 gfx::Rect(root_scroll_layer_->content_bounds())); | |
|
enne (OOO)
2013/11/05 01:05:17
I think this should do the same thing as Scrollabl
aelias_OOO_until_Jul13
2013/11/05 01:15:18
As far as I know, the Blink bug causing that to oc
ccameron
2013/11/05 01:15:20
Okay -- updated to use root scroll layer's first c
| |
| 249 } | |
| 250 | |
| 241 void LayerTreeImpl::UpdateMaxScrollOffset() { | 251 void LayerTreeImpl::UpdateMaxScrollOffset() { |
| 242 LayerImpl* root_scroll = RootScrollLayer(); | 252 LayerImpl* root_scroll = RootScrollLayer(); |
| 243 if (!root_scroll || !root_scroll->children().size()) | 253 if (!root_scroll || !root_scroll->children().size()) |
| 244 return; | 254 return; |
| 245 | 255 |
| 246 gfx::Vector2dF max_scroll = gfx::Rect(ScrollableSize()).bottom_right() - | 256 gfx::Vector2dF max_scroll = gfx::Rect(ScrollableSize()).bottom_right() - |
| 247 gfx::RectF(ScrollableViewportSize()).bottom_right(); | 257 gfx::RectF(ScrollableViewportSize()).bottom_right(); |
| 248 | 258 |
| 249 // The viewport may be larger than the contents in some cases, such as | 259 // The viewport may be larger than the contents in some cases, such as |
| 250 // having a vertical scrollbar but no horizontal overflow. | 260 // 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() | 775 const std::vector<LayerImpl*> LayerTreeImpl::LayersWithCopyOutputRequest() |
| 766 const { | 776 const { |
| 767 // Only the active tree needs to know about layers with copy requests, as | 777 // Only the active tree needs to know about layers with copy requests, as |
| 768 // they are aborted if not serviced during draw. | 778 // they are aborted if not serviced during draw. |
| 769 DCHECK(IsActiveTree()); | 779 DCHECK(IsActiveTree()); |
| 770 | 780 |
| 771 return layers_with_copy_output_request_; | 781 return layers_with_copy_output_request_; |
| 772 } | 782 } |
| 773 | 783 |
| 774 } // namespace cc | 784 } // namespace cc |
| OLD | NEW |