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

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: Delete maxScrollOffsetChangedByDeviceScaleFactor test 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
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) {

Powered by Google App Engine
This is Rietveld 408576698