diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-29 20:30:27 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-29 20:30:27 +0000 |
commit | 135c20361491522381a596cf036d17eedc501a46 (patch) | |
tree | e40bdee98460c61b637750ee35618a76a6e7abd0 /chrome/common | |
parent | 309934c4ceea5086567f275cef17bbfefa29996b (diff) | |
download | chromium_src-135c20361491522381a596cf036d17eedc501a46.zip chromium_src-135c20361491522381a596cf036d17eedc501a46.tar.gz chromium_src-135c20361491522381a596cf036d17eedc501a46.tar.bz2 |
Patch by Shinichiro Hamaji <hamaji@google.com>:
Allow words to be wrapped in message box.
We use DT_WORDBREK|DT_EDITCONTROL as the argument of DrawText().
With this option, DrawText() try to wrap texts at word-breaks first,
then wraps at non-word-breaks if one line is still too long.
This change only affects for Labels in MessageBox.
If we can always use this policy, please let me know
and I'll fix the code.
http://crbug.com/2441
Review URL: http://codereview.chromium.org/100013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14878 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/gfx/chrome_canvas.h | 4 | ||||
-rw-r--r-- | chrome/common/gfx/chrome_canvas_win.cc | 2 |
2 files changed, 6 insertions, 0 deletions
diff --git a/chrome/common/gfx/chrome_canvas.h b/chrome/common/gfx/chrome_canvas.h index dbf9466..a16f9da 100644 --- a/chrome/common/gfx/chrome_canvas.h +++ b/chrome/common/gfx/chrome_canvas.h @@ -59,6 +59,10 @@ class ChromeCanvas : public skia::PlatformCanvas { // Prevent ellipsizing NO_ELLIPSIS = 512, + + // Specifies if words can be split by new lines. + // This only works with MULTI_LINE. + CHARACTER_BREAK = 1024, }; // Creates an empty ChromeCanvas. Callers must use initialize before using diff --git a/chrome/common/gfx/chrome_canvas_win.cc b/chrome/common/gfx/chrome_canvas_win.cc index 38446ca..1f14703 100644 --- a/chrome/common/gfx/chrome_canvas_win.cc +++ b/chrome/common/gfx/chrome_canvas_win.cc @@ -54,6 +54,8 @@ int ComputeFormatFlags(int flags, const std::wstring& text) { if (flags & ChromeCanvas::MULTI_LINE) { f |= DT_WORDBREAK; + if (flags & ChromeCanvas::CHARACTER_BREAK) + f |= DT_EDITCONTROL; } else { f |= DT_SINGLELINE | DT_VCENTER; if (!(flags & ChromeCanvas::NO_ELLIPSIS)) |