diff options
author | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-15 04:26:32 +0000 |
---|---|---|
committer | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-15 04:26:32 +0000 |
commit | 2c79974a4526a43c2f33c42832c6817bd4e1d7f3 (patch) | |
tree | 6998fbd5806660976cb47dfb53580822d1357acd /gfx | |
parent | fbbcb12a0fc8455d48b0030287c347569a035d29 (diff) | |
download | chromium_src-2c79974a4526a43c2f33c42832c6817bd4e1d7f3.zip chromium_src-2c79974a4526a43c2f33c42832c6817bd4e1d7f3.tar.gz chromium_src-2c79974a4526a43c2f33c42832c6817bd4e1d7f3.tar.bz2 |
Revert Win specific elements of 46492 to look for perf impact
There was a regression in the moz page cycler around when
landed. This was ONLY a single core regression, which
suggests it was time spent in the browser becoming
critical path. This change involved font layout in the
browser, and so it MIGHT be related.
I'll land this, let the per bots start their run, and
then revert.
TBR=pkasting
Review URL: http://codereview.chromium.org/2895017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52441 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gfx')
-rw-r--r-- | gfx/font_win.cc | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/gfx/font_win.cc b/gfx/font_win.cc index f9b7243..5660cc7 100644 --- a/gfx/font_win.cc +++ b/gfx/font_win.cc @@ -170,9 +170,18 @@ Font Font::DeriveFont(int size_delta, int style) const { } int Font::GetStringWidth(const std::wstring& text) const { - int width = 0, height = 0; - CanvasSkia::SizeStringInt(text, *this, &width, &height, - gfx::Canvas::NO_ELLIPSIS); + 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); return width; } |