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/test/fake_painted_scrollbar_layer.h"
7 #include "base/auto_reset.h"
8 #include "cc/resources/resource_update_queue.h"
9 #include "cc/test/fake_scrollbar.h"
13 scoped_refptr
<FakePaintedScrollbarLayer
> FakePaintedScrollbarLayer::Create(
14 const LayerSettings
& settings
,
15 bool paint_during_update
,
17 int scrolling_layer_id
) {
18 FakeScrollbar
* fake_scrollbar
= new FakeScrollbar(
19 paint_during_update
, has_thumb
, false);
20 return make_scoped_refptr(new FakePaintedScrollbarLayer(
21 settings
, fake_scrollbar
, scrolling_layer_id
));
24 FakePaintedScrollbarLayer::FakePaintedScrollbarLayer(
25 const LayerSettings
& settings
,
26 FakeScrollbar
* fake_scrollbar
,
27 int scrolling_layer_id
)
28 : PaintedScrollbarLayer(settings
,
29 scoped_ptr
<Scrollbar
>(fake_scrollbar
).Pass(),
32 push_properties_count_(0),
33 fake_scrollbar_(fake_scrollbar
) {
34 SetBounds(gfx::Size(1, 1));
38 FakePaintedScrollbarLayer::~FakePaintedScrollbarLayer() {}
40 bool FakePaintedScrollbarLayer::Update(
41 ResourceUpdateQueue
* queue
,
42 const OcclusionTracker
<Layer
>* occlusion
) {
43 bool updated
= PaintedScrollbarLayer::Update(queue
, occlusion
);
48 void FakePaintedScrollbarLayer::PushPropertiesTo(LayerImpl
* layer
) {
49 PaintedScrollbarLayer::PushPropertiesTo(layer
);
50 ++push_properties_count_
;
53 scoped_ptr
<base::AutoReset
<bool>>
54 FakePaintedScrollbarLayer::IgnoreSetNeedsCommit() {
55 return make_scoped_ptr(
56 new base::AutoReset
<bool>(&ignore_set_needs_commit_
, true));