| 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 #ifndef CC_TEST_FAKE_PAINTED_SCROLLBAR_LAYER_H_ | 5 #ifndef CC_TEST_FAKE_PAINTED_SCROLLBAR_LAYER_H_ |
| 6 #define CC_TEST_FAKE_PAINTED_SCROLLBAR_LAYER_H_ | 6 #define CC_TEST_FAKE_PAINTED_SCROLLBAR_LAYER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "cc/layers/painted_scrollbar_layer.h" | 12 #include "cc/layers/painted_scrollbar_layer.h" |
| 13 #include "cc/test/fake_scrollbar.h" | 13 #include "cc/test/fake_scrollbar.h" |
| 14 | 14 |
| 15 namespace base { template<typename T> class AutoReset; } | 15 namespace base { template<typename T> class AutoReset; } |
| 16 | 16 |
| 17 namespace cc { | 17 namespace cc { |
| 18 | 18 |
| 19 class FakePaintedScrollbarLayer : public PaintedScrollbarLayer { | 19 class FakePaintedScrollbarLayer : public PaintedScrollbarLayer { |
| 20 public: | 20 public: |
| 21 static scoped_refptr<FakePaintedScrollbarLayer> Create( | 21 static scoped_refptr<FakePaintedScrollbarLayer> Create( |
| 22 bool paint_during_update, | 22 bool paint_during_update, |
| 23 bool has_thumb, | 23 bool has_thumb, |
| 24 int scrolling_layer_id, | |
| 25 ElementId scrolling_element_id = ElementId()); | 24 ElementId scrolling_element_id = ElementId()); |
| 26 static scoped_refptr<FakePaintedScrollbarLayer> Create( | 25 static scoped_refptr<FakePaintedScrollbarLayer> Create( |
| 27 bool paint_during_update, | 26 bool paint_during_update, |
| 28 bool has_thumb, | 27 bool has_thumb, |
| 29 ScrollbarOrientation orientation, | 28 ScrollbarOrientation orientation, |
| 30 bool is_left_side_vertical_scrollbar, | 29 bool is_left_side_vertical_scrollbar, |
| 31 bool is_overlay, | 30 bool is_overlay, |
| 32 int scrolling_layer_id, | |
| 33 ElementId scrolling_element_id = ElementId()); | 31 ElementId scrolling_element_id = ElementId()); |
| 34 int update_count() const { return update_count_; } | 32 int update_count() const { return update_count_; } |
| 35 void reset_update_count() { update_count_ = 0; } | 33 void reset_update_count() { update_count_ = 0; } |
| 36 | 34 |
| 37 bool Update() override; | 35 bool Update() override; |
| 38 | 36 |
| 39 void PushPropertiesTo(LayerImpl* layer) override; | 37 void PushPropertiesTo(LayerImpl* layer) override; |
| 40 | 38 |
| 41 std::unique_ptr<base::AutoReset<bool>> IgnoreSetNeedsCommit(); | 39 std::unique_ptr<base::AutoReset<bool>> IgnoreSetNeedsCommit(); |
| 42 | 40 |
| 43 size_t push_properties_count() const { return push_properties_count_; } | 41 size_t push_properties_count() const { return push_properties_count_; } |
| 44 void reset_push_properties_count() { push_properties_count_ = 0; } | 42 void reset_push_properties_count() { push_properties_count_ = 0; } |
| 45 | 43 |
| 46 // For unit tests | 44 // For unit tests |
| 47 UIResourceId track_resource_id() { | 45 UIResourceId track_resource_id() { |
| 48 return PaintedScrollbarLayer::track_resource_id(); | 46 return PaintedScrollbarLayer::track_resource_id(); |
| 49 } | 47 } |
| 50 UIResourceId thumb_resource_id() { | 48 UIResourceId thumb_resource_id() { |
| 51 return PaintedScrollbarLayer::thumb_resource_id(); | 49 return PaintedScrollbarLayer::thumb_resource_id(); |
| 52 } | 50 } |
| 53 FakeScrollbar* fake_scrollbar() { | 51 FakeScrollbar* fake_scrollbar() { |
| 54 return fake_scrollbar_; | 52 return fake_scrollbar_; |
| 55 } | 53 } |
| 56 using PaintedScrollbarLayer::UpdateInternalContentScale; | 54 using PaintedScrollbarLayer::UpdateInternalContentScale; |
| 57 using PaintedScrollbarLayer::UpdateThumbAndTrackGeometry; | 55 using PaintedScrollbarLayer::UpdateThumbAndTrackGeometry; |
| 58 | 56 |
| 59 private: | 57 private: |
| 60 FakePaintedScrollbarLayer(FakeScrollbar* fake_scrollbar, | 58 FakePaintedScrollbarLayer(FakeScrollbar* fake_scrollbar, |
| 61 int scrolling_layer_id, | |
| 62 ElementId scrolling_element_id); | 59 ElementId scrolling_element_id); |
| 63 ~FakePaintedScrollbarLayer() override; | 60 ~FakePaintedScrollbarLayer() override; |
| 64 | 61 |
| 65 int update_count_; | 62 int update_count_; |
| 66 size_t push_properties_count_; | 63 size_t push_properties_count_; |
| 67 FakeScrollbar* fake_scrollbar_; | 64 FakeScrollbar* fake_scrollbar_; |
| 68 }; | 65 }; |
| 69 | 66 |
| 70 } // namespace cc | 67 } // namespace cc |
| 71 | 68 |
| 72 #endif // CC_TEST_FAKE_PAINTED_SCROLLBAR_LAYER_H_ | 69 #endif // CC_TEST_FAKE_PAINTED_SCROLLBAR_LAYER_H_ |
| OLD | NEW |