Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: ui/native_theme/native_theme_aura.cc

Issue 2591863003: Use nine-patch resource for drawing Aura overlay scrollbar thumb. (Closed)
Patch Set: Addressed sadrul@'s feedback Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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.
Evan Stade 2017/03/01 16:45:49 2 pixels or 2 dip? Why 2 pixels if OverlayScrollba
bokan 2017/03/01 17:02:31 It's to prevent color interpolation between the pa
331 return gfx::Size(5, 5);
Evan Stade 2017/03/01 16:45:49 can you pull out these values into named constants
bokan 2017/03/01 17:02:31 Done.
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);
Evan Stade 2017/03/01 16:45:49 ditto
bokan 2017/03/01 17:02:31 Done.
341 }
342
320 } // namespace ui 343 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698