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

Unified Diff: ash/common/system/tray/tray_popup_utils.cc

Issue 2527513002: Update ash shelf/tray focus rects. (Closed)
Patch Set: rebase Created 4 years 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 | « ash/common/system/tray/tray_popup_utils.h ('k') | ash/common/system/user/button_from_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/system/tray/tray_popup_utils.cc
diff --git a/ash/common/system/tray/tray_popup_utils.cc b/ash/common/system/tray/tray_popup_utils.cc
index f17cb55579bf98cc5b7ca2384bca19632b68a1f0..fef3d0cadb6a98de62648335d6a5b505e4ba5047 100644
--- a/ash/common/system/tray/tray_popup_utils.cc
+++ b/ash/common/system/tray/tray_popup_utils.cc
@@ -117,13 +117,7 @@ class BorderlessLabelButton : public views::LabelButton {
SetBorder(views::CreateEmptyBorder(gfx::Insets(0, kHorizontalPadding)));
TrayPopupItemStyle style(TrayPopupItemStyle::FontStyle::BUTTON);
style.SetupLabel(label());
- // TODO(tdanderson): Update focus rect for material design. See
- // crbug.com/615892
- // Hack alert: CreateSolidFocusPainter should add 0.5f to all insets to
- // make the lines align to pixel centers, but for now it doesn't. We can
- // get around this by relying on Skia rounding up integer coordinates.
- SetFocusPainter(views::Painter::CreateSolidFocusPainter(
- kFocusBorderColor, gfx::Insets(0, 0, 1, 1)));
+ SetFocusPainter(TrayPopupUtils::CreateFocusPainter());
} else {
SetBorder(std::unique_ptr<views::Border>(new TrayPopupLabelButtonBorder));
SetFocusPainter(views::Painter::CreateSolidFocusPainter(
@@ -255,7 +249,6 @@ views::ImageView* TrayPopupUtils::CreateMoreImageView() {
views::Slider* TrayPopupUtils::CreateSlider(views::SliderListener* listener) {
const bool is_material = MaterialDesignController::IsSystemTrayMenuMaterial();
views::Slider* slider = views::Slider::CreateSlider(is_material, listener);
- slider->set_focus_border_color(kFocusBorderColor);
if (is_material) {
slider->SetBorder(
views::CreateEmptyBorder(gfx::Insets(0, kTrayPopupSliderPaddingMD)));
@@ -276,14 +269,18 @@ views::ToggleButton* TrayPopupUtils::CreateToggleButton(
(kTrayToggleButtonWidth - toggle_size.width()) / 2;
toggle->SetBorder(views::CreateEmptyBorder(
gfx::Insets(vertical_padding, horizontal_padding)));
- // TODO(tdanderson): Update the focus rect color, border thickness, and
- // location for material design.
- toggle->SetFocusPainter(views::Painter::CreateSolidFocusPainter(
- kFocusBorderColor, gfx::Insets(1)));
+ // TODO(varkha): remove this and implement toggle-button specific focus. See
+ // crbug.com/669124
+ toggle->SetFocusPainter(CreateFocusPainter());
toggle->SetAccessibleName(l10n_util::GetStringUTF16(accessible_name_id));
return toggle;
}
+std::unique_ptr<views::Painter> TrayPopupUtils::CreateFocusPainter() {
+ return views::Painter::CreateSolidFocusPainter(
+ kFocusBorderColor, kFocusBorderThickness, gfx::InsetsF());
+}
+
void TrayPopupUtils::ConfigureAsStickyHeader(views::View* view) {
view->set_id(VIEW_ID_STICKY_HEADER);
view->set_background(
« no previous file with comments | « ash/common/system/tray/tray_popup_utils.h ('k') | ash/common/system/user/button_from_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698