[ios] Ensure that Omnibox placeholder uses the correct font
The font normally gets set as part of the process when the user begins
editing a URL. But if the NTP is displayed before a web page and the
user focuses the omnibox, the placeholder can be displayed in the wrong
font because none has been set yet. This fixes that by setting the font
in the initializer.
Fixed: 1492322
Change-Id: I84e653c5bddd0c53d08e975e307c024c89228888
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4935234
Reviewed-by: Stepan Khapugin <stkhapugin@chromium.org>
Commit-Queue: Scott Yoder <scottyoder@google.com>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1210169}
diff --git a/ios/chrome/browser/ui/omnibox/omnibox_text_field_experimental.mm b/ios/chrome/browser/ui/omnibox/omnibox_text_field_experimental.mm
index 485d25f..975a2e3 100644
--- a/ios/chrome/browser/ui/omnibox/omnibox_text_field_experimental.mm
+++ b/ios/chrome/browser/ui/omnibox/omnibox_text_field_experimental.mm
@@ -103,6 +103,7 @@
// Force initial layout of internal text label. Needed for omnibox
// animations that will otherwise animate the text label from origin {0, 0}.
+ self.font = self.currentFont;
[super setText:@" "];
[self addGestureRecognizer:[[UITapGestureRecognizer alloc]