| 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 "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "cc/test/fake_scrollbar.h" | 9 #include "cc/test/fake_scrollbar.h" |
| 10 | 10 |
| 11 namespace cc { | 11 namespace cc { |
| 12 | 12 |
| 13 scoped_refptr<FakePaintedScrollbarLayer> FakePaintedScrollbarLayer::Create( | 13 scoped_refptr<FakePaintedScrollbarLayer> FakePaintedScrollbarLayer::Create( |
| 14 bool paint_during_update, | 14 bool paint_during_update, |
| 15 bool has_thumb, | 15 bool has_thumb, |
| 16 int scrolling_layer_id, | |
| 17 ElementId scrolling_element_id) { | 16 ElementId scrolling_element_id) { |
| 18 return Create(paint_during_update, has_thumb, HORIZONTAL, false, false, | 17 return Create(paint_during_update, has_thumb, HORIZONTAL, false, false, |
| 19 scrolling_layer_id, scrolling_element_id); | 18 scrolling_element_id); |
| 20 } | 19 } |
| 21 | 20 |
| 22 scoped_refptr<FakePaintedScrollbarLayer> FakePaintedScrollbarLayer::Create( | 21 scoped_refptr<FakePaintedScrollbarLayer> FakePaintedScrollbarLayer::Create( |
| 23 bool paint_during_update, | 22 bool paint_during_update, |
| 24 bool has_thumb, | 23 bool has_thumb, |
| 25 ScrollbarOrientation orientation, | 24 ScrollbarOrientation orientation, |
| 26 bool is_left_side_vertical_scrollbar, | 25 bool is_left_side_vertical_scrollbar, |
| 27 bool is_overlay, | 26 bool is_overlay, |
| 28 int scrolling_layer_id, | |
| 29 ElementId scrolling_element_id) { | 27 ElementId scrolling_element_id) { |
| 30 FakeScrollbar* fake_scrollbar = | 28 FakeScrollbar* fake_scrollbar = |
| 31 new FakeScrollbar(paint_during_update, has_thumb, orientation, | 29 new FakeScrollbar(paint_during_update, has_thumb, orientation, |
| 32 is_left_side_vertical_scrollbar, is_overlay); | 30 is_left_side_vertical_scrollbar, is_overlay); |
| 33 return make_scoped_refptr(new FakePaintedScrollbarLayer( | 31 return make_scoped_refptr( |
| 34 fake_scrollbar, scrolling_layer_id, scrolling_element_id)); | 32 new FakePaintedScrollbarLayer(fake_scrollbar, scrolling_element_id)); |
| 35 } | 33 } |
| 36 | 34 |
| 37 FakePaintedScrollbarLayer::FakePaintedScrollbarLayer( | 35 FakePaintedScrollbarLayer::FakePaintedScrollbarLayer( |
| 38 FakeScrollbar* fake_scrollbar, | 36 FakeScrollbar* fake_scrollbar, |
| 39 int scrolling_layer_id, | |
| 40 ElementId scrolling_element_id) | 37 ElementId scrolling_element_id) |
| 41 : PaintedScrollbarLayer(std::unique_ptr<Scrollbar>(fake_scrollbar), | 38 : PaintedScrollbarLayer(std::unique_ptr<Scrollbar>(fake_scrollbar), |
| 42 scrolling_layer_id, | |
| 43 scrolling_element_id), | 39 scrolling_element_id), |
| 44 update_count_(0), | 40 update_count_(0), |
| 45 push_properties_count_(0), | 41 push_properties_count_(0), |
| 46 fake_scrollbar_(fake_scrollbar) { | 42 fake_scrollbar_(fake_scrollbar) { |
| 47 SetBounds(gfx::Size(1, 1)); | 43 SetBounds(gfx::Size(1, 1)); |
| 48 SetIsDrawable(true); | 44 SetIsDrawable(true); |
| 49 } | 45 } |
| 50 | 46 |
| 51 FakePaintedScrollbarLayer::~FakePaintedScrollbarLayer() {} | 47 FakePaintedScrollbarLayer::~FakePaintedScrollbarLayer() {} |
| 52 | 48 |
| 53 bool FakePaintedScrollbarLayer::Update() { | 49 bool FakePaintedScrollbarLayer::Update() { |
| 54 bool updated = PaintedScrollbarLayer::Update(); | 50 bool updated = PaintedScrollbarLayer::Update(); |
| 55 ++update_count_; | 51 ++update_count_; |
| 56 return updated; | 52 return updated; |
| 57 } | 53 } |
| 58 | 54 |
| 59 void FakePaintedScrollbarLayer::PushPropertiesTo(LayerImpl* layer) { | 55 void FakePaintedScrollbarLayer::PushPropertiesTo(LayerImpl* layer) { |
| 60 PaintedScrollbarLayer::PushPropertiesTo(layer); | 56 PaintedScrollbarLayer::PushPropertiesTo(layer); |
| 61 ++push_properties_count_; | 57 ++push_properties_count_; |
| 62 } | 58 } |
| 63 | 59 |
| 64 std::unique_ptr<base::AutoReset<bool>> | 60 std::unique_ptr<base::AutoReset<bool>> |
| 65 FakePaintedScrollbarLayer::IgnoreSetNeedsCommit() { | 61 FakePaintedScrollbarLayer::IgnoreSetNeedsCommit() { |
| 66 return base::MakeUnique<base::AutoReset<bool>>(&ignore_set_needs_commit_, | 62 return base::MakeUnique<base::AutoReset<bool>>(&ignore_set_needs_commit_, |
| 67 true); | 63 true); |
| 68 } | 64 } |
| 69 | 65 |
| 70 } // namespace cc | 66 } // namespace cc |
| OLD | NEW |