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

Side by Side Diff: cc/layers/solid_color_scrollbar_layer.cc

Issue 146713002: Revert of Pinch/Zoom Infrastructure & Plumbing CL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/layers/solid_color_scrollbar_layer.h ('k') | cc/layers/solid_color_scrollbar_layer_impl.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/layers/solid_color_scrollbar_layer.h" 5 #include "cc/layers/solid_color_scrollbar_layer.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "cc/layers/layer_impl.h" 8 #include "cc/layers/layer_impl.h"
9 #include "cc/layers/solid_color_scrollbar_layer_impl.h" 9 #include "cc/layers/solid_color_scrollbar_layer_impl.h"
10 10
11 namespace cc { 11 namespace cc {
12 12
13 scoped_ptr<LayerImpl> SolidColorScrollbarLayer::CreateLayerImpl( 13 scoped_ptr<LayerImpl> SolidColorScrollbarLayer::CreateLayerImpl(
14 LayerTreeImpl* tree_impl) { 14 LayerTreeImpl* tree_impl) {
15 const bool kIsOverlayScrollbar = true;
16 return SolidColorScrollbarLayerImpl::Create( 15 return SolidColorScrollbarLayerImpl::Create(
17 tree_impl, 16 tree_impl, id(), orientation(), thumb_thickness_,
18 id(), 17 is_left_side_vertical_scrollbar_).PassAs<LayerImpl>();
19 orientation(),
20 thumb_thickness_,
21 is_left_side_vertical_scrollbar_,
22 kIsOverlayScrollbar).PassAs<LayerImpl>();
23 } 18 }
24 19
25 scoped_refptr<SolidColorScrollbarLayer> SolidColorScrollbarLayer::Create( 20 scoped_refptr<SolidColorScrollbarLayer> SolidColorScrollbarLayer::Create(
26 ScrollbarOrientation orientation, 21 ScrollbarOrientation orientation,
27 int thumb_thickness, 22 int thumb_thickness,
28 bool is_left_side_vertical_scrollbar, 23 bool is_left_side_vertical_scrollbar,
29 Layer* scroll_layer) { 24 int scroll_layer_id) {
30 return make_scoped_refptr(new SolidColorScrollbarLayer( 25 return make_scoped_refptr(new SolidColorScrollbarLayer(
31 orientation, 26 orientation,
32 thumb_thickness, 27 thumb_thickness,
33 is_left_side_vertical_scrollbar, 28 is_left_side_vertical_scrollbar,
34 scroll_layer)); 29 scroll_layer_id));
35 } 30 }
36 31
37 SolidColorScrollbarLayer::SolidColorScrollbarLayer( 32 SolidColorScrollbarLayer::SolidColorScrollbarLayer(
38 ScrollbarOrientation orientation, 33 ScrollbarOrientation orientation,
39 int thumb_thickness, 34 int thumb_thickness,
40 bool is_left_side_vertical_scrollbar, 35 bool is_left_side_vertical_scrollbar,
41 Layer* scroll_layer) 36 int scroll_layer_id)
42 : scroll_layer_(scroll_layer), 37 : scroll_layer_id_(scroll_layer_id),
43 clip_layer_(NULL),
44 orientation_(orientation), 38 orientation_(orientation),
45 thumb_thickness_(thumb_thickness), 39 thumb_thickness_(thumb_thickness),
46 is_left_side_vertical_scrollbar_(is_left_side_vertical_scrollbar) {} 40 is_left_side_vertical_scrollbar_(is_left_side_vertical_scrollbar) {}
47 41
48 SolidColorScrollbarLayer::~SolidColorScrollbarLayer() {} 42 SolidColorScrollbarLayer::~SolidColorScrollbarLayer() {}
49 43
50 ScrollbarLayerInterface* SolidColorScrollbarLayer::ToScrollbarLayer() { 44 ScrollbarLayerInterface* SolidColorScrollbarLayer::ToScrollbarLayer() {
51 return this; 45 return this;
52 } 46 }
53 47
54 void SolidColorScrollbarLayer::PushPropertiesTo(LayerImpl* layer) {
55 Layer::PushPropertiesTo(layer);
56 PushScrollClipPropertiesTo(layer);
57 }
58
59 void SolidColorScrollbarLayer::PushScrollClipPropertiesTo(LayerImpl* layer) {
60 SolidColorScrollbarLayerImpl* scrollbar_layer =
61 static_cast<SolidColorScrollbarLayerImpl*>(layer);
62
63 scrollbar_layer->SetScrollLayerById(scroll_layer_ ? scroll_layer_->id()
64 : Layer::INVALID_ID);
65 scrollbar_layer->SetClipLayerById(clip_layer_ ? clip_layer_->id()
66 : Layer::INVALID_ID);
67 }
68
69 bool SolidColorScrollbarLayer::OpacityCanAnimateOnImplThread() const { 48 bool SolidColorScrollbarLayer::OpacityCanAnimateOnImplThread() const {
70 return true; 49 return true;
71 } 50 }
72 51
73 int SolidColorScrollbarLayer::ScrollLayerId() const { 52 int SolidColorScrollbarLayer::ScrollLayerId() const {
74 return scroll_layer_->id(); 53 return scroll_layer_id_;
75 } 54 }
76 55
77 void SolidColorScrollbarLayer::SetScrollLayer(scoped_refptr<Layer> layer) { 56 void SolidColorScrollbarLayer::SetScrollLayerId(int id) {
78 if (layer == scroll_layer_) 57 if (id == scroll_layer_id_)
79 return; 58 return;
80 59
81 scroll_layer_ = layer; 60 scroll_layer_id_ = id;
82 SetNeedsFullTreeSync(); 61 SetNeedsFullTreeSync();
83 } 62 }
84 63
85 void SolidColorScrollbarLayer::SetClipLayer(scoped_refptr<Layer> layer) {
86 if (layer == clip_layer_)
87 return;
88
89 clip_layer_ = layer;
90 SetNeedsFullTreeSync();
91 }
92
93 ScrollbarOrientation SolidColorScrollbarLayer::orientation() const { 64 ScrollbarOrientation SolidColorScrollbarLayer::orientation() const {
94 return orientation_; 65 return orientation_;
95 } 66 }
96 67
97 } // namespace cc 68 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/solid_color_scrollbar_layer.h ('k') | cc/layers/solid_color_scrollbar_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698