| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include "ui/views/controls/textfield/textfield.h" | 5 #include "ui/views/controls/textfield/textfield.h" | 
| 6 | 6 | 
| 7 #include <string> | 7 #include <string> | 
| 8 | 8 | 
| 9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" | 
| 10 #include "ui/accessibility/ax_view_state.h" | 10 #include "ui/accessibility/ax_view_state.h" | 
| (...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1150 | 1150 | 
| 1151 void Textfield::GetSelectionEndPoints(ui::SelectionBound* anchor, | 1151 void Textfield::GetSelectionEndPoints(ui::SelectionBound* anchor, | 
| 1152                                       ui::SelectionBound* focus) { | 1152                                       ui::SelectionBound* focus) { | 
| 1153   gfx::RenderText* render_text = GetRenderText(); | 1153   gfx::RenderText* render_text = GetRenderText(); | 
| 1154   const gfx::SelectionModel& sel = render_text->selection_model(); | 1154   const gfx::SelectionModel& sel = render_text->selection_model(); | 
| 1155   gfx::SelectionModel start_sel = | 1155   gfx::SelectionModel start_sel = | 
| 1156       render_text->GetSelectionModelForSelectionStart(); | 1156       render_text->GetSelectionModelForSelectionStart(); | 
| 1157   gfx::Rect r1 = render_text->GetCursorBounds(start_sel, true); | 1157   gfx::Rect r1 = render_text->GetCursorBounds(start_sel, true); | 
| 1158   gfx::Rect r2 = render_text->GetCursorBounds(sel, true); | 1158   gfx::Rect r2 = render_text->GetCursorBounds(sel, true); | 
| 1159 | 1159 | 
| 1160   anchor->SetEdge(r1.origin(), r1.bottom_left()); | 1160   anchor->SetEdge(gfx::PointF(r1.origin()), gfx::PointF(r1.bottom_left())); | 
| 1161   focus->SetEdge(r2.origin(), r2.bottom_left()); | 1161   focus->SetEdge(gfx::PointF(r2.origin()), gfx::PointF(r2.bottom_left())); | 
| 1162 | 1162 | 
| 1163   // Determine the SelectionBound's type for focus and anchor. | 1163   // Determine the SelectionBound's type for focus and anchor. | 
| 1164   // TODO(mfomitchev): Ideally we should have different logical directions for | 1164   // TODO(mfomitchev): Ideally we should have different logical directions for | 
| 1165   // start and end to support proper handle direction for mixed LTR/RTL text. | 1165   // start and end to support proper handle direction for mixed LTR/RTL text. | 
| 1166   const bool ltr = GetTextDirection() != base::i18n::RIGHT_TO_LEFT; | 1166   const bool ltr = GetTextDirection() != base::i18n::RIGHT_TO_LEFT; | 
| 1167   size_t anchor_position_index = sel.selection().start(); | 1167   size_t anchor_position_index = sel.selection().start(); | 
| 1168   size_t focus_position_index = sel.selection().end(); | 1168   size_t focus_position_index = sel.selection().end(); | 
| 1169 | 1169 | 
| 1170   if (anchor_position_index == focus_position_index) { | 1170   if (anchor_position_index == focus_position_index) { | 
| 1171     anchor->set_type(ui::SelectionBound::CENTER); | 1171     anchor->set_type(ui::SelectionBound::CENTER); | 
| (...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1891     RequestFocus(); | 1891     RequestFocus(); | 
| 1892   model_->MoveCursorTo(mouse); | 1892   model_->MoveCursorTo(mouse); | 
| 1893   if (!selection_clipboard_text.empty()) { | 1893   if (!selection_clipboard_text.empty()) { | 
| 1894     model_->InsertText(selection_clipboard_text); | 1894     model_->InsertText(selection_clipboard_text); | 
| 1895     UpdateAfterChange(true, true); | 1895     UpdateAfterChange(true, true); | 
| 1896   } | 1896   } | 
| 1897   OnAfterUserAction(); | 1897   OnAfterUserAction(); | 
| 1898 } | 1898 } | 
| 1899 | 1899 | 
| 1900 }  // namespace views | 1900 }  // namespace views | 
| OLD | NEW | 
|---|