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/debug/traced_value.h" | 10 #include "cc/debug/traced_value.h" |
11 #include "cc/layers/heads_up_display_layer_impl.h" | 11 #include "cc/layers/heads_up_display_layer_impl.h" |
12 #include "cc/layers/render_surface_impl.h" | 12 #include "cc/layers/render_surface_impl.h" |
13 #include "cc/layers/scrollbar_layer_impl.h" | 13 #include "cc/layers/scrollbar_layer_impl_base.h" |
14 #include "cc/trees/layer_tree_host_common.h" | 14 #include "cc/trees/layer_tree_host_common.h" |
15 #include "cc/trees/layer_tree_host_impl.h" | 15 #include "cc/trees/layer_tree_host_impl.h" |
16 #include "ui/gfx/size_conversions.h" | 16 #include "ui/gfx/size_conversions.h" |
17 #include "ui/gfx/vector2d_conversions.h" | 17 #include "ui/gfx/vector2d_conversions.h" |
18 | 18 |
19 namespace cc { | 19 namespace cc { |
20 | 20 |
21 LayerTreeImpl::LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl) | 21 LayerTreeImpl::LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl) |
22 : layer_tree_host_impl_(layer_tree_host_impl), | 22 : layer_tree_host_impl_(layer_tree_host_impl), |
23 source_frame_number_(-1), | 23 source_frame_number_(-1), |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 page_scale_delta_ /= sent_page_scale_delta_; | 237 page_scale_delta_ /= sent_page_scale_delta_; |
238 sent_page_scale_delta_ = 1.f; | 238 sent_page_scale_delta_ = 1.f; |
239 | 239 |
240 if (!root_layer()) | 240 if (!root_layer()) |
241 return; | 241 return; |
242 | 242 |
243 LayerTreeHostCommon::CallFunctionForSubtree( | 243 LayerTreeHostCommon::CallFunctionForSubtree( |
244 root_layer(), base::Bind(&ApplySentScrollDeltasOn)); | 244 root_layer(), base::Bind(&ApplySentScrollDeltasOn)); |
245 } | 245 } |
246 | 246 |
| 247 // TODO(wjmaclean) This needs to go away, and be replaced with a single core |
| 248 // of login that works for both scrollbar layer types. This is already planned |
| 249 // as part of the larger pinch-zoom re-factoring viewport. |
247 void LayerTreeImpl::UpdateSolidColorScrollbars() { | 250 void LayerTreeImpl::UpdateSolidColorScrollbars() { |
248 DCHECK(settings().solid_color_scrollbars); | 251 DCHECK(settings().solid_color_scrollbars); |
249 | 252 |
250 LayerImpl* root_scroll = RootScrollLayer(); | 253 LayerImpl* root_scroll = RootScrollLayer(); |
251 DCHECK(root_scroll); | 254 DCHECK(root_scroll); |
252 DCHECK(IsActiveTree()); | 255 DCHECK(IsActiveTree()); |
253 | 256 |
254 gfx::RectF scrollable_viewport( | 257 gfx::RectF scrollable_viewport( |
255 gfx::PointAtOffsetFromOrigin(root_scroll->TotalScrollOffset()), | 258 gfx::PointAtOffsetFromOrigin(root_scroll->TotalScrollOffset()), |
256 ScrollableViewportSize()); | 259 ScrollableViewportSize()); |
257 float vertical_adjust = 0.0f; | 260 float vertical_adjust = 0.0f; |
258 if (RootContainerLayer()) | 261 if (RootContainerLayer()) |
259 vertical_adjust = layer_tree_host_impl_->VisibleViewportSize().height() - | 262 vertical_adjust = layer_tree_host_impl_->VisibleViewportSize().height() - |
260 RootContainerLayer()->bounds().height(); | 263 RootContainerLayer()->bounds().height(); |
261 if (ScrollbarLayerImpl* horiz = root_scroll->horizontal_scrollbar_layer()) { | 264 if (ScrollbarLayerImplBase* horiz = |
| 265 root_scroll->horizontal_scrollbar_layer()) { |
262 horiz->SetVerticalAdjust(vertical_adjust); | 266 horiz->SetVerticalAdjust(vertical_adjust); |
263 horiz->SetVisibleToTotalLengthRatio( | 267 horiz->SetVisibleToTotalLengthRatio( |
264 scrollable_viewport.width() / ScrollableSize().width()); | 268 scrollable_viewport.width() / ScrollableSize().width()); |
265 } | 269 } |
266 if (ScrollbarLayerImpl* vertical = root_scroll->vertical_scrollbar_layer()) { | 270 if (ScrollbarLayerImplBase* vertical = |
| 271 root_scroll->vertical_scrollbar_layer()) { |
267 vertical->SetVerticalAdjust(vertical_adjust); | 272 vertical->SetVerticalAdjust(vertical_adjust); |
268 vertical->SetVisibleToTotalLengthRatio( | 273 vertical->SetVisibleToTotalLengthRatio( |
269 scrollable_viewport.height() / ScrollableSize().height()); | 274 scrollable_viewport.height() / ScrollableSize().height()); |
270 } | 275 } |
271 } | 276 } |
272 | 277 |
273 void LayerTreeImpl::UpdateDrawProperties() { | 278 void LayerTreeImpl::UpdateDrawProperties() { |
274 if (IsActiveTree() && RootScrollLayer() && RootContainerLayer()) | 279 if (IsActiveTree() && RootScrollLayer() && RootContainerLayer()) |
275 UpdateRootScrollLayerSizeDelta(); | 280 UpdateRootScrollLayerSizeDelta(); |
276 | 281 |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 const std::vector<LayerImpl*> LayerTreeImpl::LayersWithCopyOutputRequest() | 636 const std::vector<LayerImpl*> LayerTreeImpl::LayersWithCopyOutputRequest() |
632 const { | 637 const { |
633 // Only the active tree needs to know about layers with copy requests, as | 638 // Only the active tree needs to know about layers with copy requests, as |
634 // they are aborted if not serviced during draw. | 639 // they are aborted if not serviced during draw. |
635 DCHECK(IsActiveTree()); | 640 DCHECK(IsActiveTree()); |
636 | 641 |
637 return layers_with_copy_output_request_; | 642 return layers_with_copy_output_request_; |
638 } | 643 } |
639 | 644 |
640 } // namespace cc | 645 } // namespace cc |
OLD | NEW |