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

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: 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..dd8e6e33a095824f7917cb098f7895503e49d0ab 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,11 @@ 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();
+ // If cap height is supported (i.e. internal_leading != 0), we have the cap
+ // height centered. If not, we have the font height centered.
Peter Kasting 2013/11/05 22:18:01 Nit: How about this: Some platforms don't support
Yuki 2013/11/06 02:38:42 Done.
+ 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