summaryrefslogtreecommitdiffstats
path: root/views/controls
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-02 22:26:01 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-02 22:26:01 +0000
commit66332e24c78e0b03b3ab5ef3a02d468b3484f128 (patch)
treeed21e7cdcc0f67a0e209d6f0a9e1b0cbfd3325e2 /views/controls
parent3d0d8d4edcb096eb3b89d5ab286bbb5ac9d41c66 (diff)
downloadchromium_src-66332e24c78e0b03b3ab5ef3a02d468b3484f128.zip
chromium_src-66332e24c78e0b03b3ab5ef3a02d468b3484f128.tar.gz
chromium_src-66332e24c78e0b03b3ab5ef3a02d468b3484f128.tar.bz2
Not all text-sizing calls took the insets into account, leading to inconsistent eliding.
BUG=none TEST=none Review URL: http://codereview.chromium.org/4233003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64830 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls')
-rw-r--r--views/controls/label.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/views/controls/label.cc b/views/controls/label.cc
index 9421444..32df88a 100644
--- a/views/controls/label.cc
+++ b/views/controls/label.cc
@@ -184,7 +184,8 @@ bool Label::GetTooltipText(const gfx::Point& p, std::wstring* tooltip) {
}
// Show the full text if the text does not fit.
- if (!is_multi_line_ && font_.GetStringWidth(text_) > width()) {
+ if (!is_multi_line_ &&
+ (font_.GetStringWidth(text_) > GetAvailableRect().width())) {
*tooltip = text_;
return true;
}
@@ -423,8 +424,8 @@ void Label::CalculateDrawStringParams(std::wstring* paint_text,
if (url_set_) {
// TODO(jungshik) : Figure out how to get 'intl.accept_languages'
// preference and use it when calling ElideUrl.
- *paint_text = UTF16ToWideHack(gfx::ElideUrl(url_, font_, width(),
- std::wstring()));
+ *paint_text = UTF16ToWideHack(
+ gfx::ElideUrl(url_, font_, GetAvailableRect().width(), std::wstring()));
// An URLs is always treated as an LTR text and therefore we should
// explicitly mark it as such if the locale is RTL so that URLs containing
@@ -439,7 +440,7 @@ void Label::CalculateDrawStringParams(std::wstring* paint_text,
WideToUTF16(*paint_text)));
} else if (elide_in_middle_) {
*paint_text = UTF16ToWideHack(gfx::ElideText(WideToUTF16Hack(text_),
- font_, width(), true));
+ font_, GetAvailableRect().width(), true));
} else {
*paint_text = text_;
}