| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_SCROLLBAR_H_ | 5 #ifndef CC_TEST_FAKE_SCROLLBAR_H_ |
| 6 #define CC_TEST_FAKE_SCROLLBAR_H_ | 6 #define CC_TEST_FAKE_SCROLLBAR_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "cc/input/scrollbar.h" | 9 #include "cc/input/scrollbar.h" |
| 10 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" |
| 11 | 11 |
| 12 namespace cc { | 12 namespace cc { |
| 13 | 13 |
| 14 class FakeScrollbar : public Scrollbar { | 14 class FakeScrollbar : public Scrollbar { |
| 15 public: | 15 public: |
| 16 FakeScrollbar(); | 16 FakeScrollbar(); |
| 17 FakeScrollbar(bool paint, bool has_thumb, bool is_overlay); | 17 FakeScrollbar(bool paint, bool has_thumb, bool is_overlay); |
| 18 ~FakeScrollbar() override; | 18 ~FakeScrollbar() override; |
| 19 | 19 |
| 20 // Scrollbar implementation. | 20 // Scrollbar implementation. |
| 21 ScrollbarOrientation Orientation() const override; | 21 ScrollbarOrientation Orientation() const override; |
| 22 bool IsLeftSideVerticalScrollbar() const override; | 22 bool IsLeftSideVerticalScrollbar() const override; |
| 23 gfx::Point Location() const override; | 23 gfx::Point Location() const override; |
| 24 bool IsOverlay() const override; | 24 bool IsOverlay() const override; |
| 25 bool HasThumb() const override; | 25 bool HasThumb() const override; |
| 26 int ThumbThickness() const override; | 26 int ThumbThickness() const override; |
| 27 int ThumbLength() const override; | 27 int ThumbLength() const override; |
| 28 gfx::Rect TrackRect() const override; | 28 gfx::Rect TrackRect() const override; |
| 29 float ThumbOpacity() const override; |
| 30 float TrackOpacity() const override; |
| 31 bool NeedsPaintPart(ScrollbarPart part) const override; |
| 29 void PaintPart(SkCanvas* canvas, | 32 void PaintPart(SkCanvas* canvas, |
| 30 ScrollbarPart part, | 33 ScrollbarPart part, |
| 31 const gfx::Rect& content_rect) override; | 34 const gfx::Rect& content_rect) override; |
| 32 | 35 |
| 33 void set_location(const gfx::Point& location) { location_ = location; } | 36 void set_location(const gfx::Point& location) { location_ = location; } |
| 34 void set_track_rect(const gfx::Rect& track_rect) { track_rect_ = track_rect; } | 37 void set_track_rect(const gfx::Rect& track_rect) { track_rect_ = track_rect; } |
| 35 void set_thumb_thickness(int thumb_thickness) { | 38 void set_thumb_thickness(int thumb_thickness) { |
| 36 thumb_thickness_ = thumb_thickness; | 39 thumb_thickness_ = thumb_thickness; |
| 37 } | 40 } |
| 38 void set_thumb_length(int thumb_length) { thumb_length_ = thumb_length; } | 41 void set_thumb_length(int thumb_length) { thumb_length_ = thumb_length; } |
| 39 void set_has_thumb(bool has_thumb) { has_thumb_ = has_thumb; } | 42 void set_has_thumb(bool has_thumb) { has_thumb_ = has_thumb; } |
| 40 SkColor paint_fill_color() const { return SK_ColorBLACK | fill_color_; } | 43 SkColor paint_fill_color() const { return SK_ColorBLACK | fill_color_; } |
| 41 | 44 |
| 45 void set_thumb_opacity(float opacity) { thumb_opacity_ = opacity; } |
| 46 void set_track_opacity(float opacity) { track_opacity_ = opacity; } |
| 47 void set_needs_paint_thumb(bool needs_paint) { |
| 48 needs_paint_thumb_ = needs_paint; |
| 49 } |
| 50 void set_needs_paint_track(bool needs_paint) { |
| 51 needs_paint_track_ = needs_paint; |
| 52 } |
| 53 |
| 42 private: | 54 private: |
| 43 bool paint_; | 55 bool paint_; |
| 44 bool has_thumb_; | 56 bool has_thumb_; |
| 45 bool is_overlay_; | 57 bool is_overlay_; |
| 46 int thumb_thickness_; | 58 int thumb_thickness_; |
| 47 int thumb_length_; | 59 int thumb_length_; |
| 60 float thumb_opacity_; |
| 61 float track_opacity_; |
| 62 bool needs_paint_thumb_; |
| 63 bool needs_paint_track_; |
| 48 gfx::Point location_; | 64 gfx::Point location_; |
| 49 gfx::Rect track_rect_; | 65 gfx::Rect track_rect_; |
| 50 SkColor fill_color_; | 66 SkColor fill_color_; |
| 51 | 67 |
| 52 DISALLOW_COPY_AND_ASSIGN(FakeScrollbar); | 68 DISALLOW_COPY_AND_ASSIGN(FakeScrollbar); |
| 53 }; | 69 }; |
| 54 | 70 |
| 55 } // namespace cc | 71 } // namespace cc |
| 56 | 72 |
| 57 #endif // CC_TEST_FAKE_SCROLLBAR_H_ | 73 #endif // CC_TEST_FAKE_SCROLLBAR_H_ |
| OLD | NEW |