summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortkent@chromium.org <tkent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-05 23:43:39 +0000
committertkent@chromium.org <tkent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-05 23:43:39 +0000
commit506ba8496513572708fa3b780f6a1f050dd35bf3 (patch)
tree948340753dd65cdc3fa3b06b8c8e368d3f362ad2
parentdb6d231a0cf15013ba0ddb0296c052451344c2f9 (diff)
downloadchromium_src-506ba8496513572708fa3b780f6a1f050dd35bf3.zip
chromium_src-506ba8496513572708fa3b780f6a1f050dd35bf3.tar.gz
chromium_src-506ba8496513572708fa3b780f6a1f050dd35bf3.tar.bz2
Merge 248689 "Default theme: Draw consistent borders for <input>..."
> Default theme: Draw consistent borders for <input>, listbox <select>, and <textarea>. > > Draw solid #a9a9a9 borders for them. It's same as menulist <select>. > > BUG=332311 > TEST=automated by layout tests. > R=sky@chromium.org > > Review URL: https://codereview.chromium.org/149423002 TBR=tkent@chromium.org Review URL: https://codereview.chromium.org/155613004 git-svn-id: svn://svn.chromium.org/chrome/branches/1750/src@249156 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ui/native_theme/native_theme_base.cc84
1 files changed, 8 insertions, 76 deletions
diff --git a/ui/native_theme/native_theme_base.cc b/ui/native_theme/native_theme_base.cc
index 3b2bdd2..3f88ddd 100644
--- a/ui/native_theme/native_theme_base.cc
+++ b/ui/native_theme/native_theme_base.cc
@@ -38,6 +38,8 @@ const SkColor kSliderThumbDarkGrey = SkColorSetRGB(0xea, 0xe5, 0xe0);
const SkColor kSliderThumbBorderDarkGrey =
SkColorSetRGB(0x9d, 0x96, 0x8e);
+const SkColor kTextBorderColor = SkColorSetRGB(0xa9, 0xa9, 0xa9);
+
const SkColor kMenuPopupBackgroundColor = SkColorSetRGB(210, 225, 246);
const unsigned int kDefaultScrollbarWidth = 15;
@@ -688,10 +690,6 @@ void NativeThemeBase::PaintTextField(SkCanvas* canvas,
State state,
const gfx::Rect& rect,
const TextFieldExtraParams& text) const {
- // The following drawing code simulates the user-agent css border for
- // text area and text input so that we do not break layout tests. Once we
- // have decided the desired looks, we should update the code here and
- // the layout test expectations.
SkRect bounds;
bounds.set(rect.x(), rect.y(), rect.right() - 1, rect.bottom() - 1);
@@ -700,78 +698,12 @@ void NativeThemeBase::PaintTextField(SkCanvas* canvas,
fill_paint.setColor(text.background_color);
canvas->drawRect(bounds, fill_paint);
- if (text.is_text_area) {
- // Draw text area border: 1px solid black
- SkPaint stroke_paint;
- fill_paint.setStyle(SkPaint::kStroke_Style);
- fill_paint.setColor(SK_ColorBLACK);
- canvas->drawRect(bounds, fill_paint);
- } else {
- // Draw text input and listbox inset border
- // Text Input: 2px inset #eee
- // Listbox: 1px inset #808080
- const SkColor kLightColor = text.is_listbox ?
- SkColorSetRGB(0x80, 0x80, 0x80) : SkColorSetRGB(0xee, 0xee, 0xee);
- const SkColor kDarkColor = text.is_listbox ?
- SkColorSetRGB(0x2c, 0x2c, 0x2c) : SkColorSetRGB(0x9a, 0x9a, 0x9a);
- const int kBorderWidth = text.is_listbox ? 1 : 2;
-
- SkPaint dark_paint;
- dark_paint.setAntiAlias(true);
- dark_paint.setStyle(SkPaint::kFill_Style);
- dark_paint.setColor(kDarkColor);
-
- SkPaint light_paint;
- light_paint.setAntiAlias(true);
- light_paint.setStyle(SkPaint::kFill_Style);
- light_paint.setColor(kLightColor);
-
- int left = rect.x();
- int top = rect.y();
- int right = rect.right();
- int bottom = rect.bottom();
-
- SkPath path;
- path.incReserve(4);
-
- // Top
- path.moveTo(SkIntToScalar(left), SkIntToScalar(top));
- path.lineTo(SkIntToScalar(left + kBorderWidth),
- SkIntToScalar(top + kBorderWidth));
- path.lineTo(SkIntToScalar(right - kBorderWidth),
- SkIntToScalar(top + kBorderWidth));
- path.lineTo(SkIntToScalar(right), SkIntToScalar(top));
- canvas->drawPath(path, dark_paint);
-
- // Bottom
- path.reset();
- path.moveTo(SkIntToScalar(left + kBorderWidth),
- SkIntToScalar(bottom - kBorderWidth));
- path.lineTo(SkIntToScalar(left), SkIntToScalar(bottom));
- path.lineTo(SkIntToScalar(right), SkIntToScalar(bottom));
- path.lineTo(SkIntToScalar(right - kBorderWidth),
- SkIntToScalar(bottom - kBorderWidth));
- canvas->drawPath(path, light_paint);
-
- // Left
- path.reset();
- path.moveTo(SkIntToScalar(left), SkIntToScalar(top));
- path.lineTo(SkIntToScalar(left), SkIntToScalar(bottom));
- path.lineTo(SkIntToScalar(left + kBorderWidth),
- SkIntToScalar(bottom - kBorderWidth));
- path.lineTo(SkIntToScalar(left + kBorderWidth),
- SkIntToScalar(top + kBorderWidth));
- canvas->drawPath(path, dark_paint);
-
- // Right
- path.reset();
- path.moveTo(SkIntToScalar(right - kBorderWidth),
- SkIntToScalar(top + kBorderWidth));
- path.lineTo(SkIntToScalar(right - kBorderWidth), SkIntToScalar(bottom));
- path.lineTo(SkIntToScalar(right), SkIntToScalar(bottom));
- path.lineTo(SkIntToScalar(right), SkIntToScalar(top));
- canvas->drawPath(path, light_paint);
- }
+ // Text INPUT, listbox SELECT, and TEXTAREA have consistent borders.
+ // border: 1px solid #a9a9a9
+ SkPaint stroke_paint;
+ stroke_paint.setStyle(SkPaint::kStroke_Style);
+ stroke_paint.setColor(kTextBorderColor);
+ canvas->drawRect(bounds, stroke_paint);
}
void NativeThemeBase::PaintMenuList(