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..39d85793599d7a1b97bb374623fba3878857f293 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) { |
| @@ -237,6 +237,7 @@ void NativeThemeAura::PaintScrollbarThumb( |
| break; |
| } |
| +#if defined(OS_ANDROID) |
|
bokan
2017/03/22 20:07:25
This file is only compiled for Aura platforms so C
|
| // In overlay mode, draw a stroke (border). |
| constexpr int kStrokeWidth = kOverlayScrollbarStrokeWidth; |
| cc::PaintFlags flags; |
| @@ -252,6 +253,56 @@ void NativeThemeAura::PaintScrollbarThumb( |
| // Inset the all the edges edges so we fill-in the stroke below. |
| thumb_rect.Inset(kStrokeWidth, kStrokeWidth); |
| +#else // OS_ANDROID |
| + // In overlay mode, draw a stroke (border). |
| + constexpr int kStrokeWidth = kOverlayScrollbarStrokeWidth; |
| + cc::PaintFlags flags; |
| + flags.setColor(SkColorSetA( |
| + kOverlayScrollbarStrokeColor[params.scrollbar_theme], stroke_alpha)); |
| + flags.setStyle(cc::PaintFlags::kStroke_Style); |
| + flags.setStrokeWidth(kStrokeWidth); |
| + |
| + gfx::RectF stroke_rect(thumb_rect); |
| + constexpr float kHalfStrokeWidth = kStrokeWidth / 2.f; |
| + |
| + float left_stroke_width, top_stroke_width, right_stroke_width, |
| + bottom_stroke_width; |
| + |
| + left_stroke_width = top_stroke_width = right_stroke_width = |
| + bottom_stroke_width = kHalfStrokeWidth; |
| + |
| + if (params.isLeftVerticalScrollbar) { |
| + left_stroke_width = 0; |
| + } else if (params.isVerticalScrollbar) { |
| + right_stroke_width = 0; |
| + } else { |
| + bottom_stroke_width = 0; |
| + } |
| + |
| + if (params.hitStart) { |
| + if (params.isVerticalScrollbar) { |
| + top_stroke_width = 0; |
| + } else { |
| + left_stroke_width = 0; |
| + } |
| + } |
| + |
| + if (params.hitEnd) { |
| + if (params.isVerticalScrollbar) { |
| + bottom_stroke_width = 0; |
| + } else { |
| + right_stroke_width = 0; |
| + } |
| + } |
| + |
| + stroke_rect.Inset(left_stroke_width, top_stroke_width, right_stroke_width, |
| + bottom_stroke_width); |
| + canvas->drawRect(gfx::RectFToSkRect(stroke_rect), flags); |
| + |
| + // Inset the all the edges edges so we fill-in the stroke below. |
| + thumb_rect.Inset(left_stroke_width * 2, top_stroke_width * 2, |
| + right_stroke_width * 2, bottom_stroke_width * 2); |
| +#endif |
| } else { |
| switch (state) { |
| case NativeTheme::kDisabled: |