Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(453)

Side by Side Diff: cc/test/fake_scrollbar.cc

Issue 2468423004: Left side vertical MD scrollbars grow toward right. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/test/fake_scrollbar.h ('k') | cc/test/layer_test_common.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_scrollbar.h" 5 #include "cc/test/fake_scrollbar.h"
6 6
7 #include "third_party/skia/include/core/SkCanvas.h" 7 #include "third_party/skia/include/core/SkCanvas.h"
8 #include "ui/gfx/skia_util.h" 8 #include "ui/gfx/skia_util.h"
9 9
10 namespace cc { 10 namespace cc {
11 11
12 FakeScrollbar::FakeScrollbar() 12 FakeScrollbar::FakeScrollbar()
13 : paint_(false), 13 : FakeScrollbar(false, false, HORIZONTAL, false, false) {}
14 has_thumb_(false),
15 is_overlay_(false),
16 thumb_thickness_(10),
17 thumb_length_(5),
18 thumb_opacity_(1),
19 needs_paint_thumb_(true),
20 needs_paint_track_(true),
21 track_rect_(0, 0, 100, 10),
22 fill_color_(SK_ColorGREEN) {}
23 14
24 FakeScrollbar::FakeScrollbar(bool paint, bool has_thumb, bool is_overlay) 15 FakeScrollbar::FakeScrollbar(bool paint, bool has_thumb, bool is_overlay)
16 : FakeScrollbar(paint, has_thumb, HORIZONTAL, false, is_overlay) {}
17
18 FakeScrollbar::FakeScrollbar(bool paint,
19 bool has_thumb,
20 ScrollbarOrientation orientation,
21 bool is_left_side_vertical_scrollbar,
22 bool is_overlay)
25 : paint_(paint), 23 : paint_(paint),
26 has_thumb_(has_thumb), 24 has_thumb_(has_thumb),
25 orientation_(orientation),
26 is_left_side_vertical_scrollbar_(is_left_side_vertical_scrollbar),
27 is_overlay_(is_overlay), 27 is_overlay_(is_overlay),
28 thumb_thickness_(10), 28 thumb_thickness_(10),
29 thumb_length_(5), 29 thumb_length_(5),
30 thumb_opacity_(1), 30 thumb_opacity_(1),
31 needs_paint_thumb_(true), 31 needs_paint_thumb_(true),
32 needs_paint_track_(true), 32 needs_paint_track_(true),
33 track_rect_(0, 0, 100, 10), 33 track_rect_(0, 0, 100, 10),
34 fill_color_(SK_ColorGREEN) {} 34 fill_color_(SK_ColorGREEN) {}
35 35
36 FakeScrollbar::~FakeScrollbar() {} 36 FakeScrollbar::~FakeScrollbar() {}
37 37
38 ScrollbarOrientation FakeScrollbar::Orientation() const { 38 ScrollbarOrientation FakeScrollbar::Orientation() const {
39 return HORIZONTAL; 39 return orientation_;
40 } 40 }
41 41
42 bool FakeScrollbar::IsLeftSideVerticalScrollbar() const { 42 bool FakeScrollbar::IsLeftSideVerticalScrollbar() const {
43 return false; 43 return is_left_side_vertical_scrollbar_;
44 } 44 }
45 45
46 gfx::Point FakeScrollbar::Location() const { return location_; } 46 gfx::Point FakeScrollbar::Location() const { return location_; }
47 47
48 bool FakeScrollbar::IsOverlay() const { return is_overlay_; } 48 bool FakeScrollbar::IsOverlay() const { return is_overlay_; }
49 49
50 bool FakeScrollbar::HasThumb() const { return has_thumb_; } 50 bool FakeScrollbar::HasThumb() const { return has_thumb_; }
51 51
52 int FakeScrollbar::ThumbThickness() const { 52 int FakeScrollbar::ThumbThickness() const {
53 return thumb_thickness_; 53 return thumb_thickness_;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 paint.setStyle(SkPaint::kFill_Style); 85 paint.setStyle(SkPaint::kFill_Style);
86 86
87 // Emulate the how the real scrollbar works by using scrollbar's rect for 87 // Emulate the how the real scrollbar works by using scrollbar's rect for
88 // TRACK and the given content_rect for the THUMB 88 // TRACK and the given content_rect for the THUMB
89 SkRect rect = part == TRACK ? RectToSkRect(TrackRect()) 89 SkRect rect = part == TRACK ? RectToSkRect(TrackRect())
90 : RectToSkRect(content_rect); 90 : RectToSkRect(content_rect);
91 canvas->drawRect(rect, paint); 91 canvas->drawRect(rect, paint);
92 } 92 }
93 93
94 } // namespace cc 94 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/fake_scrollbar.h ('k') | cc/test/layer_test_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698