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

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

Issue 2391393002: Harmony - Use FocusableBorder for comboboxes on Mac (Closed)
Patch Set: fix mac Created 4 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
« 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
deleted file mode 100644
index e9d73b19cf9111f9b370224a7a2f313102149624..0000000000000000000000000000000000000000
--- a/ui/views/style/mac/combobox_background_mac.cc
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/views/style/mac/combobox_background_mac.h"
-
-#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/view.h"
-
-using ui::NativeThemeMac;
-
-namespace views {
-
-ComboboxBackgroundMac::ComboboxBackgroundMac(int container_width)
- : container_width_(container_width) {}
-
-ComboboxBackgroundMac::~ComboboxBackgroundMac() {}
-
-void ComboboxBackgroundMac::Paint(gfx::Canvas* canvas, View* view) const {
- gfx::RectF bounds(view->GetLocalBounds());
- gfx::ScopedRTLFlipCanvas scoped_canvas(canvas, view->width());
-
- // 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.
- // Disabled comboboxes do not have a separate color for the arrow container;
- // instead, the entire combobox is drawn with the disabled background shader.
- if (view->enabled()) {
- bounds.Inset(bounds.width() - container_width_, 0.5, 0.5, 0.5);
- } else {
- bounds.Inset(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 (!view->enabled())
- type = NativeThemeMac::ButtonBackgroundType::DISABLED;
-
- SkPaint paint;
- paint.setShader(
- NativeThemeMac::GetButtonBackgroundShader(type, bounds.height()));
- paint.setStyle(SkPaint::kFill_Style);
- paint.setAntiAlias(true);
-
- SkPoint no_curve = SkPoint::Make(0, 0);
- SkPoint curve = SkPoint::Make(
- ui::NativeThemeMac::kButtonCornerRadius,
- ui::NativeThemeMac::kButtonCornerRadius);
- SkVector curves[4] = { no_curve, curve, curve, no_curve };
-
- SkRRect fill_rect;
- if (view->enabled())
- fill_rect.setRectRadii(gfx::RectFToSkRect(bounds), curves);
- else
- fill_rect.setRectXY(gfx::RectFToSkRect(bounds), curve.fX, curve.fY);
-
- SkPath path;
- path.addRRect(fill_rect);
-
- canvas->DrawPath(path, paint);
-}
-
-} // namespace views
« 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