diff options
author | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-04 20:48:52 +0000 |
---|---|---|
committer | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-04 20:48:52 +0000 |
commit | 0188917543512f6381b41319f404c68ddb0a6531 (patch) | |
tree | 709aabfcfe0332c8daec5fe95a35a34feecbd987 /views | |
parent | df30ad8bc6e1937a31cdff84cb858fc2f6290538 (diff) | |
download | chromium_src-0188917543512f6381b41319f404c68ddb0a6531.zip chromium_src-0188917543512f6381b41319f404c68ddb0a6531.tar.gz chromium_src-0188917543512f6381b41319f404c68ddb0a6531.tar.bz2 |
While changing the label class I added a DCHECK to
make sure the function I was changing was never
called for multiline labels (it never was supposed
to work for multiline labels, even before my change).
Turns out, this flushed out a caller who calls it
for multiline labels, and gets the wrong results.
BUG=None
TEST=Trigger a javascript alert with multiple lines.
Make sure no DCHECK happens. If you set a breakpoint
on the function I'm changing and hover over the label,
when you step through the code, you'll see that it now
correctly computes the bounds of the label based on
the width and calls SetContainsMouse with true
instead of false.
Review URL: http://codereview.chromium.org/361001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30993 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rwxr-xr-x | views/controls/label.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/views/controls/label.cc b/views/controls/label.cc index 2f25aad..ae98543 100755 --- a/views/controls/label.cc +++ b/views/controls/label.cc @@ -418,7 +418,12 @@ gfx::Font Label::GetDefaultFont() { } void Label::UpdateContainsMouse(const MouseEvent& event) { - SetContainsMouse(GetTextBounds().Contains(event.x(), event.y())); + if (is_multi_line_) { + gfx::Rect rect(width(), GetHeightForWidth(width())); + SetContainsMouse(rect.Contains(event.x(), event.y())); + } else { + SetContainsMouse(GetTextBounds().Contains(event.x(), event.y())); + } } void Label::SetContainsMouse(bool contains_mouse) { |