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

Unified Diff: ui/views/style/mac/combobox_background_mac.cc

Issue 1971333002: Views: factor out Combobox background and const-ify style (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix ios build break Created 4 years, 7 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/views/style/mac/combobox_background_mac.h ('k') | ui/views/style/platform_style.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/style/mac/combobox_background_mac.cc
diff --git a/ui/views/style/mac/combobox_background_mac.cc b/ui/views/style/mac/combobox_background_mac.cc
index 805f97d2751c6aad18effdb7c714467dbef9548d..1a97a7e412a138b33c38b504f9b552045d4e46fb 100644
--- a/ui/views/style/mac/combobox_background_mac.cc
+++ b/ui/views/style/mac/combobox_background_mac.cc
@@ -7,34 +7,34 @@
#include "third_party/skia/include/core/SkPath.h"
#include "third_party/skia/include/core/SkRRect.h"
#include "ui/gfx/canvas.h"
+#include "ui/gfx/scoped_canvas.h"
#include "ui/native_theme/native_theme_mac.h"
-#include "ui/views/controls/combobox/combobox.h"
#include "ui/views/view.h"
using ui::NativeThemeMac;
namespace views {
-ComboboxBackgroundMac::ComboboxBackgroundMac() {}
+ComboboxBackgroundMac::ComboboxBackgroundMac(int container_width)
+ : container_width_(container_width) {}
ComboboxBackgroundMac::~ComboboxBackgroundMac() {}
void ComboboxBackgroundMac::Paint(gfx::Canvas* canvas, View* view) const {
- DCHECK_EQ(view->GetClassName(), Combobox::kViewClassName);
- Combobox* combobox = static_cast<Combobox*>(view);
+ gfx::RectF bounds(view->GetLocalBounds());
+ gfx::ScopedRTLFlipCanvas scoped_canvas(canvas, view->bounds());
- gfx::RectF bounds(combobox->GetLocalBounds());
// Inset the left side far enough to draw only the arrow button, and inset the
// other three sides by half a pixel so the edge of the background doesn't
// paint outside the border.
- bounds.Inset(bounds.width() - combobox->GetArrowButtonWidth(), 0.5, 0.5, 0.5);
+ bounds.Inset(bounds.width() - container_width_, 0.5, 0.5, 0.5);
// TODO(tapted): Check whether the Widget is active, and use the NORMAL
// BackgroundType if it is inactive. Handling this properly also requires the
// control to observe the Widget for activation changes and invalidate.
NativeThemeMac::ButtonBackgroundType type =
NativeThemeMac::ButtonBackgroundType::HIGHLIGHTED;
- if (!combobox->enabled())
+ if (!view->enabled())
type = NativeThemeMac::ButtonBackgroundType::DISABLED;
SkPaint paint;
« no previous file with comments | « ui/views/style/mac/combobox_background_mac.h ('k') | ui/views/style/platform_style.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698