summaryrefslogtreecommitdiffstats
path: root/chrome/common/gfx
diff options
context:
space:
mode:
authorlevin@chromium.org <levin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-01 00:20:21 +0000
committerlevin@chromium.org <levin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-01 00:20:21 +0000
commit40d41b949d3a0b4238f6c01bd165c648375d979e (patch)
tree96bbe2b0a75296354133696163691feaff102321 /chrome/common/gfx
parent5affc15f3a8a51f42debbf37806087dfbc84818f (diff)
downloadchromium_src-40d41b949d3a0b4238f6c01bd165c648375d979e.zip
chromium_src-40d41b949d3a0b4238f6c01bd165c648375d979e.tar.gz
chromium_src-40d41b949d3a0b4238f6c01bd165c648375d979e.tar.bz2
Make multiline labels respect the inset.
Add a unittest for label.cc Review URL: http://codereview.chromium.org/8902 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4351 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/gfx')
-rw-r--r--chrome/common/gfx/chrome_canvas.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/chrome/common/gfx/chrome_canvas.cc b/chrome/common/gfx/chrome_canvas.cc
index 9fc67c8..064a931 100644
--- a/chrome/common/gfx/chrome_canvas.cc
+++ b/chrome/common/gfx/chrome_canvas.cc
@@ -279,6 +279,10 @@ void ChromeCanvas::SizeStringInt(const std::wstring& text,
b.left = 0;
b.top = 0;
b.right = *width;
+ if (b.right == 0 && !text.empty()) {
+ // Width needs to be at least 1 or else DoDrawText will not resize it.
+ b.right = 1;
+ }
b.bottom = *height;
DoDrawText(dc, text, &b, ComputeFormatFlags(flags) | DT_CALCRECT);
endPlatformPaint();
@@ -388,4 +392,3 @@ SkBitmap ChromeCanvas::ExtractBitmap() {
device_bitmap.copyTo(&result, SkBitmap::kARGB_8888_Config);
return result;
}
-