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

Unified Diff: ui/native_theme/native_theme_win.cc

Issue 1797053002: Move theme part drawing functions only used on Windows to NativeThemeWin (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: compile Created 4 years, 9 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/native_theme/native_theme_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/native_theme/native_theme_win.cc
diff --git a/ui/native_theme/native_theme_win.cc b/ui/native_theme/native_theme_win.cc
index eef9df02138a63564d3acde8142ff34edf066927..8544127572261b50c5d3c05d700d1c03d2c5c13a 100644
--- a/ui/native_theme/native_theme_win.cc
+++ b/ui/native_theme/native_theme_win.cc
@@ -30,6 +30,7 @@
#include "ui/gfx/gdi_util.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/rect_conversions.h"
+#include "ui/gfx/skia_util.h"
#include "ui/gfx/win/dpi.h"
#include "ui/native_theme/common_theme.h"
@@ -245,16 +246,17 @@ void NativeThemeWin::Paint(SkCanvas* canvas,
CommonThemePaintComboboxArrow(canvas, rect);
return;
case kMenuPopupGutter:
- CommonThemePaintMenuGutter(canvas, rect);
+ PaintMenuGutter(canvas, rect);
return;
case kMenuPopupSeparator:
- CommonThemePaintMenuSeparator(canvas, rect);
+ PaintMenuSeparator(canvas, rect);
return;
case kMenuPopupBackground:
- CommonThemePaintMenuBackground(canvas, rect);
+ PaintMenuBackground(canvas, rect);
return;
case kMenuItemBackground:
- CommonThemePaintMenuItemBackground(canvas, state, rect, extra.menu_item);
+ CommonThemePaintMenuItemBackground(this, canvas, state, rect,
+ extra.menu_item);
return;
default:
break;
@@ -358,6 +360,29 @@ void NativeThemeWin::UpdateSystemColors() {
system_colors_[kSystemColor] = color_utils::GetSysSkColor(kSystemColor);
}
+void NativeThemeWin::PaintMenuSeparator(SkCanvas* canvas,
+ const gfx::Rect& rect) const {
+ SkPaint paint;
+ paint.setColor(GetSystemColor(NativeTheme::kColorId_MenuSeparatorColor));
+ int position_y = rect.y() + rect.height() / 2;
+ canvas->drawLine(rect.x(), position_y, rect.right(), position_y, paint);
+}
+
+void NativeThemeWin::PaintMenuGutter(SkCanvas* canvas,
+ const gfx::Rect& rect) const {
+ SkPaint paint;
+ paint.setColor(GetSystemColor(NativeTheme::kColorId_MenuSeparatorColor));
+ int position_x = rect.x() + rect.width() / 2;
+ canvas->drawLine(position_x, rect.y(), position_x, rect.bottom(), paint);
+}
+
+void NativeThemeWin::PaintMenuBackground(SkCanvas* canvas,
+ const gfx::Rect& rect) const {
+ SkPaint paint;
+ paint.setColor(GetSystemColor(NativeTheme::kColorId_MenuBackgroundColor));
+ canvas->drawRect(gfx::RectToSkRect(rect), paint);
+}
+
void NativeThemeWin::PaintDirect(SkCanvas* canvas,
Part part,
State state,
« no previous file with comments | « ui/native_theme/native_theme_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698