| 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); | 24 int scrolling_layer_id, |
| 25 ElementId scrolling_element_id = ElementId()); |
| 25 static scoped_refptr<FakePaintedScrollbarLayer> Create( | 26 static scoped_refptr<FakePaintedScrollbarLayer> Create( |
| 26 bool paint_during_update, | 27 bool paint_during_update, |
| 27 bool has_thumb, | 28 bool has_thumb, |
| 28 ScrollbarOrientation orientation, | 29 ScrollbarOrientation orientation, |
| 29 bool is_left_side_vertical_scrollbar, | 30 bool is_left_side_vertical_scrollbar, |
| 30 bool is_overlay, | 31 bool is_overlay, |
| 31 int scrolling_layer_id); | 32 int scrolling_layer_id, |
| 33 ElementId scrolling_element_id = ElementId()); |
| 32 int update_count() const { return update_count_; } | 34 int update_count() const { return update_count_; } |
| 33 void reset_update_count() { update_count_ = 0; } | 35 void reset_update_count() { update_count_ = 0; } |
| 34 | 36 |
| 35 bool Update() override; | 37 bool Update() override; |
| 36 | 38 |
| 37 void PushPropertiesTo(LayerImpl* layer) override; | 39 void PushPropertiesTo(LayerImpl* layer) override; |
| 38 | 40 |
| 39 std::unique_ptr<base::AutoReset<bool>> IgnoreSetNeedsCommit(); | 41 std::unique_ptr<base::AutoReset<bool>> IgnoreSetNeedsCommit(); |
| 40 | 42 |
| 41 size_t push_properties_count() const { return push_properties_count_; } | 43 size_t push_properties_count() const { return push_properties_count_; } |
| 42 void reset_push_properties_count() { push_properties_count_ = 0; } | 44 void reset_push_properties_count() { push_properties_count_ = 0; } |
| 43 | 45 |
| 44 // For unit tests | 46 // For unit tests |
| 45 UIResourceId track_resource_id() { | 47 UIResourceId track_resource_id() { |
| 46 return PaintedScrollbarLayer::track_resource_id(); | 48 return PaintedScrollbarLayer::track_resource_id(); |
| 47 } | 49 } |
| 48 UIResourceId thumb_resource_id() { | 50 UIResourceId thumb_resource_id() { |
| 49 return PaintedScrollbarLayer::thumb_resource_id(); | 51 return PaintedScrollbarLayer::thumb_resource_id(); |
| 50 } | 52 } |
| 51 FakeScrollbar* fake_scrollbar() { | 53 FakeScrollbar* fake_scrollbar() { |
| 52 return fake_scrollbar_; | 54 return fake_scrollbar_; |
| 53 } | 55 } |
| 54 using PaintedScrollbarLayer::UpdateInternalContentScale; | 56 using PaintedScrollbarLayer::UpdateInternalContentScale; |
| 55 using PaintedScrollbarLayer::UpdateThumbAndTrackGeometry; | 57 using PaintedScrollbarLayer::UpdateThumbAndTrackGeometry; |
| 56 | 58 |
| 57 private: | 59 private: |
| 58 FakePaintedScrollbarLayer(FakeScrollbar* fake_scrollbar, | 60 FakePaintedScrollbarLayer(FakeScrollbar* fake_scrollbar, |
| 59 int scrolling_layer_id); | 61 int scrolling_layer_id, |
| 62 ElementId scrolling_element_id); |
| 60 ~FakePaintedScrollbarLayer() override; | 63 ~FakePaintedScrollbarLayer() override; |
| 61 | 64 |
| 62 int update_count_; | 65 int update_count_; |
| 63 size_t push_properties_count_; | 66 size_t push_properties_count_; |
| 64 FakeScrollbar* fake_scrollbar_; | 67 FakeScrollbar* fake_scrollbar_; |
| 65 }; | 68 }; |
| 66 | 69 |
| 67 } // namespace cc | 70 } // namespace cc |
| 68 | 71 |
| 69 #endif // CC_TEST_FAKE_PAINTED_SCROLLBAR_LAYER_H_ | 72 #endif // CC_TEST_FAKE_PAINTED_SCROLLBAR_LAYER_H_ |
| OLD | NEW |