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/layer_tree_impl.h" | 5 #include "cc/layer_tree_impl.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "cc/layer_tree_host_common.h" | 8 #include "cc/layer_tree_host_common.h" |
9 #include "cc/layer_tree_host_impl.h" | 9 #include "cc/layer_tree_host_impl.h" |
10 #include "ui/gfx/vector2d_conversions.h" | 10 #include "ui/gfx/vector2d_conversions.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 gfx::SizeF view_bounds; | 100 gfx::SizeF view_bounds; |
101 if (!settings().pageScalePinchZoomEnabled) { | 101 if (!settings().pageScalePinchZoomEnabled) { |
102 view_bounds = device_viewport_size(); | 102 view_bounds = device_viewport_size(); |
103 if (LayerImpl* clip_layer = root_scroll_layer_->parent()) { | 103 if (LayerImpl* clip_layer = root_scroll_layer_->parent()) { |
104 // Compensate for non-overlay scrollbars. | 104 // Compensate for non-overlay scrollbars. |
105 if (clip_layer->masksToBounds()) | 105 if (clip_layer->masksToBounds()) |
106 view_bounds = gfx::ScaleSize(clip_layer->bounds(), device_scale_factor()
); | 106 view_bounds = gfx::ScaleSize(clip_layer->bounds(), device_scale_factor()
); |
107 } | 107 } |
108 view_bounds.Scale(1 / pinch_zoom_viewport().page_scale_delta()); | 108 view_bounds.Scale(1 / pinch_zoom_viewport().page_scale_delta()); |
109 } else { | 109 } else { |
110 view_bounds = layout_viewport_size(); | 110 view_bounds = pinch_zoom_viewport().LayoutSpaceViewportSize(); |
111 } | 111 } |
112 | 112 |
113 gfx::Vector2dF max_scroll = gfx::Rect(ScrollableSize()).bottom_right() - | 113 gfx::Vector2dF max_scroll = gfx::Rect(ScrollableSize()).bottom_right() - |
114 gfx::RectF(view_bounds).bottom_right(); | 114 gfx::RectF(view_bounds).bottom_right(); |
115 | 115 |
116 // The viewport may be larger than the contents in some cases, such as | 116 // The viewport may be larger than the contents in some cases, such as |
117 // having a vertical scrollbar but no horizontal overflow. | 117 // having a vertical scrollbar but no horizontal overflow. |
118 max_scroll.ClampToMin(gfx::Vector2dF()); | 118 max_scroll.ClampToMin(gfx::Vector2dF()); |
119 | 119 |
120 root_scroll_layer_->setMaxScrollOffset(gfx::ToFlooredVector2d(max_scroll)); | 120 root_scroll_layer_->setMaxScrollOffset(gfx::ToFlooredVector2d(max_scroll)); |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 | 322 |
323 AnimationRegistrar* LayerTreeImpl::animationRegistrar() const { | 323 AnimationRegistrar* LayerTreeImpl::animationRegistrar() const { |
324 return layer_tree_host_impl_->animationRegistrar(); | 324 return layer_tree_host_impl_->animationRegistrar(); |
325 } | 325 } |
326 | 326 |
327 const PinchZoomViewport& LayerTreeImpl::pinch_zoom_viewport() const { | 327 const PinchZoomViewport& LayerTreeImpl::pinch_zoom_viewport() const { |
328 return layer_tree_host_impl_->pinchZoomViewport(); | 328 return layer_tree_host_impl_->pinchZoomViewport(); |
329 } | 329 } |
330 | 330 |
331 } // namespace cc | 331 } // namespace cc |
OLD | NEW |