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

Side by Side 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, 10 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 unified diff | Download patch
« no previous file with comments | « cc/layer_tree_impl.h ('k') | cc/pinch_zoom_viewport.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 LayerImpl* LayerTreeImpl::CurrentlyScrollingLayer() { 87 LayerImpl* LayerTreeImpl::CurrentlyScrollingLayer() {
88 DCHECK(IsActiveTree()); 88 DCHECK(IsActiveTree());
89 return currently_scrolling_layer_; 89 return currently_scrolling_layer_;
90 } 90 }
91 91
92 void LayerTreeImpl::ClearCurrentlyScrollingLayer() { 92 void LayerTreeImpl::ClearCurrentlyScrollingLayer() {
93 currently_scrolling_layer_ = NULL; 93 currently_scrolling_layer_ = NULL;
94 scrolling_layer_id_from_previous_tree_ = 0; 94 scrolling_layer_id_from_previous_tree_ = 0;
95 } 95 }
96 96
97 gfx::SizeF LayerTreeImpl::ScrollableViewportSize() const {
98 gfx::SizeF view_bounds;
99 // The clip layer should be used for scrolling bounds if available since it
100 // adjusts for non-overlay scrollbars. Otherwise, fall back to our knowledge
101 // of the physical viewport size.
102 LayerImpl* clip_layer = NULL;
103 if (root_scroll_layer_)
104 clip_layer = root_scroll_layer_->parent();
105 if (clip_layer && clip_layer->masksToBounds()) {
106 view_bounds = clip_layer->bounds();
107 } else {
108 view_bounds = gfx::ScaleSize(device_viewport_size(),
109 1 / device_scale_factor());
110 }
111 view_bounds.Scale(1 / pinch_zoom_viewport().total_page_scale_factor());
112
113 return view_bounds;
114 }
115
97 void LayerTreeImpl::UpdateMaxScrollOffset() { 116 void LayerTreeImpl::UpdateMaxScrollOffset() {
98 if (!root_scroll_layer_ || !root_scroll_layer_->children().size()) 117 if (!root_scroll_layer_ || !root_scroll_layer_->children().size())
99 return; 118 return;
100 119
101 gfx::SizeF view_bounds;
102 if (!settings().pageScalePinchZoomEnabled) {
103 view_bounds = device_viewport_size();
104 if (LayerImpl* clip_layer = root_scroll_layer_->parent()) {
105 // Compensate for non-overlay scrollbars.
106 if (clip_layer->masksToBounds())
107 view_bounds = gfx::ScaleSize(clip_layer->bounds(), device_scale_factor() );
108 }
109 view_bounds.Scale(1 / pinch_zoom_viewport().page_scale_delta());
110 } else {
111 view_bounds = layout_viewport_size();
112 }
113
114 gfx::Vector2dF max_scroll = gfx::Rect(ScrollableSize()).bottom_right() - 120 gfx::Vector2dF max_scroll = gfx::Rect(ScrollableSize()).bottom_right() -
115 gfx::RectF(view_bounds).bottom_right(); 121 gfx::RectF(ScrollableViewportSize()).bottom_right();
116 122
117 // The viewport may be larger than the contents in some cases, such as 123 // The viewport may be larger than the contents in some cases, such as
118 // having a vertical scrollbar but no horizontal overflow. 124 // having a vertical scrollbar but no horizontal overflow.
119 max_scroll.ClampToMin(gfx::Vector2dF()); 125 max_scroll.ClampToMin(gfx::Vector2dF());
120 126
121 root_scroll_layer_->setMaxScrollOffset(gfx::ToFlooredVector2d(max_scroll)); 127 root_scroll_layer_->setMaxScrollOffset(gfx::ToFlooredVector2d(max_scroll));
122 } 128 }
123 129
124 struct UpdateTilePrioritiesForLayer { 130 struct UpdateTilePrioritiesForLayer {
125 void operator()(LayerImpl *layer) { 131 void operator()(LayerImpl *layer) {
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 365
360 AnimationRegistrar* LayerTreeImpl::animationRegistrar() const { 366 AnimationRegistrar* LayerTreeImpl::animationRegistrar() const {
361 return layer_tree_host_impl_->animationRegistrar(); 367 return layer_tree_host_impl_->animationRegistrar();
362 } 368 }
363 369
364 const PinchZoomViewport& LayerTreeImpl::pinch_zoom_viewport() const { 370 const PinchZoomViewport& LayerTreeImpl::pinch_zoom_viewport() const {
365 return layer_tree_host_impl_->pinchZoomViewport(); 371 return layer_tree_host_impl_->pinchZoomViewport();
366 } 372 }
367 373
368 } // namespace cc 374 } // namespace cc
OLDNEW
« 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