| Index: views/controls/textfield/native_textfield_views.cc
|
| ===================================================================
|
| --- views/controls/textfield/native_textfield_views.cc (revision 95171)
|
| +++ views/controls/textfield/native_textfield_views.cc (working copy)
|
| @@ -198,7 +198,7 @@
|
| skip_input_method_cancel_composition_ = true;
|
|
|
| // TODO(msw): Remove final reference to FindCursorPosition.
|
| - size_t drop_destination =
|
| + gfx::SelectionModel drop_destination =
|
| GetRenderText()->FindCursorPosition(event.location());
|
| string16 text;
|
| event.data().GetString(&text);
|
| @@ -210,13 +210,16 @@
|
| ui::Range selected_range;
|
| model_->GetSelectedRange(&selected_range);
|
| // Adjust the drop destination if it is on or after the current selection.
|
| - if (selected_range.GetMax() <= drop_destination)
|
| - drop_destination -= selected_range.length();
|
| - else if (selected_range.GetMin() <= drop_destination)
|
| - drop_destination = selected_range.GetMin();
|
| - model_->DeleteSelectionAndInsertTextAt(text, drop_destination);
|
| + if (selected_range.GetMax() <= drop_destination.selection_end())
|
| + drop_destination.set_selection_end(
|
| + drop_destination.selection_end() - selected_range.length());
|
| + else if (selected_range.GetMin() <= drop_destination.selection_end())
|
| + drop_destination.set_selection_end(selected_range.GetMin());
|
| + model_->DeleteSelectionAndInsertTextAt(text,
|
| + drop_destination.selection_end());
|
| } else {
|
| - model_->MoveCursorTo(drop_destination, false);
|
| + drop_destination.SetSelectionEmpty();
|
| + model_->MoveCursorTo(&drop_destination);
|
| // Drop always inserts text even if the textfield is not in insert mode.
|
| model_->InsertText(text);
|
| }
|
| @@ -656,9 +659,7 @@
|
| }
|
|
|
| gfx::Rect NativeTextfieldViews::GetCaretBounds() {
|
| - gfx::RenderText* render_text = GetRenderText();
|
| - return render_text->GetCursorBounds(render_text->GetCursorPosition(),
|
| - render_text->insert_mode());
|
| + return GetRenderText()->CursorBounds();
|
| }
|
|
|
| bool NativeTextfieldViews::HasCompositionText() {
|
|
|