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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 if (vertical && !vertical->is_overlay_scrollbar()) | 224 if (vertical && !vertical->is_overlay_scrollbar()) |
225 max_scroll.set_x(max_scroll.x() + vertical->thumb_thickness()); | 225 max_scroll.set_x(max_scroll.x() + vertical->thumb_thickness()); |
226 | 226 |
227 // The viewport may be larger than the contents in some cases, such as | 227 // The viewport may be larger than the contents in some cases, such as |
228 // having a vertical scrollbar but no horizontal overflow. | 228 // having a vertical scrollbar but no horizontal overflow. |
229 max_scroll.SetToMax(gfx::Vector2dF()); | 229 max_scroll.SetToMax(gfx::Vector2dF()); |
230 | 230 |
231 root_scroll_layer_->SetMaxScrollOffset(gfx::ToFlooredVector2d(max_scroll)); | 231 root_scroll_layer_->SetMaxScrollOffset(gfx::ToFlooredVector2d(max_scroll)); |
232 } | 232 } |
233 | 233 |
| 234 static void ApplySentScrollDeltasOn(LayerImpl* layer) { |
| 235 layer->ApplySentScrollDeltas(); |
| 236 } |
| 237 |
| 238 void LayerTreeImpl::ApplySentScrollAndScaleDeltas() { |
| 239 DCHECK(IsActiveTree()); |
| 240 |
| 241 page_scale_factor_ *= sent_page_scale_delta_; |
| 242 page_scale_delta_ /= sent_page_scale_delta_; |
| 243 sent_page_scale_delta_ = 1.f; |
| 244 |
| 245 if (!root_layer()) |
| 246 return; |
| 247 |
| 248 LayerTreeHostCommon::CallFunctionForSubtree( |
| 249 root_layer(), base::Bind(&ApplySentScrollDeltasOn)); |
| 250 } |
| 251 |
234 void LayerTreeImpl::UpdateSolidColorScrollbars() { | 252 void LayerTreeImpl::UpdateSolidColorScrollbars() { |
235 DCHECK(settings().solid_color_scrollbars); | 253 DCHECK(settings().solid_color_scrollbars); |
236 | 254 |
237 LayerImpl* root_scroll = RootScrollLayer(); | 255 LayerImpl* root_scroll = RootScrollLayer(); |
238 DCHECK(root_scroll); | 256 DCHECK(root_scroll); |
239 DCHECK(IsActiveTree()); | 257 DCHECK(IsActiveTree()); |
240 | 258 |
241 gfx::RectF scrollable_viewport( | 259 gfx::RectF scrollable_viewport( |
242 gfx::PointAtOffsetFromOrigin(root_scroll->TotalScrollOffset()), | 260 gfx::PointAtOffsetFromOrigin(root_scroll->TotalScrollOffset()), |
243 ScrollableViewportSize()); | 261 ScrollableViewportSize()); |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 const std::vector<LayerImpl*> LayerTreeImpl::LayersWithCopyOutputRequest() | 613 const std::vector<LayerImpl*> LayerTreeImpl::LayersWithCopyOutputRequest() |
596 const { | 614 const { |
597 // Only the active tree needs to know about layers with copy requests, as | 615 // Only the active tree needs to know about layers with copy requests, as |
598 // they are aborted if not serviced during draw. | 616 // they are aborted if not serviced during draw. |
599 DCHECK(IsActiveTree()); | 617 DCHECK(IsActiveTree()); |
600 | 618 |
601 return layers_with_copy_output_request_; | 619 return layers_with_copy_output_request_; |
602 } | 620 } |
603 | 621 |
604 } // namespace cc | 622 } // namespace cc |
OLD | NEW |