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