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

Side by Side Diff: cc/trees/layer_tree_impl.cc

Issue 18341009: Refactor cc scrollbar layers to separate solid-color vs desktop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Windows compile. Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « cc/layers/solid_color_scrollbar_layer_impl.cc ('k') | cc/trees/tree_synchronizer.cc » ('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/trees/layer_tree_impl.h" 5 #include "cc/trees/layer_tree_impl.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "cc/animation/keyframed_animation_curve.h" 8 #include "cc/animation/keyframed_animation_curve.h"
9 #include "cc/animation/scrollbar_animation_controller.h" 9 #include "cc/animation/scrollbar_animation_controller.h"
10 #include "cc/debug/traced_value.h" 10 #include "cc/debug/traced_value.h"
11 #include "cc/layers/heads_up_display_layer_impl.h" 11 #include "cc/layers/heads_up_display_layer_impl.h"
12 #include "cc/layers/painted_scrollbar_layer_impl.h"
13 #include "cc/layers/render_surface_impl.h" 12 #include "cc/layers/render_surface_impl.h"
13 #include "cc/layers/scrollbar_layer_impl_base.h"
14 #include "cc/trees/layer_tree_host_common.h" 14 #include "cc/trees/layer_tree_host_common.h"
15 #include "cc/trees/layer_tree_host_impl.h" 15 #include "cc/trees/layer_tree_host_impl.h"
16 #include "ui/gfx/size_conversions.h" 16 #include "ui/gfx/size_conversions.h"
17 #include "ui/gfx/vector2d_conversions.h" 17 #include "ui/gfx/vector2d_conversions.h"
18 18
19 namespace cc { 19 namespace cc {
20 20
21 LayerTreeImpl::LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl) 21 LayerTreeImpl::LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl)
22 : layer_tree_host_impl_(layer_tree_host_impl), 22 : layer_tree_host_impl_(layer_tree_host_impl),
23 source_frame_number_(-1), 23 source_frame_number_(-1),
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 250
251 void LayerTreeImpl::ApplyScrollDeltasSinceBeginFrame() { 251 void LayerTreeImpl::ApplyScrollDeltasSinceBeginFrame() {
252 DCHECK(IsPendingTree()); 252 DCHECK(IsPendingTree());
253 if (!root_layer()) 253 if (!root_layer())
254 return; 254 return;
255 255
256 LayerTreeHostCommon::CallFunctionForSubtree( 256 LayerTreeHostCommon::CallFunctionForSubtree(
257 root_layer(), base::Bind(&ApplyScrollDeltasSinceBeginFrameTo)); 257 root_layer(), base::Bind(&ApplyScrollDeltasSinceBeginFrameTo));
258 } 258 }
259 259
260 // TODO(wjmaclean) This needs to go away, and be replaced with a single core
261 // of login that works for both scrollbar layer types. This is already planned
262 // as part of the larger pinch-zoom re-factoring viewport.
260 void LayerTreeImpl::UpdateSolidColorScrollbars() { 263 void LayerTreeImpl::UpdateSolidColorScrollbars() {
261 DCHECK(settings().solid_color_scrollbars); 264 DCHECK(settings().solid_color_scrollbars);
262 265
263 LayerImpl* root_scroll = RootScrollLayer(); 266 LayerImpl* root_scroll = RootScrollLayer();
264 DCHECK(root_scroll); 267 DCHECK(root_scroll);
265 DCHECK(IsActiveTree()); 268 DCHECK(IsActiveTree());
266 269
267 gfx::RectF scrollable_viewport( 270 gfx::RectF scrollable_viewport(
268 gfx::PointAtOffsetFromOrigin(root_scroll->TotalScrollOffset()), 271 gfx::PointAtOffsetFromOrigin(root_scroll->TotalScrollOffset()),
269 ScrollableViewportSize()); 272 ScrollableViewportSize());
270 float vertical_adjust = 0.0f; 273 float vertical_adjust = 0.0f;
271 if (RootContainerLayer()) 274 if (RootContainerLayer())
272 vertical_adjust = layer_tree_host_impl_->VisibleViewportSize().height() - 275 vertical_adjust = layer_tree_host_impl_->VisibleViewportSize().height() -
273 RootContainerLayer()->bounds().height(); 276 RootContainerLayer()->bounds().height();
274 if (PaintedScrollbarLayerImpl* horiz = 277 if (ScrollbarLayerImplBase* horiz =
275 root_scroll->horizontal_scrollbar_layer()) { 278 root_scroll->horizontal_scrollbar_layer()) {
276 horiz->SetVerticalAdjust(vertical_adjust); 279 horiz->SetVerticalAdjust(vertical_adjust);
277 horiz->SetVisibleToTotalLengthRatio( 280 horiz->SetVisibleToTotalLengthRatio(
278 scrollable_viewport.width() / ScrollableSize().width()); 281 scrollable_viewport.width() / ScrollableSize().width());
279 } 282 }
280 if (PaintedScrollbarLayerImpl* vertical = 283 if (ScrollbarLayerImplBase* vertical =
281 root_scroll->vertical_scrollbar_layer()) { 284 root_scroll->vertical_scrollbar_layer()) {
282 vertical->SetVerticalAdjust(vertical_adjust); 285 vertical->SetVerticalAdjust(vertical_adjust);
283 vertical->SetVisibleToTotalLengthRatio( 286 vertical->SetVisibleToTotalLengthRatio(
284 scrollable_viewport.height() / ScrollableSize().height()); 287 scrollable_viewport.height() / ScrollableSize().height());
285 } 288 }
286 } 289 }
287 290
288 void LayerTreeImpl::UpdateDrawProperties() { 291 void LayerTreeImpl::UpdateDrawProperties() {
289 if (IsActiveTree() && RootScrollLayer() && RootContainerLayer()) 292 if (IsActiveTree() && RootScrollLayer() && RootContainerLayer())
290 UpdateRootScrollLayerSizeDelta(); 293 UpdateRootScrollLayerSizeDelta();
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 const std::vector<LayerImpl*> LayerTreeImpl::LayersWithCopyOutputRequest() 653 const std::vector<LayerImpl*> LayerTreeImpl::LayersWithCopyOutputRequest()
651 const { 654 const {
652 // Only the active tree needs to know about layers with copy requests, as 655 // Only the active tree needs to know about layers with copy requests, as
653 // they are aborted if not serviced during draw. 656 // they are aborted if not serviced during draw.
654 DCHECK(IsActiveTree()); 657 DCHECK(IsActiveTree());
655 658
656 return layers_with_copy_output_request_; 659 return layers_with_copy_output_request_;
657 } 660 }
658 661
659 } // namespace cc 662 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/solid_color_scrollbar_layer_impl.cc ('k') | cc/trees/tree_synchronizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698