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 0c3255cb18b6749ccadab206376634289dce1b76..208f06ac89d24125baab3d6a12cfaf41d8e068ee 100644 |
| --- a/ui/native_theme/native_theme_aura.cc |
| +++ b/ui/native_theme/native_theme_aura.cc |
| @@ -34,6 +34,8 @@ namespace { |
| // this painting code are defined in overlay_scrollbar_constants_aura.h. |
| constexpr int kOverlayScrollbarStrokeWidth = 1; |
| constexpr int kOverlayScrollbarMinimumLength = 12; |
| +const gfx::Size kOverlayScrollbarNinePatchCanvasSize(5, 5); |
|
Evan Stade
2017/03/02 02:32:01
sorry, what I actually meant here was something li
bokan
2017/03/02 13:55:36
Ah, that does sound better. Done (names slightly a
|
| +const gfx::Rect kOverlayScrollbarNinePatchAperture(2, 2, 1, 1); |
| const SkColor kTrackColor = SkColorSetRGB(0xF1, 0xF1, 0xF1); |
| @@ -317,4 +319,29 @@ gfx::Size NativeThemeAura::GetPartSize(Part part, |
| return NativeThemeBase::GetPartSize(part, state, extra); |
| } |
| +bool NativeThemeAura::SupportsNinePatch(Part part) const { |
| + if (!IsOverlayScrollbarEnabled()) |
| + return false; |
| + |
| + return part == kScrollbarHorizontalThumb || part == kScrollbarVerticalThumb; |
| +} |
| + |
| +gfx::Size NativeThemeAura::GetNinePatchCanvasSize(Part part) const { |
| + DCHECK(SupportsNinePatch(part)); |
| + |
| + // 2 pixel border with 1 pixel center patch. The border is 2 pixels so that |
| + // the inner pixel can match the center tile color. This prevents color |
| + // interpolation between the patches. |
| + return kOverlayScrollbarNinePatchCanvasSize; |
| +} |
| + |
| +gfx::Rect NativeThemeAura::GetNinePatchAperture(Part part) const { |
| + DCHECK(SupportsNinePatch(part)); |
| + |
| + // The aperture is a single pixel surrounded by a non-resizing 2 pixel border. |
| + // The stroke is actually only 1 pixel wide but we need to use 2 pixels so |
| + // that the center patch doesn't try to blend colors between patches. |
| + return kOverlayScrollbarNinePatchAperture; |
| +} |
| + |
| } // namespace ui |