| OLD | NEW | 
|---|
| 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/test/fake_painted_scrollbar_layer.h" | 5 #include "cc/test/fake_painted_scrollbar_layer.h" | 
| 6 | 6 | 
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" | 
| 8 #include "cc/test/fake_scrollbar.h" | 8 #include "cc/test/fake_scrollbar.h" | 
| 9 | 9 | 
| 10 namespace cc { | 10 namespace cc { | 
| 11 | 11 | 
| 12 scoped_refptr<FakePaintedScrollbarLayer> FakePaintedScrollbarLayer::Create( | 12 scoped_refptr<FakePaintedScrollbarLayer> FakePaintedScrollbarLayer::Create( | 
| 13     const LayerSettings& settings, |  | 
| 14     bool paint_during_update, | 13     bool paint_during_update, | 
| 15     bool has_thumb, | 14     bool has_thumb, | 
| 16     int scrolling_layer_id) { | 15     int scrolling_layer_id) { | 
| 17   FakeScrollbar* fake_scrollbar = new FakeScrollbar( | 16   FakeScrollbar* fake_scrollbar = new FakeScrollbar( | 
| 18       paint_during_update, has_thumb, false); | 17       paint_during_update, has_thumb, false); | 
| 19   return make_scoped_refptr(new FakePaintedScrollbarLayer( | 18   return make_scoped_refptr( | 
| 20       settings, fake_scrollbar, scrolling_layer_id)); | 19       new FakePaintedScrollbarLayer(fake_scrollbar, scrolling_layer_id)); | 
| 21 } | 20 } | 
| 22 | 21 | 
| 23 FakePaintedScrollbarLayer::FakePaintedScrollbarLayer( | 22 FakePaintedScrollbarLayer::FakePaintedScrollbarLayer( | 
| 24     const LayerSettings& settings, |  | 
| 25     FakeScrollbar* fake_scrollbar, | 23     FakeScrollbar* fake_scrollbar, | 
| 26     int scrolling_layer_id) | 24     int scrolling_layer_id) | 
| 27     : PaintedScrollbarLayer(settings, | 25     : PaintedScrollbarLayer(scoped_ptr<Scrollbar>(fake_scrollbar), | 
| 28                             scoped_ptr<Scrollbar>(fake_scrollbar), |  | 
| 29                             scrolling_layer_id), | 26                             scrolling_layer_id), | 
| 30       update_count_(0), | 27       update_count_(0), | 
| 31       push_properties_count_(0), | 28       push_properties_count_(0), | 
| 32       fake_scrollbar_(fake_scrollbar) { | 29       fake_scrollbar_(fake_scrollbar) { | 
| 33   SetBounds(gfx::Size(1, 1)); | 30   SetBounds(gfx::Size(1, 1)); | 
| 34   SetIsDrawable(true); | 31   SetIsDrawable(true); | 
| 35 } | 32 } | 
| 36 | 33 | 
| 37 FakePaintedScrollbarLayer::~FakePaintedScrollbarLayer() {} | 34 FakePaintedScrollbarLayer::~FakePaintedScrollbarLayer() {} | 
| 38 | 35 | 
| 39 bool FakePaintedScrollbarLayer::Update() { | 36 bool FakePaintedScrollbarLayer::Update() { | 
| 40   bool updated = PaintedScrollbarLayer::Update(); | 37   bool updated = PaintedScrollbarLayer::Update(); | 
| 41   ++update_count_; | 38   ++update_count_; | 
| 42   return updated; | 39   return updated; | 
| 43 } | 40 } | 
| 44 | 41 | 
| 45 void FakePaintedScrollbarLayer::PushPropertiesTo(LayerImpl* layer) { | 42 void FakePaintedScrollbarLayer::PushPropertiesTo(LayerImpl* layer) { | 
| 46   PaintedScrollbarLayer::PushPropertiesTo(layer); | 43   PaintedScrollbarLayer::PushPropertiesTo(layer); | 
| 47   ++push_properties_count_; | 44   ++push_properties_count_; | 
| 48 } | 45 } | 
| 49 | 46 | 
| 50 scoped_ptr<base::AutoReset<bool>> | 47 scoped_ptr<base::AutoReset<bool>> | 
| 51 FakePaintedScrollbarLayer::IgnoreSetNeedsCommit() { | 48 FakePaintedScrollbarLayer::IgnoreSetNeedsCommit() { | 
| 52   return make_scoped_ptr( | 49   return make_scoped_ptr( | 
| 53       new base::AutoReset<bool>(&ignore_set_needs_commit_, true)); | 50       new base::AutoReset<bool>(&ignore_set_needs_commit_, true)); | 
| 54 } | 51 } | 
| 55 | 52 | 
| 56 }  // namespace cc | 53 }  // namespace cc | 
| OLD | NEW | 
|---|