diff options
author | oshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-25 23:15:09 +0000 |
---|---|---|
committer | oshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-25 23:15:09 +0000 |
commit | cf592b5d7733555f89fccf67b154f1f8432a1cd4 (patch) | |
tree | 22e068694a2eee91bbfbfa9511302fc078389583 /views | |
parent | 39ec12fce7ae90a018d0f37138d042a76e6d2846 (diff) | |
download | chromium_src-cf592b5d7733555f89fccf67b154f1f8432a1cd4.zip chromium_src-cf592b5d7733555f89fccf67b154f1f8432a1cd4.tar.gz chromium_src-cf592b5d7733555f89fccf67b154f1f8432a1cd4.tar.bz2 |
Fix caret bounds to use min of available height and font height.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6733058
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79469 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/controls/textfield/native_textfield_views.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/views/controls/textfield/native_textfield_views.cc b/views/controls/textfield/native_textfield_views.cc index 17885ba..48bdea9 100644 --- a/views/controls/textfield/native_textfield_views.cc +++ b/views/controls/textfield/native_textfield_views.cc @@ -452,8 +452,11 @@ void NativeTextfieldViews::UpdateCursorBoundsAndTextOffset() { // TODO(oshima): bidi const gfx::Font& font = GetFont(); int full_width = font.GetStringWidth(model_->GetVisibleText()); + int cursor_height = std::min(height() - insets.height(), font.GetHeight()); + cursor_bounds_ = model_->GetCursorBounds(font); - cursor_bounds_.set_y(cursor_bounds_.y() + insets.top()); + cursor_bounds_.set_y((height() - cursor_height) / 2); + cursor_bounds_.set_height(cursor_height); int x_right = text_offset_ + cursor_bounds_.right(); int x_left = text_offset_ + cursor_bounds_.x(); |