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

Side by Side Diff: ui/views/controls/textfield/textfield.cc

Issue 1372253002: gfx: Make conversions from gfx::Point to PointF explicit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pointfconvert-gfx: . Created 5 years, 2 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 unified diff | Download patch
OLDNEW
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 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1146 void Textfield::MoveCaretTo(const gfx::Point& point) { 1146 void Textfield::MoveCaretTo(const gfx::Point& point) {
1147 SelectRect(point, point); 1147 SelectRect(point, point);
1148 } 1148 }
1149 1149
1150 void Textfield::GetSelectionEndPoints(ui::SelectionBound* anchor, 1150 void Textfield::GetSelectionEndPoints(ui::SelectionBound* anchor,
1151 ui::SelectionBound* focus) { 1151 ui::SelectionBound* focus) {
1152 gfx::RenderText* render_text = GetRenderText(); 1152 gfx::RenderText* render_text = GetRenderText();
1153 const gfx::SelectionModel& sel = render_text->selection_model(); 1153 const gfx::SelectionModel& sel = render_text->selection_model();
1154 gfx::SelectionModel start_sel = 1154 gfx::SelectionModel start_sel =
1155 render_text->GetSelectionModelForSelectionStart(); 1155 render_text->GetSelectionModelForSelectionStart();
1156 gfx::Rect r1 = render_text->GetCursorBounds(start_sel, true); 1156 auto r1 = gfx::RectF(render_text->GetCursorBounds(start_sel, true));
1157 gfx::Rect r2 = render_text->GetCursorBounds(sel, true); 1157 auto r2 = gfx::RectF(render_text->GetCursorBounds(sel, true));
1158 1158
1159 anchor->SetEdge(r1.origin(), r1.bottom_left()); 1159 anchor->SetEdge(r1.origin(), r1.bottom_left());
1160 focus->SetEdge(r2.origin(), r2.bottom_left()); 1160 focus->SetEdge(r2.origin(), r2.bottom_left());
1161 1161
1162 // Determine the SelectionBound's type for focus and anchor. 1162 // Determine the SelectionBound's type for focus and anchor.
1163 // TODO(mfomitchev): Ideally we should have different logical directions for 1163 // TODO(mfomitchev): Ideally we should have different logical directions for
1164 // start and end to support proper handle direction for mixed LTR/RTL text. 1164 // start and end to support proper handle direction for mixed LTR/RTL text.
1165 const bool ltr = GetTextDirection() != base::i18n::RIGHT_TO_LEFT; 1165 const bool ltr = GetTextDirection() != base::i18n::RIGHT_TO_LEFT;
1166 size_t anchor_position_index = sel.selection().start(); 1166 size_t anchor_position_index = sel.selection().start();
1167 size_t focus_position_index = sel.selection().end(); 1167 size_t focus_position_index = sel.selection().end();
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
1889 RequestFocus(); 1889 RequestFocus();
1890 model_->MoveCursorTo(mouse); 1890 model_->MoveCursorTo(mouse);
1891 if (!selection_clipboard_text.empty()) { 1891 if (!selection_clipboard_text.empty()) {
1892 model_->InsertText(selection_clipboard_text); 1892 model_->InsertText(selection_clipboard_text);
1893 UpdateAfterChange(true, true); 1893 UpdateAfterChange(true, true);
1894 } 1894 }
1895 OnAfterUserAction(); 1895 OnAfterUserAction();
1896 } 1896 }
1897 1897
1898 } // namespace views 1898 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698