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

Side by Side Diff: ui/views/controls/textfield/textfield_views_model.h

Issue 9390022: Simplify handling of BiDi cursor movement (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make set_selection_start private, fix accidental inclusion of local hacks Created 8 years, 10 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 | Annotate | Revision Log
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 #ifndef UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_ 5 #ifndef UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_
6 #define UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_ 6 #define UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_
7 #pragma once 7 #pragma once
8 8
9 #include <list> 9 #include <list>
10 #include <vector> 10 #include <vector>
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 bool MoveCursorTo(const gfx::SelectionModel& selection); 134 bool MoveCursorTo(const gfx::SelectionModel& selection);
135 135
136 // Helper function to call MoveCursorTo on the TextfieldViewsModel. 136 // Helper function to call MoveCursorTo on the TextfieldViewsModel.
137 bool MoveCursorTo(const gfx::Point& point, bool select); 137 bool MoveCursorTo(const gfx::Point& point, bool select);
138 138
139 // Selection related method 139 // Selection related method
140 140
141 // Returns the selected text. 141 // Returns the selected text.
142 string16 GetSelectedText() const; 142 string16 GetSelectedText() const;
143 143
144 // Gets the selected range.
145 void GetSelectedRange(ui::Range* range) const;
146
147 // The current composition text will be confirmed. The selection starts with 144 // The current composition text will be confirmed. The selection starts with
148 // the range's start position, and ends with the range's end position, 145 // the range's start position, and ends with the range's end position,
149 // therefore the cursor position becomes the end position. 146 // therefore the cursor position becomes the end position.
150 void SelectRange(const ui::Range& range); 147 void SelectRange(const ui::Range& range);
151 148
152 void GetSelectionModel(gfx::SelectionModel* sel) const; 149 void GetSelectionModel(gfx::SelectionModel* sel) const;
153 150
154 // The current composition text will be confirmed. 151 // The current composition text will be confirmed.
155 // render_text_'s selection model is set to |sel|. 152 // render_text_'s selection model is set to |sel|.
156 void SelectSelectionModel(const gfx::SelectionModel& sel); 153 void SelectSelectionModel(const gfx::SelectionModel& sel);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 // edit in the edit history. 249 // edit in the edit history.
253 void ReplaceTextInternal(const string16& text, bool mergeable); 250 void ReplaceTextInternal(const string16& text, bool mergeable);
254 251
255 // Clears all edit history. 252 // Clears all edit history.
256 void ClearEditHistory(); 253 void ClearEditHistory();
257 254
258 // Clears redo history. 255 // Clears redo history.
259 void ClearRedoHistory(); 256 void ClearRedoHistory();
260 257
261 // Executes and records edit operations. 258 // Executes and records edit operations.
262 void ExecuteAndRecordDelete(size_t from, size_t to, bool mergeable); 259 void ExecuteAndRecordDelete(ui::Range range, bool mergeable);
263 void ExecuteAndRecordReplaceSelection(internal::MergeType merge_type, 260 void ExecuteAndRecordReplaceSelection(internal::MergeType merge_type,
264 const string16& text); 261 const string16& text);
265 void ExecuteAndRecordReplace(internal::MergeType merge_type, 262 void ExecuteAndRecordReplace(internal::MergeType merge_type,
266 size_t old_cursor_pos, 263 size_t old_cursor_pos,
267 size_t new_cursor_pos, 264 size_t new_cursor_pos,
268 const string16& text, 265 const string16& text,
269 size_t new_text_start); 266 size_t new_text_start);
270 void ExecuteAndRecordInsert(const string16& text, bool mergeable); 267 void ExecuteAndRecordInsert(const string16& text, bool mergeable);
271 268
272 // Adds or merge |edit| into edit history. Return true if the edit 269 // Adds or merge |edit| into edit history. Return true if the edit
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 // 2) new edit is added. (redo history is cleared) 305 // 2) new edit is added. (redo history is cleared)
309 // 3) redone all undone edits. 306 // 3) redone all undone edits.
310 EditHistory::iterator current_edit_; 307 EditHistory::iterator current_edit_;
311 308
312 DISALLOW_COPY_AND_ASSIGN(TextfieldViewsModel); 309 DISALLOW_COPY_AND_ASSIGN(TextfieldViewsModel);
313 }; 310 };
314 311
315 } // namespace views 312 } // namespace views
316 313
317 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_ 314 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698