diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-05 21:07:17 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-05 21:07:17 +0000 |
commit | bd0979609230cc9b1026e98f17f629bf0cfb6b8c (patch) | |
tree | 033fffdd50b98823f70a174e66dbe7af17ef99e1 /views | |
parent | 26ef58b74eb86e3520542ecd1eb768d71a374601 (diff) | |
download | chromium_src-bd0979609230cc9b1026e98f17f629bf0cfb6b8c.zip chromium_src-bd0979609230cc9b1026e98f17f629bf0cfb6b8c.tar.gz chromium_src-bd0979609230cc9b1026e98f17f629bf0cfb6b8c.tar.bz2 |
Make Font::GetStringWidth() a shortcut for gfx::Canvas::SizeStringInt() on Windows. These two functions already did the same thing on Mac and Linux. If they ever returned different results on Windows, it would lead to subtle bugs, since measurement and drawing would slightly disagree.
Clean up a few other things so that all three implementations of GetStringWidth() are identical.
BUG=38717
TEST=none
Review URL: http://codereview.chromium.org/1928003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46492 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/controls/label.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/views/controls/label.cc b/views/controls/label.cc index a9d74ac..2aff154 100644 --- a/views/controls/label.cc +++ b/views/controls/label.cc @@ -342,8 +342,10 @@ gfx::Rect Label::GetTextBounds() const { case ALIGN_LEFT: break; case ALIGN_CENTER: - // We put any extra margin pixel on the left rather than the right, since - // GetTextExtentPoint32() can report a value one too large on the right. + // We put any extra margin pixel on the left rather than the right. We + // used to do this because measurement on Windows used + // GetTextExtentPoint32(), which could report a value one too large on the + // right; we now use DrawText(), and who knows if it can also do this. text_origin.Offset((available_rect.width() + 1 - text_size.width()) / 2, 0); break; |