Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(262)

Unified Diff: views/controls/textfield/native_textfield_views.cc

Issue 7466048: Fix RenderText cached bounds and offset logic; update clients. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Invalidate on SetText, update comments. Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: views/controls/textfield/native_textfield_views.cc
diff --git a/views/controls/textfield/native_textfield_views.cc b/views/controls/textfield/native_textfield_views.cc
index c41136d6a840126a888024f7a50bea9f2753355b..810bad1d3c4c715f107cae0632cf7b5812960e83 100644
--- a/views/controls/textfield/native_textfield_views.cc
+++ b/views/controls/textfield/native_textfield_views.cc
@@ -607,7 +607,7 @@ void NativeTextfieldViews::OnBoundsChanged(const gfx::Rect& previous_bounds) {
insets.top(),
width() - insets.width(),
height() - insets.height());
- GetRenderText()->set_display_rect(display_rect);
+ GetRenderText()->SetDisplayRect(display_rect);
OnCaretBoundsChanged();
}
@@ -693,7 +693,7 @@ ui::TextInputType NativeTextfieldViews::GetTextInputType() {
}
gfx::Rect NativeTextfieldViews::GetCaretBounds() {
- return GetRenderText()->CursorBounds();
+ return GetRenderText()->GetUpdatedCursorBounds();
}
bool NativeTextfieldViews::HasCompositionText() {
@@ -990,14 +990,8 @@ void NativeTextfieldViews::OnCaretBoundsChanged() {
sel.selection_start(), gfx::SelectionModel::LEADING);
gfx::Rect start_cursor = render_text->GetCursorBounds(start_sel, false);
gfx::Rect end_cursor = render_text->GetCursorBounds(sel, false);
- gfx::Rect display_rect = render_text->display_rect();
- int total_offset_x = display_rect.x() + render_text->display_offset().x();
- int total_offset_y = display_rect.y() + render_text->display_offset().y() +
- (display_rect.height() - start_cursor.height()) / 2;
- gfx::Point start(start_cursor.x() + total_offset_x,
- start_cursor.bottom() + total_offset_y);
- gfx::Point end(end_cursor.x() + total_offset_x,
- end_cursor.bottom() + total_offset_y);
+ gfx::Point start(start_cursor.x(), start_cursor.bottom());
+ gfx::Point end(end_cursor.x(), end_cursor.bottom());
touch_selection_controller_->SelectionChanged(start, end);
}

Powered by Google App Engine
This is Rietveld 408576698