| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_MODEL_H_ | 5 #ifndef UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_MODEL_H_ |
| 6 #define UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_MODEL_H_ | 6 #define UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_MODEL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 | 198 |
| 199 // Deletes the selected text. This method shouldn't be called with | 199 // Deletes the selected text. This method shouldn't be called with |
| 200 // composition text. | 200 // composition text. |
| 201 void DeleteSelection(); | 201 void DeleteSelection(); |
| 202 | 202 |
| 203 // Deletes the selected text (if any) and insert text at given position. | 203 // Deletes the selected text (if any) and insert text at given position. |
| 204 void DeleteSelectionAndInsertTextAt(const base::string16& new_text, | 204 void DeleteSelectionAndInsertTextAt(const base::string16& new_text, |
| 205 size_t position); | 205 size_t position); |
| 206 | 206 |
| 207 // Retrieves the text content in a given range. | 207 // Retrieves the text content in a given range. |
| 208 base::string16 GetTextFromRange(const gfx::Range& range) const; | 208 base::string16 GetTextFromRange(const gfx::Range& range) const { |
| 209 return render_text_->GetTextFromRange(range); |
| 210 } |
| 209 | 211 |
| 210 // Retrieves the range containing all text in the model. | 212 // Retrieves the range containing all text in the model. |
| 211 void GetTextRange(gfx::Range* range) const; | 213 void GetTextRange(gfx::Range* range) const; |
| 212 | 214 |
| 213 // Sets composition text and attributes. If there is composition text already, | 215 // Sets composition text and attributes. If there is composition text already, |
| 214 // it'll be replaced by the new one. Otherwise, current selection will be | 216 // it'll be replaced by the new one. Otherwise, current selection will be |
| 215 // replaced. If there is no selection, the composition text will be inserted | 217 // replaced. If there is no selection, the composition text will be inserted |
| 216 // at the insertion point. | 218 // at the insertion point. |
| 217 // Any changes to the model except text insertion will confirm the current | 219 // Any changes to the model except text insertion will confirm the current |
| 218 // composition text. | 220 // composition text. |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 // 2) new edit is added. (redo history is cleared) | 312 // 2) new edit is added. (redo history is cleared) |
| 311 // 3) redone all undone edits. | 313 // 3) redone all undone edits. |
| 312 EditHistory::iterator current_edit_; | 314 EditHistory::iterator current_edit_; |
| 313 | 315 |
| 314 DISALLOW_COPY_AND_ASSIGN(TextfieldModel); | 316 DISALLOW_COPY_AND_ASSIGN(TextfieldModel); |
| 315 }; | 317 }; |
| 316 | 318 |
| 317 } // namespace views | 319 } // namespace views |
| 318 | 320 |
| 319 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_MODEL_H_ | 321 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_MODEL_H_ |
| OLD | NEW |