Chromium Code Reviews| Index: cc/layer_tree_impl.cc |
| diff --git a/cc/layer_tree_impl.cc b/cc/layer_tree_impl.cc |
| index 769639a4091c9dc2e987c7c7b546658329f23489..4650f277d13f7be0d5f7accea0d6662724e01f14 100644 |
| --- a/cc/layer_tree_impl.cc |
| +++ b/cc/layer_tree_impl.cc |
| @@ -85,28 +85,21 @@ void LayerTreeImpl::UpdateMaxScrollOffset() { |
| if (!root_scroll_layer() || !root_scroll_layer()->children().size()) |
| return; |
| - gfx::SizeF view_bounds = device_viewport_size(); |
| - if (LayerImpl* clip_layer = root_scroll_layer()->parent()) { |
| - // Compensate for non-overlay scrollbars. |
| - if (clip_layer->masksToBounds()) |
| - view_bounds = gfx::ScaleSize(clip_layer->bounds(), device_scale_factor()); |
| - } |
| - |
| - gfx::Size content_bounds = ContentSize(); |
| - if (settings().pageScalePinchZoomEnabled) { |
| - // Pinch with pageScale scrolls entirely in layout space. ContentSize |
| - // returns the bounds including the page scale factor, so calculate the |
| - // pre page-scale layout size here. |
| - float page_scale_factor = pinch_zoom_viewport().page_scale_factor(); |
| - content_bounds.set_width(content_bounds.width() / page_scale_factor); |
| - content_bounds.set_height(content_bounds.height() / page_scale_factor); |
| - } else { |
| + gfx::SizeF view_bounds; |
| + if (!settings().pageScalePinchZoomEnabled) { |
| + view_bounds = device_viewport_size(); |
| + if (LayerImpl* clip_layer = root_scroll_layer()->parent()) { |
| + // Compensate for non-overlay scrollbars. |
| + if (clip_layer->masksToBounds()) |
| + view_bounds = gfx::ScaleSize(clip_layer->bounds(), device_scale_factor()); |
|
danakj
2013/01/17 18:02:49
This bound here (and above) is in physical pixels,
aelias_OOO_until_Jul13
2013/01/17 19:59:46
This clause is for the old coordinate space so it
|
| + } |
| view_bounds.Scale(1 / pinch_zoom_viewport().page_scale_delta()); |
| + } else { |
| + view_bounds = layout_viewport_size(); |
| } |
| - gfx::Vector2dF max_scroll = gfx::Rect(content_bounds).bottom_right() - |
| + gfx::Vector2dF max_scroll = gfx::Rect(ScrollableSize()).bottom_right() - |
|
danakj
2013/01/17 18:02:49
I do like this :)
|
| gfx::RectF(view_bounds).bottom_right(); |
| - max_scroll.Scale(1 / device_scale_factor()); |
| // The viewport may be larger than the contents in some cases, such as |
| // having a vertical scrollbar but no horizontal overflow. |
| @@ -175,12 +168,10 @@ const LayerTreeImpl::LayerList& LayerTreeImpl::RenderSurfaceLayerList() const { |
| return render_surface_layer_list_; |
| } |
| -gfx::Size LayerTreeImpl::ContentSize() const { |
| - // TODO(aelias): Hardcoding the first child here is weird. Think of |
| - // a cleaner way to get the contentBounds on the Impl side. |
| +gfx::Size LayerTreeImpl::ScrollableSize() const { |
| if (!root_scroll_layer() || root_scroll_layer()->children().empty()) |
| return gfx::Size(); |
| - return root_scroll_layer()->children()[0]->contentBounds(); |
| + return root_scroll_layer()->children()[0]->bounds(); |
| } |
| LayerImpl* LayerTreeImpl::LayerById(int id) { |