Commit 4efefb4a authored by Ewann's avatar Ewann Committed by Commit Bot

[iOS] Removes GetUIFont method

This CL removes the legacy GetUIFont method.

Bug: 1131056
Change-Id: I763c1cae6e8d1ce43517f5ba4745c0df961ad05b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2517488
Commit-Queue: Ewann Pellé <ewannpv@chromium.org>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#824375}
parent c41f65da
...@@ -498,7 +498,7 @@ class OpenInControllerBridge ...@@ -498,7 +498,7 @@ class OpenInControllerBridge
UILabel* label = [[UILabel alloc] init]; UILabel* label = [[UILabel alloc] init];
[label setTextColor:[UIColor whiteColor]]; [label setTextColor:[UIColor whiteColor]];
[label setFont:GetUIFont(FONT_HELVETICA, true, kLabelTextSize)]; [label setFont:[UIFont fontWithName:@"Helvetica-Bold" size:kLabelTextSize]];
[label setNumberOfLines:0]; [label setNumberOfLines:0];
[label setShadowColor:[UIColor blackColor]]; [label setShadowColor:[UIColor blackColor]];
[label setShadowOffset:CGSizeMake(0.0, 1.0)]; [label setShadowOffset:CGSizeMake(0.0, 1.0)];
......
...@@ -13,8 +13,6 @@ ...@@ -13,8 +13,6 @@
// UI Util containing functions that require UIKit. // UI Util containing functions that require UIKit.
enum { FONT_HELVETICA, FONT_HELVETICA_NEUE, FONT_HELVETICA_NEUE_LIGHT };
// Utility function to set the |element|'s accessibility label to the localized // Utility function to set the |element|'s accessibility label to the localized
// message corresponding to |idsAccessibilityLabel| and its accessibility // message corresponding to |idsAccessibilityLabel| and its accessibility
// identifier to |englishUiAutomationName|. // identifier to |englishUiAutomationName|.
...@@ -29,10 +27,6 @@ void SetA11yLabelAndUiAutomationName( ...@@ -29,10 +27,6 @@ void SetA11yLabelAndUiAutomationName(
int idsAccessibilityLabel, int idsAccessibilityLabel,
NSString* englishUiAutomationName); NSString* englishUiAutomationName);
// Returns a UIFont. |fontFace| is one of the defined enumerated values
// to avoid spelling mistakes.
UIFont* GetUIFont(int fontFace, bool isBold, CGFloat fontSize);
// Sets dynamic font for the given |font| on iOS 11+ on the givel |label| or // Sets dynamic font for the given |font| on iOS 11+ on the givel |label| or
// |textField|. Use |maybe| versions to keep code short when dynamic types are // |textField|. Use |maybe| versions to keep code short when dynamic types are
// not in use yet. // not in use yet.
......
...@@ -57,28 +57,6 @@ void SetA11yLabelAndUiAutomationName( ...@@ -57,28 +57,6 @@ void SetA11yLabelAndUiAutomationName(
[element setAccessibilityIdentifier:englishUiAutomationName]; [element setAccessibilityIdentifier:englishUiAutomationName];
} }
UIFont* GetUIFont(int fontFace, bool isBold, CGFloat fontSize) {
NSString* fontFaceName;
switch (fontFace) {
case FONT_HELVETICA:
fontFaceName = isBold ? @"Helvetica-Bold" : @"Helvetica";
break;
case FONT_HELVETICA_NEUE:
fontFaceName = isBold ? @"HelveticaNeue-Bold" : @"HelveticaNeue";
break;
case FONT_HELVETICA_NEUE_LIGHT:
// FONT_HELVETICA_NEUE_LIGHT does not support Bold.
DCHECK(!isBold);
fontFaceName = @"HelveticaNeue-Light";
break;
default:
NOTREACHED();
fontFaceName = @"Helvetica";
break;
}
return [UIFont fontWithName:fontFaceName size:fontSize];
}
void SetUILabelScaledFont(UILabel* label, UIFont* font) { void SetUILabelScaledFont(UILabel* label, UIFont* font) {
label.font = [[UIFontMetrics defaultMetrics] scaledFontForFont:font]; label.font = [[UIFontMetrics defaultMetrics] scaledFontForFont:font];
label.adjustsFontForContentSizeCategory = YES; label.adjustsFontForContentSizeCategory = YES;
......
...@@ -49,11 +49,6 @@ TEST_F(UIKitUIUtilTest, UIViewControllerSupportedOrientationsTest) { ...@@ -49,11 +49,6 @@ TEST_F(UIKitUIUtilTest, UIViewControllerSupportedOrientationsTest) {
EXPECT_EQ(expectedMask, [viewController supportedInterfaceOrientations]); EXPECT_EQ(expectedMask, [viewController supportedInterfaceOrientations]);
} }
TEST_F(UIKitUIUtilTest, TestGetUiFont) {
EXPECT_TRUE(GetUIFont(FONT_HELVETICA, false, 15.0));
EXPECT_TRUE(GetUIFont(FONT_HELVETICA_NEUE, true, 15.0));
}
// Verifies that greyImage never returns retina-scale images. // Verifies that greyImage never returns retina-scale images.
TEST_F(UIKitUIUtilTest, TestGreyImage) { TEST_F(UIKitUIUtilTest, TestGreyImage) {
// Create an image using the device's scale factor. // Create an image using the device's scale factor.
......
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