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 #include "ui/views/controls/scrollbar/overlay_scroll_bar.h" | 5 #include "ui/views/controls/scrollbar/overlay_scroll_bar.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "cc/paint/paint_flags.h" | 8 #include "cc/paint/paint_flags.h" |
9 #include "third_party/skia/include/core/SkColor.h" | 9 #include "third_party/skia/include/core/SkColor.h" |
10 #include "ui/compositor/scoped_layer_animation_settings.h" | 10 #include "ui/compositor/scoped_layer_animation_settings.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 IsHorizontal() ? 0 : kThumbHoverOffset, 0, 0)); | 60 IsHorizontal() ? 0 : kThumbHoverOffset, 0, 0)); |
61 fill_bounds.Inset(gfx::InsetsF(kThumbStroke, kThumbStroke, | 61 fill_bounds.Inset(gfx::InsetsF(kThumbStroke, kThumbStroke, |
62 IsHorizontal() ? 0 : kThumbStroke, | 62 IsHorizontal() ? 0 : kThumbStroke, |
63 IsHorizontal() ? kThumbStroke : 0)); | 63 IsHorizontal() ? kThumbStroke : 0)); |
64 canvas->DrawRect(fill_bounds, fill_flags); | 64 canvas->DrawRect(fill_bounds, fill_flags); |
65 | 65 |
66 cc::PaintFlags stroke_flags; | 66 cc::PaintFlags stroke_flags; |
67 stroke_flags.setStyle(cc::PaintFlags::kStroke_Style); | 67 stroke_flags.setStyle(cc::PaintFlags::kStroke_Style); |
68 stroke_flags.setColor(SK_ColorWHITE); | 68 stroke_flags.setColor(SK_ColorWHITE); |
69 stroke_flags.setStrokeWidth(kThumbStroke); | 69 stroke_flags.setStrokeWidth(kThumbStroke); |
| 70 stroke_flags.setStrokeCap(cc::PaintFlags::kSquare_Cap); |
70 gfx::RectF stroke_bounds(fill_bounds); | 71 gfx::RectF stroke_bounds(fill_bounds); |
71 stroke_bounds.Inset(gfx::InsetsF(kThumbStroke / 2.f)); | 72 stroke_bounds.Inset(gfx::InsetsF(kThumbStroke / 2.f)); |
72 // The stroke doesn't apply to the far edge of the thumb. | 73 // The stroke doesn't apply to the far edge of the thumb. |
73 SkPath path; | 74 SkPath path; |
74 path.moveTo(gfx::PointFToSkPoint(stroke_bounds.top_right())); | 75 path.moveTo(gfx::PointFToSkPoint(stroke_bounds.top_right())); |
75 path.lineTo(gfx::PointFToSkPoint(stroke_bounds.origin())); | 76 path.lineTo(gfx::PointFToSkPoint(stroke_bounds.origin())); |
76 path.lineTo(gfx::PointFToSkPoint(stroke_bounds.bottom_left())); | 77 path.lineTo(gfx::PointFToSkPoint(stroke_bounds.bottom_left())); |
77 if (IsHorizontal()) { | 78 if (IsHorizontal()) { |
78 path.moveTo(gfx::PointFToSkPoint(stroke_bounds.bottom_right())); | 79 path.moveTo(gfx::PointFToSkPoint(stroke_bounds.bottom_right())); |
79 path.close(); | 80 path.close(); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 | 172 |
172 void OverlayScrollBar::StartHideCountdown() { | 173 void OverlayScrollBar::StartHideCountdown() { |
173 if (IsMouseHovered()) | 174 if (IsMouseHovered()) |
174 return; | 175 return; |
175 hide_timer_.Start( | 176 hide_timer_.Start( |
176 FROM_HERE, base::TimeDelta::FromSeconds(1), | 177 FROM_HERE, base::TimeDelta::FromSeconds(1), |
177 base::Bind(&OverlayScrollBar::Hide, base::Unretained(this))); | 178 base::Bind(&OverlayScrollBar::Hide, base::Unretained(this))); |
178 } | 179 } |
179 | 180 |
180 } // namespace views | 181 } // namespace views |
OLD | NEW |