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

Unified Diff: ui/gfx/native_theme_linux.cc

Issue 6490014: Make the size of menulists on Linux the same size as on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: handle border radius Created 9 years, 10 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/gfx/native_theme_linux.h ('k') | webkit/glue/webthemeengine_impl_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/native_theme_linux.cc
diff --git a/ui/gfx/native_theme_linux.cc b/ui/gfx/native_theme_linux.cc
index 766b003db3049436b099dd6c2c347c441733e7e0..eecd10ad4e66882da4c5568c0f406784b7b938fb 100644
--- a/ui/gfx/native_theme_linux.cc
+++ b/ui/gfx/native_theme_linux.cc
@@ -475,12 +475,14 @@ void NativeThemeLinux::PaintButton(skia::PlatformCanvas* canvas,
return;
}
- const int kBorderAlpha = state == kHovered ? 0x80 : 0x55;
- paint.setARGB(kBorderAlpha, 0, 0, 0);
- canvas->drawLine(rect.x() + 1, rect.y(), kRight - 1, rect.y(), paint);
- canvas->drawLine(kRight - 1, rect.y() + 1, kRight - 1, kBottom - 1, paint);
- canvas->drawLine(rect.x() + 1, kBottom - 1, kRight - 1, kBottom - 1, paint);
- canvas->drawLine(rect.x(), rect.y() + 1, rect.x(), kBottom - 1, paint);
+ if (button.has_border) {
+ const int kBorderAlpha = state == kHovered ? 0x80 : 0x55;
+ paint.setARGB(kBorderAlpha, 0, 0, 0);
+ canvas->drawLine(rect.x() + 1, rect.y(), kRight - 1, rect.y(), paint);
+ canvas->drawLine(kRight - 1, rect.y() + 1, kRight - 1, kBottom - 1, paint);
+ canvas->drawLine(rect.x() + 1, kBottom - 1, kRight - 1, kBottom - 1, paint);
+ canvas->drawLine(rect.x(), rect.y() + 1, rect.x(), kBottom - 1, paint);
+ }
paint.setColor(SK_ColorBLACK);
const int kLightEnd = state == kPressed ? 1 : 0;
@@ -500,15 +502,21 @@ void NativeThemeLinux::PaintButton(skia::PlatformCanvas* canvas,
paint.setShader(shader);
shader->unref();
- skrect.set(rect.x() + 1, rect.y() + 1, kRight - 1, kBottom - 1);
+ if (button.has_border) {
+ skrect.set(rect.x() + 1, rect.y() + 1, kRight - 1, kBottom - 1);
+ } else {
+ skrect.set(rect.x(), rect.y(), kRight, kBottom);
+ }
canvas->drawRect(skrect, paint);
-
paint.setShader(NULL);
- paint.setColor(BrightenColor(base_hsl, SkColorGetA(base_color), -0.0588));
- canvas->drawPoint(rect.x() + 1, rect.y() + 1, paint);
- canvas->drawPoint(kRight - 2, rect.y() + 1, paint);
- canvas->drawPoint(rect.x() + 1, kBottom - 2, paint);
- canvas->drawPoint(kRight - 2, kBottom - 2, paint);
+
+ if (button.has_border) {
+ paint.setColor(BrightenColor(base_hsl, SkColorGetA(base_color), -0.0588));
+ canvas->drawPoint(rect.x() + 1, rect.y() + 1, paint);
+ canvas->drawPoint(kRight - 2, rect.y() + 1, paint);
+ canvas->drawPoint(rect.x() + 1, kBottom - 2, paint);
+ canvas->drawPoint(kRight - 2, kBottom - 2, paint);
+ }
}
void NativeThemeLinux::PaintTextField(skia::PlatformCanvas* canvas,
@@ -605,9 +613,14 @@ void NativeThemeLinux::PaintMenuList(skia::PlatformCanvas* canvas,
State state,
const gfx::Rect& rect,
const MenuListExtraParams& menu_list) {
- ButtonExtraParams button = { 0 };
- button.background_color = menu_list.background_color;
- PaintButton(canvas, state, rect, button);
+ // If a border radius is specified, we let the WebCore paint the background
+ // and the border of the control.
+ if (!menu_list.has_border_radius) {
+ ButtonExtraParams button = { 0 };
+ button.background_color = menu_list.background_color;
+ button.has_border = menu_list.has_border;
+ PaintButton(canvas, state, rect, button);
+ }
SkPaint paint;
paint.setColor(SK_ColorBLACK);
« no previous file with comments | « ui/gfx/native_theme_linux.h ('k') | webkit/glue/webthemeengine_impl_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698