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

Unified Diff: ui/native_theme/native_theme_aura.cc

Issue 2763373002: Overlay scrollbars flush with window edge (Closed)
Patch Set: bokan comment addressed 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 side-by-side diff with in-line comments
Download patch
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..c9b5403cc27efdc517820d55f3b09038bdc3159f 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) {
@@ -240,8 +240,8 @@ void NativeThemeAura::PaintScrollbarThumb(
// In overlay mode, draw a stroke (border).
constexpr int kStrokeWidth = kOverlayScrollbarStrokeWidth;
cc::PaintFlags flags;
- flags.setColor(
- SkColorSetA(kOverlayScrollbarStrokeColor[theme], stroke_alpha));
+ flags.setColor(SkColorSetA(
+ kOverlayScrollbarStrokeColor[params.scrollbar_theme], stroke_alpha));
flags.setStyle(cc::PaintFlags::kStroke_Style);
flags.setStrokeWidth(kStrokeWidth);
@@ -251,7 +251,15 @@ void NativeThemeAura::PaintScrollbarThumb(
canvas->drawRect(gfx::RectFToSkRect(stroke_rect), flags);
// Inset the all the edges edges so we fill-in the stroke below.
- thumb_rect.Inset(kStrokeWidth, kStrokeWidth);
+ // The edge to which the scrollbar is attached shouldn't have a border.
+ if (part == NativeTheme::kScrollbarVerticalThumb) {
Evan Stade 2017/03/28 00:01:56 nit: this can be clearer/less nested, e.g. gfx::I
+ if (params.isLeftVerticalScrollbar)
+ thumb_rect.Inset(0, kStrokeWidth, kStrokeWidth, kStrokeWidth);
+ else
+ thumb_rect.Inset(kStrokeWidth, kStrokeWidth, 0, kStrokeWidth);
+ } else {
+ thumb_rect.Inset(kStrokeWidth, kStrokeWidth, kStrokeWidth, 0);
+ }
} else {
switch (state) {
case NativeTheme::kDisabled:

Powered by Google App Engine
This is Rietveld 408576698