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/animation.h" | 8 #include "cc/animation/animation.h" |
9 #include "cc/animation/animation_id_provider.h" | 9 #include "cc/animation/animation_id_provider.h" |
10 #include "cc/animation/keyframed_animation_curve.h" | 10 #include "cc/animation/keyframed_animation_curve.h" |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 } | 252 } |
253 } | 253 } |
254 | 254 |
255 struct UpdateTilePrioritiesForLayer { | 255 struct UpdateTilePrioritiesForLayer { |
256 void operator()(LayerImpl *layer) { | 256 void operator()(LayerImpl *layer) { |
257 layer->UpdateTilePriorities(); | 257 layer->UpdateTilePriorities(); |
258 } | 258 } |
259 }; | 259 }; |
260 | 260 |
261 void LayerTreeImpl::UpdateDrawProperties(UpdateDrawPropertiesReason reason) { | 261 void LayerTreeImpl::UpdateDrawProperties(UpdateDrawPropertiesReason reason) { |
| 262 if (IsActiveTree() && RootScrollLayer() && RootClipLayer()) |
| 263 UpdateRootScrollLayerSizeDelta(); |
| 264 |
262 if (settings().solid_color_scrollbars && | 265 if (settings().solid_color_scrollbars && |
263 IsActiveTree() && | 266 IsActiveTree() && |
264 RootScrollLayer()) { | 267 RootScrollLayer()) { |
265 UpdateSolidColorScrollbars(); | 268 UpdateSolidColorScrollbars(); |
266 | 269 |
267 // The top controls manager is incompatible with the WebKit-created cliprect | 270 // The top controls manager is incompatible with the WebKit-created cliprect |
268 // because it can bring into view a larger amount of content when it | 271 // because it can bring into view a larger amount of content when it |
269 // hides. It's safe to deactivate the clip rect if no non-overlay scrollbars | 272 // hides. It's safe to deactivate the clip rect if no non-overlay scrollbars |
270 // are present. | 273 // are present. |
271 if (RootClipLayer() && layer_tree_host_impl_->top_controls_manager()) | 274 if (RootClipLayer() && layer_tree_host_impl_->top_controls_manager()) |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 | 662 |
660 StartFadeOutAnimation(PinchZoomScrollbarHorizontal()); | 663 StartFadeOutAnimation(PinchZoomScrollbarHorizontal()); |
661 StartFadeOutAnimation(PinchZoomScrollbarVertical()); | 664 StartFadeOutAnimation(PinchZoomScrollbarVertical()); |
662 } | 665 } |
663 | 666 |
664 bool LayerTreeImpl::HasPinchZoomScrollbars() const { | 667 bool LayerTreeImpl::HasPinchZoomScrollbars() const { |
665 return pinch_zoom_scrollbar_horizontal_layer_id_ != Layer::INVALID_ID && | 668 return pinch_zoom_scrollbar_horizontal_layer_id_ != Layer::INVALID_ID && |
666 pinch_zoom_scrollbar_vertical_layer_id_ != Layer::INVALID_ID; | 669 pinch_zoom_scrollbar_vertical_layer_id_ != Layer::INVALID_ID; |
667 } | 670 } |
668 | 671 |
| 672 void LayerTreeImpl::UpdateRootScrollLayerSizeDelta() { |
| 673 LayerImpl* root_scroll = RootScrollLayer(); |
| 674 LayerImpl* root_clip = RootClipLayer(); |
| 675 DCHECK(root_scroll); |
| 676 DCHECK(root_clip); |
| 677 DCHECK(IsActiveTree()); |
| 678 |
| 679 gfx::Vector2dF scrollable_viewport_size = |
| 680 gfx::RectF(ScrollableViewportSize()).bottom_right() - gfx::PointF(); |
| 681 |
| 682 gfx::Vector2dF original_viewport_size = |
| 683 gfx::RectF(root_clip->bounds()).bottom_right() - |
| 684 gfx::PointF(); |
| 685 original_viewport_size.Scale(1 / page_scale_factor()); |
| 686 |
| 687 root_scroll->SetFixedContainerSizeDelta( |
| 688 scrollable_viewport_size - original_viewport_size); |
| 689 } |
| 690 |
669 } // namespace cc | 691 } // namespace cc |
OLD | NEW |