summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-30 00:12:29 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-30 00:12:29 +0000
commitb19117df31ce9b72e7776ee82287bd582d69c57e (patch)
tree6239988e826cac910e9700d18eadc651a21d51b0
parent8314cc5be9d5237e22f953ce1f42fb05903af6a8 (diff)
downloadchromium_src-b19117df31ce9b72e7776ee82287bd582d69c57e.zip
chromium_src-b19117df31ce9b72e7776ee82287bd582d69c57e.tar.gz
chromium_src-b19117df31ce9b72e7776ee82287bd582d69c57e.tar.bz2
Attempt to reland code reverted in r52599, to take another look at the page cycler data. There was a lot of noise in the previous data, and since the current page cycler t and t_ref times are close, I'm hoping to see something more conclusive.
TBR=jar BUG=47227 TEST=none Review URL: http://codereview.chromium.org/3026032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54236 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--gfx/font_win.cc15
-rw-r--r--views/controls/label.cc6
2 files changed, 7 insertions, 14 deletions
diff --git a/gfx/font_win.cc b/gfx/font_win.cc
index 5660cc7..f9b7243 100644
--- a/gfx/font_win.cc
+++ b/gfx/font_win.cc
@@ -170,18 +170,9 @@ Font Font::DeriveFont(int size_delta, int style) const {
}
int Font::GetStringWidth(const std::wstring& text) const {
- int width = 0;
- HDC dc = GetDC(NULL);
- HFONT previous_font = static_cast<HFONT>(SelectObject(dc, hfont()));
- SIZE size;
- if (GetTextExtentPoint32(dc, text.c_str(), static_cast<int>(text.size()),
- &size)) {
- width = size.cx;
- } else {
- width = 0;
- }
- SelectObject(dc, previous_font);
- ReleaseDC(NULL, dc);
+ int width = 0, height = 0;
+ CanvasSkia::SizeStringInt(text, *this, &width, &height,
+ gfx::Canvas::NO_ELLIPSIS);
return width;
}
diff --git a/views/controls/label.cc b/views/controls/label.cc
index a9448ba7..e2f5091 100644
--- a/views/controls/label.cc
+++ b/views/controls/label.cc
@@ -365,8 +365,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;