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"
13 scoped_ptr
<LayerImpl
> SolidColorScrollbarLayer::CreateLayerImpl(
14 LayerTreeImpl
* tree_impl
) {
15 return SolidColorScrollbarLayerImpl::Create(
16 tree_impl
, id(), orientation(), thumb_thickness_
,
17 is_left_side_vertical_scrollbar_
).PassAs
<LayerImpl
>();
20 scoped_refptr
<SolidColorScrollbarLayer
> SolidColorScrollbarLayer::Create(
21 ScrollbarOrientation orientation
,
23 bool is_left_side_vertical_scrollbar
,
24 int scroll_layer_id
) {
25 return make_scoped_refptr(new SolidColorScrollbarLayer(
28 is_left_side_vertical_scrollbar
,
32 SolidColorScrollbarLayer::SolidColorScrollbarLayer(
33 ScrollbarOrientation orientation
,
35 bool is_left_side_vertical_scrollbar
,
37 : scroll_layer_id_(scroll_layer_id
),
38 orientation_(orientation
),
39 thumb_thickness_(thumb_thickness
),
40 is_left_side_vertical_scrollbar_(is_left_side_vertical_scrollbar
) {}
42 SolidColorScrollbarLayer::~SolidColorScrollbarLayer() {}
44 ScrollbarLayerInterface
* SolidColorScrollbarLayer::ToScrollbarLayer() {
48 bool SolidColorScrollbarLayer::OpacityCanAnimateOnImplThread() const {
52 int SolidColorScrollbarLayer::ScrollLayerId() const {
53 return scroll_layer_id_
;
56 void SolidColorScrollbarLayer::SetScrollLayerId(int id
) {
57 if (id
== scroll_layer_id_
)
60 scroll_layer_id_
= id
;
61 SetNeedsFullTreeSync();
64 ScrollbarOrientation
SolidColorScrollbarLayer::orientation() const {