Commit 38b5c184 authored by Peter Boström's avatar Peter Boström Committed by Commit Bot

Add typography style STYLE_EMPHASIZED_SECONDARY.

Uses this + STYLE_SECONDARY for the SettingsResetPromptDialog to match
the desired secondary style. Without STYLE_EMPHASIZED_SECONDARY the
emphasized text would be bold black which sticks out way too much
against the secondary gray.

Bug: chromium:698785
Change-Id: I3f9d1d3423ff3e990cc67f131f33ff0c7ddf55ff
Reviewed-on: https://chromium-review.googlesource.com/974065Reviewed-by: default avatarBret Sepulveda <bsep@chromium.org>
Reviewed-by: default avatarTrent Apted <tapted@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#545172}
parent 5be17747
...@@ -54,6 +54,7 @@ const gfx::FontList& LegacyTypographyProvider::GetFont(int context, ...@@ -54,6 +54,7 @@ const gfx::FontList& LegacyTypographyProvider::GetFont(int context,
switch (style) { switch (style) {
case STYLE_EMPHASIZED: case STYLE_EMPHASIZED:
case STYLE_EMPHASIZED_SECONDARY:
font_weight = gfx::Font::Weight::BOLD; font_weight = gfx::Font::Weight::BOLD;
break; break;
} }
...@@ -66,8 +67,10 @@ SkColor LegacyTypographyProvider::GetColor(const views::View& view, ...@@ -66,8 +67,10 @@ SkColor LegacyTypographyProvider::GetColor(const views::View& view,
int context, int context,
int style) const { int style) const {
// Use "disabled grey" for HINT and SECONDARY when Harmony is disabled. // Use "disabled grey" for HINT and SECONDARY when Harmony is disabled.
if (style == STYLE_HINT || style == STYLE_SECONDARY) if (style == STYLE_HINT || style == STYLE_SECONDARY ||
style == STYLE_EMPHASIZED_SECONDARY) {
style = views::style::STYLE_DISABLED; style = views::style::STYLE_DISABLED;
}
return DefaultTypographyProvider::GetColor(view, context, style); return DefaultTypographyProvider::GetColor(view, context, style);
} }
...@@ -59,6 +59,10 @@ enum ChromeTextStyle { ...@@ -59,6 +59,10 @@ enum ChromeTextStyle {
// Used to draw attention to a section of body text such as an extension name // Used to draw attention to a section of body text such as an extension name
// or hostname. // or hostname.
STYLE_EMPHASIZED, STYLE_EMPHASIZED,
// Emphasized secondary style. Like STYLE_EMPHASIZED but styled to match
// surrounding STYLE_SECONDARY text.
STYLE_EMPHASIZED_SECONDARY,
}; };
// Sets the |size_delta| and |font_weight| for text that should not be affected // Sets the |size_delta| and |font_weight| for text that should not be affected
......
...@@ -142,7 +142,7 @@ const gfx::FontList& HarmonyTypographyProvider::GetFont(int context, ...@@ -142,7 +142,7 @@ const gfx::FontList& HarmonyTypographyProvider::GetFont(int context,
// Use a bold style for emphasized text in body contexts, and ignore |style| // Use a bold style for emphasized text in body contexts, and ignore |style|
// otherwise. // otherwise.
if (style == STYLE_EMPHASIZED) { if (style == STYLE_EMPHASIZED || style == STYLE_EMPHASIZED_SECONDARY) {
switch (context) { switch (context) {
case CONTEXT_BODY_TEXT_SMALL: case CONTEXT_BODY_TEXT_SMALL:
case CONTEXT_BODY_TEXT_LARGE: case CONTEXT_BODY_TEXT_LARGE:
...@@ -194,6 +194,7 @@ SkColor HarmonyTypographyProvider::GetColor(const views::View& view, ...@@ -194,6 +194,7 @@ SkColor HarmonyTypographyProvider::GetColor(const views::View& view,
case views::style::STYLE_LINK: case views::style::STYLE_LINK:
return gfx::kGoogleBlue700; return gfx::kGoogleBlue700;
case STYLE_SECONDARY: case STYLE_SECONDARY:
case STYLE_EMPHASIZED_SECONDARY:
case STYLE_HINT: case STYLE_HINT:
return SkColorSetRGB(0x75, 0x75, 0x75); return SkColorSetRGB(0x75, 0x75, 0x75);
case STYLE_RED: case STYLE_RED:
......
...@@ -44,8 +44,9 @@ SettingsResetPromptDialog::SettingsResetPromptDialog( ...@@ -44,8 +44,9 @@ SettingsResetPromptDialog::SettingsResetPromptDialog(
views::StyledLabel* dialog_label = views::StyledLabel* dialog_label =
new views::StyledLabel(controller_->GetMainText(), /*listener=*/nullptr); new views::StyledLabel(controller_->GetMainText(), /*listener=*/nullptr);
dialog_label->SetTextContext(CONTEXT_BODY_TEXT_LARGE); dialog_label->SetTextContext(CONTEXT_BODY_TEXT_LARGE);
dialog_label->SetDefaultTextStyle(STYLE_SECONDARY);
views::StyledLabel::RangeStyleInfo url_style; views::StyledLabel::RangeStyleInfo url_style;
url_style.text_style = STYLE_EMPHASIZED; url_style.text_style = STYLE_EMPHASIZED_SECONDARY;
dialog_label->AddStyleRange(controller_->GetMainTextUrlRange(), url_style); dialog_label->AddStyleRange(controller_->GetMainTextUrlRange(), url_style);
AddChildView(dialog_label); AddChildView(dialog_label);
} }
......
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