Index: ui/base/native_theme/native_theme_base.cc |
diff --git a/ui/base/native_theme/native_theme_base.cc b/ui/base/native_theme/native_theme_base.cc |
index eab57e0640c75b12b21057cfaba29566151380f9..34898987588e1b500b6cb7f1a382d1df3814b9f9 100644 |
--- a/ui/base/native_theme/native_theme_base.cc |
+++ b/ui/base/native_theme/native_theme_base.cc |
@@ -56,7 +56,7 @@ const SkColor kCheckboxGradientHoveredColors[] = { |
SkColorSetRGB(0xe0, 0xe0, 0xe0) }; |
const SkColor kCheckboxGradientDisabledColors[] = { |
SkColorSetARGB(0xB3, 0xed, 0xed, 0xed), |
- SkColorSetARGB(0xB3, 0xde, 0xde, 0xde) }; |
+ SkColorSetARGB(0xB3, 0xed, 0xed, 0xed) }; |
const SkColor kCheckboxBorderColor = SkColorSetARGB(0x40, 0, 0, 0); |
const SkColor kCheckboxBorderHoveredColor = SkColorSetARGB(0x4D, 0, 0, 0); |
const SkColor kCheckboxBorderDisabledColor = SkColorSetARGB(0x30, 0, 0, 0); |
@@ -468,15 +468,11 @@ void NativeThemeBase::PaintScrollbarThumb(SkCanvas* canvas, |
} |
bool NativeThemeBase::IsNewCheckboxStyleEnabled(SkCanvas* canvas) const { |
- // Mostly this new style is experimental behind a flag. |
- // TODO(rbyers): Enable new style by default. http://crbug.com/125773 |
- if (CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kNewCheckboxStyle)) |
- return true; |
- |
- // Also enable explicitly when high-DPI is being used (since this is the only |
- // way we have to get nice looking widgets in high-DPI. |
- if (canvas->getTotalMatrix().getScaleX() > 1) |
+ // The new style is now the default. |
+ // TODO(rbyers): Remove this flag once we're sure the new behavior is fine. |
+ // http://crbug.com/133991 |
+ if (!CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kOldCheckboxStyle)) |
return true; |
return false; |
@@ -523,10 +519,18 @@ SkRect NativeThemeBase::PaintCheckboxRadioNewCommon( |
SkRect skrect = gfx::RectToSkRect(rect); |
+ // Use the largest square rectangle that fits inside the provided rectangle. |
Avi (use Gerrit)
2012/07/23 19:29:07
drive-by: s/square rectangle/square/
|
+ // No other browser seems to support non-square widget, so accidentally |
+ // having non-square sizes is common (eg. amazon and webkit dev tools). |
+ if (skrect.width() != skrect.height()) { |
+ SkScalar size = SkMinScalar(skrect.width(), skrect.height()); |
+ skrect.inset((skrect.width() - size) / 2, (skrect.height() - size) / 2); |
+ } |
+ |
// If the rectangle is too small then paint only a rectangle. We don't want |
// to have to worry about '- 1' and '+ 1' calculations below having overflow |
// or underflow. |
- if (rect.width() <= 2 || rect.height() <= 2) { |
+ if (skrect.width() <= 2) { |
SkPaint paint; |
paint.setColor(kCheckboxTinyColor); |
paint.setStyle(SkPaint::kFill_Style); |