Revert "Reland c91b178b07b0d - Delete dead signin code (SigninGlobalError)"
[chromium-blink-merge.git] / cc / layers / solid_color_scrollbar_layer.cc
blob4ed55cacd3ae3597f3a6a72b7c41fe9ee086031e
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
3 // found in the LICENSE file.
5 #include "cc/layers/solid_color_scrollbar_layer.h"
7 #include "base/memory/scoped_ptr.h"
8 #include "cc/layers/layer_impl.h"
9 #include "cc/layers/solid_color_scrollbar_layer_impl.h"
11 namespace cc {
13 scoped_ptr<LayerImpl> SolidColorScrollbarLayer::CreateLayerImpl(
14 LayerTreeImpl* tree_impl) {
15 const bool kIsOverlayScrollbar = true;
16 return SolidColorScrollbarLayerImpl::Create(tree_impl,
17 id(),
18 orientation(),
19 thumb_thickness_,
20 track_start_,
21 is_left_side_vertical_scrollbar_,
22 kIsOverlayScrollbar);
25 scoped_refptr<SolidColorScrollbarLayer> SolidColorScrollbarLayer::Create(
26 const LayerSettings& settings,
27 ScrollbarOrientation orientation,
28 int thumb_thickness,
29 int track_start,
30 bool is_left_side_vertical_scrollbar,
31 int scroll_layer_id) {
32 return make_scoped_refptr(new SolidColorScrollbarLayer(
33 settings, orientation, thumb_thickness, track_start,
34 is_left_side_vertical_scrollbar, scroll_layer_id));
37 SolidColorScrollbarLayer::SolidColorScrollbarLayer(
38 const LayerSettings& settings,
39 ScrollbarOrientation orientation,
40 int thumb_thickness,
41 int track_start,
42 bool is_left_side_vertical_scrollbar,
43 int scroll_layer_id)
44 : Layer(settings),
45 scroll_layer_id_(Layer::INVALID_ID),
46 clip_layer_id_(scroll_layer_id),
47 orientation_(orientation),
48 thumb_thickness_(thumb_thickness),
49 track_start_(track_start),
50 is_left_side_vertical_scrollbar_(is_left_side_vertical_scrollbar) {
53 SolidColorScrollbarLayer::~SolidColorScrollbarLayer() {}
55 ScrollbarLayerInterface* SolidColorScrollbarLayer::ToScrollbarLayer() {
56 return this;
59 void SolidColorScrollbarLayer::PushPropertiesTo(LayerImpl* layer) {
60 Layer::PushPropertiesTo(layer);
61 PushScrollClipPropertiesTo(layer);
64 void SolidColorScrollbarLayer::PushScrollClipPropertiesTo(LayerImpl* layer) {
65 SolidColorScrollbarLayerImpl* scrollbar_layer =
66 static_cast<SolidColorScrollbarLayerImpl*>(layer);
68 scrollbar_layer->SetScrollLayerAndClipLayerByIds(scroll_layer_id_,
69 clip_layer_id_);
72 void SolidColorScrollbarLayer::SetNeedsDisplayRect(const gfx::Rect& rect) {
73 // Never needs repaint.
76 bool SolidColorScrollbarLayer::OpacityCanAnimateOnImplThread() const {
77 return true;
80 int SolidColorScrollbarLayer::ScrollLayerId() const {
81 return scroll_layer_id_;
84 void SolidColorScrollbarLayer::SetScrollLayer(int layer_id) {
85 if (layer_id == scroll_layer_id_)
86 return;
88 scroll_layer_id_ = layer_id;
89 SetNeedsFullTreeSync();
92 void SolidColorScrollbarLayer::SetClipLayer(int layer_id) {
93 if (layer_id == clip_layer_id_)
94 return;
96 clip_layer_id_ = layer_id;
97 SetNeedsFullTreeSync();
100 ScrollbarOrientation SolidColorScrollbarLayer::orientation() const {
101 return orientation_;
104 } // namespace cc