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

Unified Diff: ui/native_theme/native_theme_aura.cc

Issue 2763373002: Overlay scrollbars flush with window edge (Closed)
Patch Set: bokan comments 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
« no previous file with comments | « ui/native_theme/native_theme_aura.h ('k') | ui/native_theme/native_theme_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..bbe1e7942a614ca6fa031b39159f04480552d7f2 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);
@@ -250,8 +250,15 @@ void NativeThemeAura::PaintScrollbarThumb(
stroke_rect.Inset(kHalfStrokeWidth, kHalfStrokeWidth);
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.
bokan 2017/03/24 18:06:12 Please keep the comment this is currently replacin
+ if (part == NativeTheme::kScrollbarVerticalThumb) {
+ 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:
« no previous file with comments | « ui/native_theme/native_theme_aura.h ('k') | ui/native_theme/native_theme_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698