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" |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 gfx::Vector2dF max_scroll = gfx::Rect(ScrollableSize()).bottom_right() - | 215 gfx::Vector2dF max_scroll = gfx::Rect(ScrollableSize()).bottom_right() - |
216 gfx::RectF(ScrollableViewportSize()).bottom_right(); | 216 gfx::RectF(ScrollableViewportSize()).bottom_right(); |
217 | 217 |
218 // The viewport may be larger than the contents in some cases, such as | 218 // The viewport may be larger than the contents in some cases, such as |
219 // having a vertical scrollbar but no horizontal overflow. | 219 // having a vertical scrollbar but no horizontal overflow. |
220 max_scroll.SetToMax(gfx::Vector2dF()); | 220 max_scroll.SetToMax(gfx::Vector2dF()); |
221 | 221 |
222 root_scroll_layer_->SetMaxScrollOffset(gfx::ToFlooredVector2d(max_scroll)); | 222 root_scroll_layer_->SetMaxScrollOffset(gfx::ToFlooredVector2d(max_scroll)); |
223 } | 223 } |
224 | 224 |
| 225 static void ApplySentScrollDeltasOn(LayerImpl* layer) { |
| 226 layer->ApplySentScrollDeltas(); |
| 227 } |
| 228 |
| 229 void LayerTreeImpl::ApplySentScrollAndScaleDeltas() { |
| 230 DCHECK(IsActiveTree()); |
| 231 |
| 232 page_scale_factor_ *= sent_page_scale_delta_; |
| 233 page_scale_delta_ /= sent_page_scale_delta_; |
| 234 sent_page_scale_delta_ = 1.f; |
| 235 |
| 236 if (!root_layer()) |
| 237 return; |
| 238 |
| 239 LayerTreeHostCommon::CallFunctionForSubtree( |
| 240 root_layer(), base::Bind(&ApplySentScrollDeltasOn)); |
| 241 } |
| 242 |
225 void LayerTreeImpl::UpdateSolidColorScrollbars() { | 243 void LayerTreeImpl::UpdateSolidColorScrollbars() { |
226 DCHECK(settings().solid_color_scrollbars); | 244 DCHECK(settings().solid_color_scrollbars); |
227 | 245 |
228 LayerImpl* root_scroll = RootScrollLayer(); | 246 LayerImpl* root_scroll = RootScrollLayer(); |
229 DCHECK(root_scroll); | 247 DCHECK(root_scroll); |
230 DCHECK(IsActiveTree()); | 248 DCHECK(IsActiveTree()); |
231 | 249 |
232 gfx::RectF scrollable_viewport( | 250 gfx::RectF scrollable_viewport( |
233 gfx::PointAtOffsetFromOrigin(root_scroll->TotalScrollOffset()), | 251 gfx::PointAtOffsetFromOrigin(root_scroll->TotalScrollOffset()), |
234 ScrollableViewportSize()); | 252 ScrollableViewportSize()); |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 const std::vector<LayerImpl*> LayerTreeImpl::LayersWithCopyOutputRequest() | 604 const std::vector<LayerImpl*> LayerTreeImpl::LayersWithCopyOutputRequest() |
587 const { | 605 const { |
588 // Only the active tree needs to know about layers with copy requests, as | 606 // Only the active tree needs to know about layers with copy requests, as |
589 // they are aborted if not serviced during draw. | 607 // they are aborted if not serviced during draw. |
590 DCHECK(IsActiveTree()); | 608 DCHECK(IsActiveTree()); |
591 | 609 |
592 return layers_with_copy_output_request_; | 610 return layers_with_copy_output_request_; |
593 } | 611 } |
594 | 612 |
595 } // namespace cc | 613 } // namespace cc |
OLD | NEW |