OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/native_theme/native_theme_aura.h" | 5 #include "ui/native_theme/native_theme_aura.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 // TODO(bokan): We should probably make sure code using overlay | 308 // TODO(bokan): We should probably make sure code using overlay |
309 // scrollbars isn't asking for part sizes that don't exist. | 309 // scrollbars isn't asking for part sizes that don't exist. |
310 // crbug.com/657159. | 310 // crbug.com/657159. |
311 break; | 311 break; |
312 } | 312 } |
313 } | 313 } |
314 | 314 |
315 return NativeThemeBase::GetPartSize(part, state, extra); | 315 return NativeThemeBase::GetPartSize(part, state, extra); |
316 } | 316 } |
317 | 317 |
| 318 bool NativeThemeAura::SupportsNinePatch(Part part) const { |
| 319 if (!IsOverlayScrollbarEnabled()) |
| 320 return false; |
| 321 |
| 322 return part == kScrollbarHorizontalThumb || part == kScrollbarVerticalThumb; |
| 323 } |
| 324 |
| 325 gfx::Size NativeThemeAura::GetNinePatchCanvasSize(Part part) const { |
| 326 DCHECK(SupportsNinePatch(part)); |
| 327 |
| 328 // 2 pixel border with 1 pixel center patch. |
| 329 return gfx::Size(5, 5); |
| 330 } |
| 331 |
| 332 gfx::Rect NativeThemeAura::GetNinePatchAperture(Part part) const { |
| 333 DCHECK(SupportsNinePatch(part)); |
| 334 |
| 335 // The aperture is a single pixel surrounded by a non-resizing 2 pixel border. |
| 336 // The stroke is actually only 1 pixel wide but we need to use 2 pixels so |
| 337 // that the center patch doesn't try to blend colors between patches. |
| 338 return gfx::Rect(2, 2, 1, 1); |
| 339 } |
| 340 |
318 } // namespace ui | 341 } // namespace ui |
OLD | NEW |