Commit 6248fb5d authored by Tetsui Ohkubo's avatar Tetsui Ohkubo Committed by Commit Bot

Use relative font size in ash notification center.

Notification center used fixed font sizes for UI labels. This is not the
right way of settings font size.

This CL
- removes ash::message_center_style::GetFontListForSizeAndWeight().
- replaces all fixed font sizes with delta.

TEST=manual - compared screenshots and verified it cause no visual
change on actual device (chell)
BUG=793207

Change-Id: Ia2c50965e6a132520d63921252e78a76a644734f
Reviewed-on: https://chromium-review.googlesource.com/817456Reviewed-by: default avatarEvan Stade <estade@chromium.org>
Commit-Queue: Tetsui Ohkubo <tetsui@chromium.org>
Cr-Commit-Position: refs/heads/master@{#523696}
parent 06f31934
......@@ -307,7 +307,6 @@ component("ash") {
"message_center/message_center_button_bar.h",
"message_center/message_center_controller.cc",
"message_center/message_center_controller.h",
"message_center/message_center_style.cc",
"message_center/message_center_style.h",
"message_center/message_center_view.cc",
"message_center/message_center_view.h",
......
......@@ -47,7 +47,7 @@ namespace {
constexpr SkColor kTextColor = SkColorSetARGB(0xFF, 0x0, 0x0, 0x0);
constexpr SkColor kButtonSeparatorColor = SkColorSetARGB(0x1F, 0x0, 0x0, 0x0);
constexpr int kTextFontSize = 14;
constexpr int kTextFontSizeDelta = 2;
constexpr int kSeparatorHeight = 24;
constexpr gfx::Insets kSeparatorPadding(12, 0, 12, 0);
constexpr gfx::Insets kButtonBarBorder(4, 18, 4, 0);
......@@ -124,9 +124,8 @@ MessageCenterButtonBar::MessageCenterButtonBar(
notification_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
notification_label_->SetEnabledColor(kTextColor);
// "Roboto-Medium, 14sp" is specified in the mock.
notification_label_->SetFontList(
message_center_style::GetFontListForSizeAndWeight(
kTextFontSize, gfx::Font::Weight::MEDIUM));
notification_label_->SetFontList(gfx::FontList().Derive(
kTextFontSizeDelta, gfx::Font::NORMAL, gfx::Font::Weight::MEDIUM));
AddChildView(notification_label_);
button_container_ = new views::View;
......
// Copyright 2017 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 "ash/message_center/message_center_style.h"
namespace ash {
namespace message_center_style {
gfx::FontList GetFontListForSizeAndWeight(int font_size,
gfx::Font::Weight weight) {
gfx::Font default_font;
int font_size_delta = font_size - default_font.GetFontSize();
gfx::Font font =
default_font.Derive(font_size_delta, gfx::Font::NORMAL, weight);
DCHECK_EQ(font_size, font.GetFontSize());
return gfx::FontList(font);
}
} // namespace message_center_style
} // namespace ash
......@@ -21,7 +21,6 @@ constexpr SkColor kInactiveButtonColor = SkColorSetARGB(0x8A, 0x5A, 0x5A, 0x5A);
constexpr int kActionIconSize = 20;
constexpr int kEmptyIconSize = 24;
constexpr int kEmptyLabelSize = 12;
constexpr gfx::Insets kActionIconPadding(14);
constexpr gfx::Insets kEmptyIconPadding(0, 0, 4, 0);
......@@ -30,10 +29,6 @@ constexpr int kScrollShadowBlur = 2;
constexpr int kSettingsTransitionDurationMs = 500;
// Return FontList for the given absolute font size and font weight.
gfx::FontList GetFontListForSizeAndWeight(int font_size,
gfx::Font::Weight weight);
} // namespace message_center_style
} // namespace ash
......
......@@ -96,8 +96,8 @@ class EmptyNotificationView : public views::View {
l10n_util::GetStringUTF16(IDS_ASH_MESSAGE_CENTER_NO_MESSAGES));
label->SetEnabledColor(message_center_style::kEmptyViewColor);
// "Roboto-Medium, 12sp" is specified in the mock.
label->SetFontList(message_center_style::GetFontListForSizeAndWeight(
message_center_style::kEmptyLabelSize, gfx::Font::Weight::MEDIUM));
label->SetFontList(
gfx::FontList().DeriveWithWeight(gfx::Font::Weight::MEDIUM));
label->SetHorizontalAlignment(gfx::ALIGN_CENTER);
AddChildView(label);
}
......
......@@ -109,7 +109,7 @@ constexpr gfx::Insets kQuietModeTogglePadding(0, 14, 0, 14);
constexpr SkColor kTopLabelColor = SkColorSetRGB(0x42, 0x85, 0xF4);
constexpr SkColor kLabelColor = SkColorSetARGB(0xDE, 0x0, 0x0, 0x0);
constexpr SkColor kTopBorderColor = SkColorSetARGB(0x1F, 0x0, 0x0, 0x0);
const int kLabelFontSize = 13;
const int kLabelFontSizeDelta = 1;
// EntryView ------------------------------------------------------------------
......@@ -246,8 +246,8 @@ class EmptyNotifierView : public views::View {
l10n_util::GetStringUTF16(IDS_ASH_MESSAGE_CENTER_NO_NOTIFIERS));
label->SetEnabledColor(message_center_style::kEmptyViewColor);
// "Roboto-Medium, 12sp" is specified in the mock.
label->SetFontList(message_center_style::GetFontListForSizeAndWeight(
message_center_style::kEmptyLabelSize, gfx::Font::Weight::MEDIUM));
label->SetFontList(
gfx::FontList().DeriveWithWeight(gfx::Font::Weight::MEDIUM));
AddChildView(label);
}
......@@ -273,8 +273,8 @@ NotifierSettingsView::NotifierButton::NotifierButton(
name_view_->SetAutoColorReadabilityEnabled(false);
name_view_->SetEnabledColor(kLabelColor);
// "Roboto-Regular, 13sp" is specified in the mock.
name_view_->SetFontList(message_center_style::GetFontListForSizeAndWeight(
kLabelFontSize, gfx::Font::Weight::NORMAL));
name_view_->SetFontList(
gfx::FontList().DeriveWithSizeDelta(kLabelFontSizeDelta));
checkbox_->SetChecked(notifier_ui_data.enabled);
checkbox_->set_listener(this);
......@@ -448,8 +448,7 @@ NotifierSettingsView::NotifierSettingsView()
quiet_mode_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
// "Roboto-Regular, 13sp" is specified in the mock.
quiet_mode_label->SetFontList(
message_center_style::GetFontListForSizeAndWeight(
kLabelFontSize, gfx::Font::Weight::NORMAL));
gfx::FontList().DeriveWithSizeDelta(kLabelFontSizeDelta));
quiet_mode_label->SetAutoColorReadabilityEnabled(false);
quiet_mode_label->SetEnabledColor(kLabelColor);
quiet_mode_label->SetBorder(views::CreateEmptyBorder(kQuietModeLabelPadding));
......@@ -470,8 +469,8 @@ NotifierSettingsView::NotifierSettingsView()
IDS_ASH_MESSAGE_CENTER_SETTINGS_DIALOG_DESCRIPTION));
top_label_->SetBorder(views::CreateEmptyBorder(kTopLabelPadding));
// "Roboto-Medium, 13sp" is specified in the mock.
top_label_->SetFontList(message_center_style::GetFontListForSizeAndWeight(
kLabelFontSize, gfx::Font::Weight::MEDIUM));
top_label_->SetFontList(gfx::FontList().Derive(
kLabelFontSizeDelta, gfx::Font::NORMAL, gfx::Font::Weight::MEDIUM));
top_label_->SetAutoColorReadabilityEnabled(false);
top_label_->SetEnabledColor(kTopLabelColor);
top_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment