Commit d16de39e authored by Etienne Bergeron's avatar Etienne Bergeron Committed by Commit Bot

Remove GetPlatformFontHeight function

This CL is removing the function GetPlatformFontHeight since it's no
longer needed. It was used to be more complicated to get height of fonts
on windows. Since recent migration, the code is straigh forwards and
font heights are constants.

Address comments left on previous commit
  https://chromium-review.googlesource.com/c/chromium/src/+/1570653


R=tapted@chromium.org
CC=benck@chromium.org

Bug: 701241
Change-Id: I2db7c53914aa9105d5c9390dd98d5266998676c7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1642735Reviewed-by: default avatarTrent Apted <tapted@chromium.org>
Commit-Queue: Etienne Bergeron <etienneb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#666477}
parent 582a6b1c
...@@ -107,26 +107,6 @@ SkColor GetHarmonyTextColorForNonStandardNativeTheme( ...@@ -107,26 +107,6 @@ SkColor GetHarmonyTextColorForNonStandardNativeTheme(
} // namespace } // namespace
#if defined(OS_WIN)
// static
int ChromeTypographyProvider::GetPlatformFontHeight(int font_context) {
switch (font_context) {
case CONTEXT_HEADLINE:
return 27;
case views::style::CONTEXT_DIALOG_TITLE:
return 20;
case CONTEXT_BODY_TEXT_LARGE:
case CONTEXT_TAB_HOVER_CARD_TITLE:
case views::style::CONTEXT_MESSAGE_BOX_BODY_TEXT:
return 18;
case CONTEXT_BODY_TEXT_SMALL:
return 16;
}
NOTREACHED();
return 0;
}
#endif
const gfx::FontList& ChromeTypographyProvider::GetFont(int context, const gfx::FontList& ChromeTypographyProvider::GetFont(int context,
int style) const { int style) const {
// "Target" font size constants. // "Target" font size constants.
...@@ -284,14 +264,10 @@ int ChromeTypographyProvider::GetLineHeight(int context, int style) const { ...@@ -284,14 +264,10 @@ int ChromeTypographyProvider::GetLineHeight(int context, int style) const {
constexpr int kBodyTextLargePlatformHeight = 16; constexpr int kBodyTextLargePlatformHeight = 16;
constexpr int kBodyTextSmallPlatformHeight = 15; constexpr int kBodyTextSmallPlatformHeight = 15;
#elif defined(OS_WIN) #elif defined(OS_WIN)
static const int kHeadlinePlatformHeight = constexpr int kHeadlinePlatformHeight = 27;
GetPlatformFontHeight(CONTEXT_HEADLINE); constexpr int kTitlePlatformHeight = 20;
static const int kTitlePlatformHeight = constexpr int kBodyTextLargePlatformHeight = 18;
GetPlatformFontHeight(views::style::CONTEXT_DIALOG_TITLE); constexpr int kBodyTextSmallPlatformHeight = 16;
static const int kBodyTextLargePlatformHeight =
GetPlatformFontHeight(CONTEXT_BODY_TEXT_LARGE);
static const int kBodyTextSmallPlatformHeight =
GetPlatformFontHeight(CONTEXT_BODY_TEXT_SMALL);
#else #else
constexpr int kHeadlinePlatformHeight = 24; constexpr int kHeadlinePlatformHeight = 24;
constexpr int kTitlePlatformHeight = 18; constexpr int kTitlePlatformHeight = 18;
......
...@@ -14,13 +14,6 @@ class ChromeTypographyProvider : public views::TypographyProvider { ...@@ -14,13 +14,6 @@ class ChromeTypographyProvider : public views::TypographyProvider {
public: public:
ChromeTypographyProvider() = default; ChromeTypographyProvider() = default;
#if defined(OS_WIN)
// Returns the expected platform font height for the current system
// configuration. Different configurations can produce slightly different
// results.
static int GetPlatformFontHeight(int font_context);
#endif
// TypographyProvider: // TypographyProvider:
const gfx::FontList& GetFont(int context, int style) const override; const gfx::FontList& GetFont(int context, int style) const override;
SkColor GetColor(const views::View& view, SkColor GetColor(const views::View& view,
......
...@@ -245,8 +245,7 @@ TEST_F(LayoutProviderTest, RequestFontBySize) { ...@@ -245,8 +245,7 @@ TEST_F(LayoutProviderTest, RequestFontBySize) {
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
EXPECT_EQ(25, headline_font.GetHeight()); EXPECT_EQ(25, headline_font.GetHeight());
#elif defined(OS_WIN) #elif defined(OS_WIN)
EXPECT_EQ(ChromeTypographyProvider::GetPlatformFontHeight(CONTEXT_HEADLINE), EXPECT_EQ(27, headline_font.GetHeight());
headline_font.GetHeight());
#else #else
EXPECT_EQ(24, headline_font.GetHeight()); EXPECT_EQ(24, headline_font.GetHeight());
#endif #endif
...@@ -268,9 +267,7 @@ TEST_F(LayoutProviderTest, RequestFontBySize) { ...@@ -268,9 +267,7 @@ TEST_F(LayoutProviderTest, RequestFontBySize) {
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
EXPECT_EQ(16, body1_font.GetHeight()); // Add 4. EXPECT_EQ(16, body1_font.GetHeight()); // Add 4.
#elif defined(OS_WIN) #elif defined(OS_WIN)
EXPECT_EQ( EXPECT_EQ(18, body1_font.GetHeight());
ChromeTypographyProvider::GetPlatformFontHeight(CONTEXT_BODY_TEXT_LARGE),
body1_font.GetHeight());
#else // Linux. #else // Linux.
EXPECT_EQ(17, body1_font.GetHeight()); // Add 3. EXPECT_EQ(17, body1_font.GetHeight()); // Add 3.
#endif #endif
...@@ -279,9 +276,7 @@ TEST_F(LayoutProviderTest, RequestFontBySize) { ...@@ -279,9 +276,7 @@ TEST_F(LayoutProviderTest, RequestFontBySize) {
// Body2 font leading should be 20. // Body2 font leading should be 20.
#if defined(OS_WIN) #if defined(OS_WIN)
EXPECT_EQ( EXPECT_EQ(16, body2_font.GetHeight());
ChromeTypographyProvider::GetPlatformFontHeight(CONTEXT_BODY_TEXT_SMALL),
body2_font.GetHeight());
#else #else
EXPECT_EQ(15, body2_font.GetHeight()); // Other platforms: Add 5. EXPECT_EQ(15, body2_font.GetHeight()); // Other platforms: Add 5.
#endif #endif
...@@ -290,9 +285,7 @@ TEST_F(LayoutProviderTest, RequestFontBySize) { ...@@ -290,9 +285,7 @@ TEST_F(LayoutProviderTest, RequestFontBySize) {
// Button leading not specified (shouldn't be needed: no multiline buttons). // Button leading not specified (shouldn't be needed: no multiline buttons).
#if defined(OS_WIN) #if defined(OS_WIN)
EXPECT_EQ( EXPECT_EQ(16, button_font.GetHeight());
ChromeTypographyProvider::GetPlatformFontHeight(CONTEXT_BODY_TEXT_SMALL),
button_font.GetHeight());
#else #else
EXPECT_EQ(15, button_font.GetHeight()); EXPECT_EQ(15, button_font.GetHeight());
#endif #endif
......
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