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

Unified Diff: ui/views/controls/button/chrome_style.cc

Issue 11077006: Correct padding and focus ring for frameless constrained window dialog (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add comments and ASCII art. More clear implementation of client insets. Created 8 years, 2 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/views/controls/button/chrome_style.cc
diff --git a/ui/views/controls/button/chrome_style.cc b/ui/views/controls/button/chrome_style.cc
index 6122d3b83c6404ab21ec9b2d0e6701473cb5c1c6..7d0de832a19ed5e0bd66c5c5da7b81f0d1d7d42a 100644
--- a/ui/views/controls/button/chrome_style.cc
+++ b/ui/views/controls/button/chrome_style.cc
@@ -62,9 +62,9 @@ const SkColor kBorderNormalColor = SkColorSetARGB(0x3f, 0x0, 0x0, 0x0);
const SkColor kBorderActiveColor = SkColorSetARGB(0x4b, 0x0, 0x0, 0x0);
const SkColor kBorderDisabledColor = SkColorSetARGB(0x1d, 0x0, 0x0, 0x0);
-const int kFocusRingWidth = 2;
+const int kFocusRingWidth = 1;
const int kFocusRingRadius = 2;
-const SkColor kFocusRingColor = SkColorSetARGB(0x7f, 0xe5, 0x97, 0x00);
+const SkColor kFocusRingColor = SkColorSetRGB(0x4d, 0x90, 0xfe);
// Returns the uniform inset of the button from its local bounds.
int GetButtonInset() {
@@ -262,14 +262,20 @@ class ChromeStyleFocusBorder : public views::FocusBorder {
// Overriden from Border
virtual void Paint(const View& view, gfx::Canvas* canvas) const {
- gfx::Rect rect(view.GetLocalBounds());
- SkScalar inset = SkFloatToScalar(GetButtonInset() - kFocusRingWidth / 2.0f);
- rect.Inset(inset, inset);
SkPaint paint;
paint.setStyle(SkPaint::kStroke_Style);
paint.setStrokeWidth(SkIntToScalar(kFocusRingWidth));
paint.setColor(kFocusRingColor);
- canvas->DrawRoundRect(rect, SkIntToScalar(kFocusRingRadius), paint);
+
+ SkScalar inset = SkFloatToScalar(GetButtonInset() - kFocusRingWidth / 2.0f);
+ gfx::Rect view_bounds(view.GetLocalBounds());
+ SkRect rect = SkRect::MakeLTRB(
+ SkIntToScalar(view_bounds.x()) + inset,
+ SkIntToScalar(view_bounds.y()) + inset,
+ SkIntToScalar(view_bounds.width()) - inset,
+ SkIntToScalar(view_bounds.height()) - inset);
+ canvas->sk_canvas()->drawRoundRect(
+ rect, kFocusRingRadius, kFocusRingRadius, paint);
Mike Wittman 2012/10/09 22:55:46 kFocusRingRadius should be converted to SkScalar b
please use gerrit instead 2012/10/10 19:12:58 Done.
}
private:

Powered by Google App Engine
This is Rietveld 408576698