Chromium Code Reviews| Index: ui/native_theme/native_theme_aura.cc |
| diff --git a/ui/native_theme/native_theme_aura.cc b/ui/native_theme/native_theme_aura.cc |
| index 76283878e06a13f8cb77b8adbc90799dfea2aa28..1c301c8bf70bf32e65e650097b1dbfa60991391e 100644 |
| --- a/ui/native_theme/native_theme_aura.cc |
| +++ b/ui/native_theme/native_theme_aura.cc |
| @@ -186,7 +186,7 @@ void NativeThemeAura::PaintScrollbarThumb( |
| Part part, |
| State state, |
| const gfx::Rect& rect, |
| - ScrollbarOverlayColorTheme theme) const { |
| + const NativeTheme::ScrollbarThumbExtraParams& params) const { |
| // Do not paint if state is disabled. |
| if (state == kDisabled) |
| return; |
| @@ -212,7 +212,7 @@ void NativeThemeAura::PaintScrollbarThumb( |
| constexpr SkColor kOverlayScrollbarStrokeColor[] = {SK_ColorWHITE, |
| SK_ColorBLACK}; |
| - thumb_color = kOverlayScrollbarThumbColor[theme]; |
| + thumb_color = kOverlayScrollbarThumbColor[params.scrollbar_theme]; |
| SkAlpha stroke_alpha = SK_AlphaTRANSPARENT; |
| switch (state) { |
| @@ -240,18 +240,33 @@ void NativeThemeAura::PaintScrollbarThumb( |
| // In overlay mode, draw a stroke (border). |
| constexpr int kStrokeWidth = kOverlayScrollbarStrokeWidth; |
| cc::PaintFlags flags; |
| - flags.setColor( |
| - SkColorSetA(kOverlayScrollbarStrokeColor[theme], stroke_alpha)); |
| + flags.setColor(SkColorSetA( |
| + kOverlayScrollbarStrokeColor[params.scrollbar_theme], stroke_alpha)); |
| flags.setStyle(cc::PaintFlags::kStroke_Style); |
| flags.setStrokeWidth(kStrokeWidth); |
| + int leftStrokeWidth, topStrokeWidth, rightStrokeWidth, bottomStrokeWidth; |
| + leftStrokeWidth = topStrokeWidth = rightStrokeWidth = bottomStrokeWidth = |
| + kStrokeWidth; |
| + |
| + // Flush the stroke when it close to border. |
|
bokan
2017/03/23 21:34:41
A better comment would be "The edge to which the s
|
| + if (part == NativeTheme::kScrollbarVerticalThumb) { |
| + if (params.isLeftVerticalScrollbar) |
| + leftStrokeWidth = 0; |
| + else |
| + rightStrokeWidth = 0; |
| + } else { |
| + bottomStrokeWidth = 0; |
| + } |
| + |
| gfx::RectF stroke_rect(thumb_rect); |
| - constexpr float kHalfStrokeWidth = kStrokeWidth / 2.f; |
| - stroke_rect.Inset(kHalfStrokeWidth, kHalfStrokeWidth); |
| + stroke_rect.Inset(leftStrokeWidth / 2.f, topStrokeWidth / 2.f, |
|
bokan
2017/03/23 21:34:41
The drawRect call below is the one that draws the
|
| + rightStrokeWidth / 2.f, bottomStrokeWidth / 2.f); |
| canvas->drawRect(gfx::RectFToSkRect(stroke_rect), flags); |
| // Inset the all the edges edges so we fill-in the stroke below. |
| - thumb_rect.Inset(kStrokeWidth, kStrokeWidth); |
| + thumb_rect.Inset(leftStrokeWidth, topStrokeWidth, rightStrokeWidth, |
| + bottomStrokeWidth); |
| } else { |
| switch (state) { |
| case NativeTheme::kDisabled: |