Pass gfx::Rect and gfx::RectF by const ref.
[chromium-blink-merge.git] / cc / test / fake_scrollbar.cc
blob7285660f17016fc5be6e56070a40a817d7dfe0e2
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
3 // found in the LICENSE file.
5 #include "cc/test/fake_scrollbar.h"
7 #include "third_party/skia/include/core/SkCanvas.h"
9 namespace cc {
11 FakeScrollbar::FakeScrollbar()
12 : paint_(false),
13 has_thumb_(false),
14 is_overlay_(false),
15 thumb_thickness_(10),
16 thumb_length_(5),
17 track_rect_(0, 0, 100, 10),
18 fill_color_(SK_ColorGREEN) {}
20 FakeScrollbar::FakeScrollbar(bool paint, bool has_thumb, bool is_overlay)
21 : paint_(paint),
22 has_thumb_(has_thumb),
23 is_overlay_(is_overlay),
24 thumb_thickness_(10),
25 thumb_length_(5),
26 track_rect_(0, 0, 100, 10),
27 fill_color_(SK_ColorGREEN) {}
29 FakeScrollbar::~FakeScrollbar() {}
31 ScrollbarOrientation FakeScrollbar::Orientation() const {
32 return HORIZONTAL;
35 bool FakeScrollbar::IsLeftSideVerticalScrollbar() const {
36 return false;
39 gfx::Point FakeScrollbar::Location() const { return location_; }
41 bool FakeScrollbar::IsOverlay() const { return is_overlay_; }
43 bool FakeScrollbar::HasThumb() const { return has_thumb_; }
45 int FakeScrollbar::ThumbThickness() const {
46 return thumb_thickness_;
49 int FakeScrollbar::ThumbLength() const {
50 return thumb_length_;
53 gfx::Rect FakeScrollbar::TrackRect() const {
54 return track_rect_;
57 void FakeScrollbar::PaintPart(SkCanvas* canvas,
58 ScrollbarPart part,
59 const gfx::Rect& content_rect) {
60 if (!paint_)
61 return;
63 // Fill the scrollbar with a different color each time.
64 fill_color_++;
65 canvas->clear(SK_ColorBLACK | fill_color_);
68 } // namespace cc