Chromium Code Reviews| 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 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1147 void Textfield::MoveCaretTo(const gfx::Point& point) { | 1147 void Textfield::MoveCaretTo(const gfx::Point& point) { |
| 1148 SelectRect(point, point); | 1148 SelectRect(point, point); |
| 1149 } | 1149 } |
| 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::RectF r1(render_text->GetCursorBounds(start_sel, true)); |
|
danakj
2015/10/23 21:46:10
This one is about SelectionBounds, which are float
| |
| 1158 gfx::Rect r2 = render_text->GetCursorBounds(sel, true); | 1158 gfx::RectF r2(render_text->GetCursorBounds(sel, true)); |
| 1159 | 1159 |
| 1160 anchor->SetEdge(r1.origin(), r1.bottom_left()); | 1160 anchor->SetEdge(r1.origin(), r1.bottom_left()); |
| 1161 focus->SetEdge(r2.origin(), r2.bottom_left()); | 1161 focus->SetEdge(r2.origin(), 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(); |
| (...skipping 722 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 |