Index: views/controls/textfield/native_textfield_views.cc |
=================================================================== |
--- views/controls/textfield/native_textfield_views.cc (revision 103192) |
+++ views/controls/textfield/native_textfield_views.cc (working copy) |
@@ -225,13 +225,12 @@ |
selected.selection_end()); |
size_t selected_range_length = max_of_selected_range - |
min_of_selected_range; |
- if (max_of_selected_range <= drop_destination.selection_end()) |
- drop_destination.set_selection_end( |
- drop_destination.selection_end() - selected_range_length); |
- else if (min_of_selected_range <= drop_destination.selection_end()) |
- drop_destination.set_selection_end(min_of_selected_range); |
- model_->DeleteSelectionAndInsertTextAt(text, |
- drop_destination.selection_end()); |
+ size_t drop_destination_end = drop_destination.selection_end(); |
+ if (max_of_selected_range <= drop_destination_end) |
+ drop_destination_end -= selected_range_length; |
+ else if (min_of_selected_range <= drop_destination_end) |
+ drop_destination_end = min_of_selected_range; |
+ model_->DeleteSelectionAndInsertTextAt(text, drop_destination_end); |
} else { |
drop_destination.set_selection_start(drop_destination.selection_end()); |
model_->MoveCursorTo(drop_destination); |
@@ -1013,10 +1012,10 @@ |
return; |
gfx::RenderText* render_text = GetRenderText(); |
const gfx::SelectionModel& sel = render_text->selection_model(); |
- gfx::SelectionModel start_sel(sel.selection_start(), sel.selection_start(), |
- 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::SelectionModel start_sel = |
+ render_text->GetSelectionModelForSelectionStart(); |
+ gfx::Rect start_cursor = render_text->GetCursorBounds(start_sel, true); |
+ gfx::Rect end_cursor = render_text->GetCursorBounds(sel, true); |
gfx::Point start(start_cursor.x(), start_cursor.bottom() - 1); |
gfx::Point end(end_cursor.x(), end_cursor.bottom() - 1); |
touch_selection_controller_->SelectionChanged(start, end); |