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 dc7166e6c491181340db32218f2f768dc48c7bab..4c0bf9e08030184ac20928ee8e5949a4be801df8 100644 |
--- a/ui/native_theme/native_theme_aura.cc |
+++ b/ui/native_theme/native_theme_aura.cc |
@@ -21,38 +21,21 @@ |
#include "ui/gfx/path.h" |
#include "ui/gfx/skia_util.h" |
#include "ui/native_theme/common_theme.h" |
-#include "ui/native_theme/native_theme_switches.h" |
-#include "ui/native_theme/overlay_scrollbar_constants_aura.h" |
namespace ui { |
namespace { |
-// Constants for painting overlay scrollbars. Other properties needed outside |
-// this painting code are defined in overlay_scrollbar_constants_aura.h. |
-constexpr int kOverlayScrollbarStrokeWidth = 1; |
-constexpr int kOverlayScrollbarMinimumLength = 12; |
-constexpr SkAlpha kOverlayScrollbarAlphaNormal = 0x4D; |
-constexpr SkAlpha kOverlayScrollbarAlphaHovered = 0x80; |
-constexpr SkAlpha kOverlayScrollbarAlphaPressed = 0x80; |
- |
-// Indexed by ScrollbarOverlayColorTheme. |
-constexpr SkColor kOverlayScrollbarThumbColor[] = {SK_ColorBLACK, |
- SK_ColorWHITE}; |
-constexpr SkColor kOverlayScrollbarStrokeColor[] = {SK_ColorWHITE, |
- SK_ColorBLACK}; |
- |
SkAlpha ThumbAlphaForState(NativeTheme::State state) { |
- bool overlay = IsOverlayScrollbarEnabled(); |
switch (state) { |
case NativeTheme::kDisabled: |
return 0x00; |
case NativeTheme::kHovered: |
- return overlay ? kOverlayScrollbarAlphaHovered : 0x4D; |
+ return 0x4D; |
case NativeTheme::kNormal: |
- return overlay ? kOverlayScrollbarAlphaNormal : 0x33; |
+ return 0x33; |
case NativeTheme::kPressed: |
- return overlay ? kOverlayScrollbarAlphaPressed : 0x80; |
+ return 0x80; |
case NativeTheme::kNumStates: |
break; |
} |
@@ -66,11 +49,6 @@ const SkColor kTrackColor = SkColorSetRGB(0xF1, 0xF1, 0xF1); |
} // namespace |
// static |
-NativeTheme* NativeTheme::GetInstanceForWeb() { |
- return NativeThemeAura::instance(); |
-} |
- |
-// static |
NativeThemeAura* NativeThemeAura::instance() { |
CR_DEFINE_STATIC_LOCAL(NativeThemeAura, s_native_theme, ()); |
return &s_native_theme; |
@@ -82,11 +60,6 @@ NativeThemeAura::NativeThemeAura() { |
set_scrollbar_button_length(0); |
#endif |
- if (IsOverlayScrollbarEnabled()) { |
- scrollbar_width_ = |
- kOverlayScrollbarThumbWidthPressed + kOverlayScrollbarStrokeWidth * 2; |
- } |
- |
// Images and alphas declarations assume the following order. |
static_assert(kDisabled == 0, "states unexpectedly changed"); |
static_assert(kHovered == 1, "states unexpectedly changed"); |
@@ -173,8 +146,6 @@ void NativeThemeAura::PaintScrollbarTrack( |
State state, |
const ScrollbarTrackExtraParams& extra_params, |
const gfx::Rect& rect) const { |
- // Overlay Scrollbar should never paint a scrollbar track. |
- DCHECK(!IsOverlayScrollbarEnabled()); |
SkPaint paint; |
paint.setColor(kTrackColor); |
canvas->drawIRect(gfx::RectToSkIRect(rect), paint); |
@@ -185,7 +156,7 @@ void NativeThemeAura::PaintScrollbarThumb( |
Part part, |
State state, |
const gfx::Rect& rect, |
- ScrollbarOverlayColorTheme theme) const { |
+ ScrollbarOverlayColorTheme) const { |
// Do not paint if state is disabled. |
if (state == kDisabled) |
return; |
@@ -196,37 +167,17 @@ void NativeThemeAura::PaintScrollbarThumb( |
SkColor thumb_color; |
SkAlpha thumb_alpha = ThumbAlphaForState(state); |
- if (IsOverlayScrollbarEnabled()) { |
- thumb_color = kOverlayScrollbarThumbColor[theme]; |
- |
- // In overlay mode, draw a stroke (border). |
- constexpr int kStrokeWidth = kOverlayScrollbarStrokeWidth; |
- SkPaint paint; |
- paint.setColor( |
- SkColorSetA(kOverlayScrollbarStrokeColor[theme], thumb_alpha)); |
- paint.setStyle(SkPaint::kStroke_Style); |
- paint.setStrokeWidth(kStrokeWidth); |
- |
- gfx::RectF stroke_rect(thumb_rect); |
- constexpr float kHalfStrokeWidth = kStrokeWidth / 2.f; |
- stroke_rect.Inset(kHalfStrokeWidth, kHalfStrokeWidth); |
- canvas->drawRect(gfx::RectFToSkRect(stroke_rect), paint); |
+ // If there are no scrollbuttons then provide some padding so that the thumb |
+ // doesn't touch the top of the track. |
+ const int kThumbPadding = 2; |
+ const int extra_padding = |
+ (scrollbar_button_length() == 0) ? kThumbPadding : 0; |
+ if (part == NativeTheme::kScrollbarVerticalThumb) |
+ thumb_rect.Inset(kThumbPadding, extra_padding); |
+ else |
+ thumb_rect.Inset(extra_padding, kThumbPadding); |
- // Inset the all the edges edges so we fill-in the stroke below. |
- thumb_rect.Inset(kStrokeWidth, kStrokeWidth); |
- } else { |
- // If there are no scrollbuttons then provide some padding so that the thumb |
- // doesn't touch the top of the track. |
- const int kThumbPadding = 2; |
- const int extra_padding = |
- (scrollbar_button_length() == 0) ? kThumbPadding : 0; |
- if (part == NativeTheme::kScrollbarVerticalThumb) |
- thumb_rect.Inset(kThumbPadding, extra_padding); |
- else |
- thumb_rect.Inset(extra_padding, kThumbPadding); |
- |
- thumb_color = SK_ColorBLACK; |
- } |
+ thumb_color = SK_ColorBLACK; |
SkPaint paint; |
paint.setColor(SkColorSetA(thumb_color, thumb_alpha)); |
@@ -236,38 +187,9 @@ void NativeThemeAura::PaintScrollbarThumb( |
void NativeThemeAura::PaintScrollbarCorner(SkCanvas* canvas, |
State state, |
const gfx::Rect& rect) const { |
- // Overlay Scrollbar should never paint a scrollbar corner. |
- DCHECK(!IsOverlayScrollbarEnabled()); |
SkPaint paint; |
paint.setColor(SkColorSetRGB(0xDC, 0xDC, 0xDC)); |
canvas->drawIRect(RectToSkIRect(rect), paint); |
} |
-gfx::Size NativeThemeAura::GetPartSize(Part part, |
- State state, |
- const ExtraParams& extra) const { |
- if (IsOverlayScrollbarEnabled()) { |
- constexpr int minimum_length = |
- kOverlayScrollbarMinimumLength + 2 * kOverlayScrollbarStrokeWidth; |
- |
- // Aura overlay scrollbars need a slight tweak from the base sizes. |
- switch (part) { |
- case kScrollbarHorizontalThumb: |
- return gfx::Size(minimum_length, scrollbar_width_); |
- case kScrollbarVerticalThumb: |
- return gfx::Size(scrollbar_width_, minimum_length); |
- default: |
- // TODO(bokan): We should probably make sure code using overlay |
- // scrollbars isn't asking for part sizes that don't exist. This |
- // currently breaks in Views layout code which indicates they aren't |
- // overlay aware yet. The Views code should be fixed and either this |
- // branch return 0 for parts that don't exist or assert NOTREACHED. |
- // crbug.com/657159. |
- break; |
- } |
- } |
- |
- return NativeThemeBase::GetPartSize(part, state, extra); |
-} |
- |
} // namespace ui |