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

Unified Diff: cc/layer_tree_impl.cc

Issue 12045002: Delete zoomed_viewport_offset_ and its users. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add imports for DisabledTest and rebase to 179449 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 be9a280e090d15304df43ef91c26b0b1e7c4d170..cbc2ee1fa1e021d530bbca427e6ce1aaca16a807 100644
--- a/cc/layer_tree_impl.cc
+++ b/cc/layer_tree_impl.cc
@@ -94,25 +94,31 @@ void LayerTreeImpl::ClearCurrentlyScrollingLayer() {
scrolling_layer_id_from_previous_tree_ = 0;
}
-void LayerTreeImpl::UpdateMaxScrollOffset() {
- if (!root_scroll_layer_ || !root_scroll_layer_->children().size())
- return;
-
+gfx::SizeF LayerTreeImpl::ScrollableViewportSize() const {
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());
+ // The clip layer should be used for scrolling bounds if available since it
+ // adjusts for non-overlay scrollbars. Otherwise, fall back to our knowledge
+ // of the physical viewport size.
+ LayerImpl* clip_layer = NULL;
+ if (root_scroll_layer_)
+ clip_layer = root_scroll_layer_->parent();
+ if (clip_layer && clip_layer->masksToBounds()) {
+ view_bounds = clip_layer->bounds();
} else {
- view_bounds = layout_viewport_size();
+ view_bounds = gfx::ScaleSize(device_viewport_size(),
+ 1 / device_scale_factor());
}
+ view_bounds.Scale(1 / pinch_zoom_viewport().total_page_scale_factor());
+
+ return view_bounds;
+}
+
+void LayerTreeImpl::UpdateMaxScrollOffset() {
+ if (!root_scroll_layer_ || !root_scroll_layer_->children().size())
+ return;
gfx::Vector2dF max_scroll = gfx::Rect(ScrollableSize()).bottom_right() -
- gfx::RectF(view_bounds).bottom_right();
+ gfx::RectF(ScrollableViewportSize()).bottom_right();
// The viewport may be larger than the contents in some cases, such as
// having a vertical scrollbar but no horizontal overflow.
« 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