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

Unified Diff: chrome/browser/ui/views/location_bar/location_bar_view.cc

Issue 59873002: Center the font height instead of cap height when cap height is not supported. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Synced. Created 7 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/location_bar/location_bar_view.cc
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc
index 9e3c44428699536ddf4387e36b59d5cc925bf7e0..f2388eca4dfbb9eb47bdd4c2dcc7361b47cc25c1 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -146,7 +146,13 @@ gfx::FontList GetLargestFontListWithHeightBound(
for (int font_size = font_list.GetFontSize(); font_size > 1; --font_size) {
const int internal_leading =
font_list.GetBaseline() - font_list.GetCapHeight();
- const int space = height - font_list.GetCapHeight();
+ // Some platforms don't support getting the cap height, and simply return
+ // the entire font ascent from GetCapHeight(). Centering the ascent makes
+ // the font look too low, so if GetCapHeight() returns the ascent, center
+ // the entire font height instead.
+ const int space =
+ height - ((internal_leading != 0) ?
+ font_list.GetCapHeight() : font_list.GetHeight());
const int y_offset = space / 2 - internal_leading;
const int space_at_bottom = height - (y_offset + font_list.GetHeight());
if ((y_offset >= 0) && (space_at_bottom >= 0))
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698