Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2667)

Unified Diff: cc/layer_tree_impl.cc

Issue 11958004: Make new-style page scale work on Android. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase to 177887 Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layer_tree_impl.h ('k') | cc/pinch_zoom_viewport.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer_tree_impl.cc
diff --git a/cc/layer_tree_impl.cc b/cc/layer_tree_impl.cc
index 9f9588b85adfdf276969106f55365069def58362..328116a7c64ac5d7d7346098b98228890b234cb3 100644
--- a/cc/layer_tree_impl.cc
+++ b/cc/layer_tree_impl.cc
@@ -97,28 +97,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());
+ }
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() -
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.
@@ -187,7 +180,7 @@ const LayerTreeImpl::LayerList& LayerTreeImpl::RenderSurfaceLayerList() const {
return render_surface_layer_list_;
}
-gfx::Size LayerTreeImpl::ContentSize() const {
+gfx::Size LayerTreeImpl::ScrollableSize() const {
if (!root_scroll_layer_ || root_scroll_layer_->children().empty())
return gfx::Size();
return root_scroll_layer_->children()[0]->bounds();
« no previous file with comments | « cc/layer_tree_impl.h ('k') | cc/pinch_zoom_viewport.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698