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

Unified Diff: chrome/browser/ui/views/harmony/harmony_typography_provider.cc

Issue 2801583002: Use views::style for buttons, bootstrap ash_typography to do so. (Closed)
Patch Set: rebase for epic ash file move Created 3 years, 8 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
Index: chrome/browser/ui/views/harmony/harmony_typography_provider.cc
diff --git a/chrome/browser/ui/views/harmony/harmony_typography_provider.cc b/chrome/browser/ui/views/harmony/harmony_typography_provider.cc
index 21caf0cb832f7db4b16030d0338632a8d7852927..68eaa9836c66bb9155be2fffcaf41ef24e6c77fb 100644
--- a/chrome/browser/ui/views/harmony/harmony_typography_provider.cc
+++ b/chrome/browser/ui/views/harmony/harmony_typography_provider.cc
@@ -8,6 +8,10 @@
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/platform_font.h"
+#if defined(USE_ASH)
+#include "ash/ash_typography.h"
+#endif
+
const gfx::FontList& HarmonyTypographyProvider::GetFont(int text_context,
int text_style) const {
// "Target" font size constants from the Harmony spec.
@@ -24,9 +28,14 @@ const gfx::FontList& HarmonyTypographyProvider::GetFont(int text_context,
int size_delta = kDefaultSize - gfx::PlatformFont::kDefaultBaseFontSize;
gfx::Font::Weight font_weight = gfx::Font::Weight::NORMAL;
+
+#if defined(USE_ASH)
+ ash::GetDefaultAshFont(text_context, text_style, &size_delta, &font_weight);
+#endif
+
switch (text_context) {
- case CONTEXT_HEADLINE:
- size_delta = kHeadlineSize - gfx::PlatformFont::kDefaultBaseFontSize;
+ case views::style::CONTEXT_DIALOG_BUTTON:
+ font_weight = WeightNotLighterThanNormal(kButtonFontWeight);
break;
case views::style::CONTEXT_DIALOG_TITLE:
size_delta = kTitleSize - gfx::PlatformFont::kDefaultBaseFontSize;
@@ -34,14 +43,15 @@ const gfx::FontList& HarmonyTypographyProvider::GetFont(int text_context,
case CONTEXT_BODY_TEXT_LARGE:
size_delta = kBodyTextLargeSize - gfx::PlatformFont::kDefaultBaseFontSize;
break;
- case views::style::CONTEXT_BUTTON:
- font_weight = kButtonFontWeight;
+ case CONTEXT_HEADLINE:
+ size_delta = kHeadlineSize - gfx::PlatformFont::kDefaultBaseFontSize;
break;
default:
break;
}
// Ignore |text_style| since it only affects color in the Harmony spec.
+
return ui::ResourceBundle::GetSharedInstance().GetFontListWithDelta(
size_delta, gfx::Font::NORMAL, font_weight);
}
@@ -107,14 +117,14 @@ int HarmonyTypographyProvider::GetLineHeight(int text_context,
kBodyTextSmallPlatformHeight + kBodyHeight;
switch (text_context) {
- case CONTEXT_HEADLINE:
- return headline_height;
+ case views::style::CONTEXT_DIALOG_BUTTON:
tapted 2017/04/10 12:27:33 There may still be a downside here to having Label
Peter Kasting 2017/04/10 22:56:02 Yeah, it seems desirable to return 0 here for Labe
+ return kButtonAbsoluteHeight;
case views::style::CONTEXT_DIALOG_TITLE:
return title_height;
case CONTEXT_BODY_TEXT_LARGE:
return body_large_height;
- case views::style::CONTEXT_BUTTON:
- return kButtonAbsoluteHeight;
+ case CONTEXT_HEADLINE:
+ return headline_height;
default:
return default_height;
}
« no previous file with comments | « chrome/browser/ui/views/harmony/chrome_typography.cc ('k') | chrome/browser/ui/views/harmony/layout_delegate_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698