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 <list> | 8 #include <list> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 size_t new_cursor_pos); | 260 size_t new_cursor_pos); |
261 | 261 |
262 void ClearComposition(); | 262 void ClearComposition(); |
263 | 263 |
264 // The TextfieldModel::Delegate instance should be provided by the owner. | 264 // The TextfieldModel::Delegate instance should be provided by the owner. |
265 Delegate* delegate_; | 265 Delegate* delegate_; |
266 | 266 |
267 // The stylized text, cursor, selection, and the visual layout model. | 267 // The stylized text, cursor, selection, and the visual layout model. |
268 scoped_ptr<gfx::RenderText> render_text_; | 268 scoped_ptr<gfx::RenderText> render_text_; |
269 | 269 |
| 270 // The composition range. |
| 271 gfx::Range composition_range_; |
| 272 |
270 typedef std::list<internal::Edit*> EditHistory; | 273 typedef std::list<internal::Edit*> EditHistory; |
271 EditHistory edit_history_; | 274 EditHistory edit_history_; |
272 | 275 |
273 // An iterator that points to the current edit that can be undone. | 276 // An iterator that points to the current edit that can be undone. |
274 // This iterator moves from the |end()|, meaining no edit to undo, | 277 // This iterator moves from the |end()|, meaining no edit to undo, |
275 // to the last element (one before |end()|), meaning no edit to redo. | 278 // to the last element (one before |end()|), meaning no edit to redo. |
276 // | 279 // |
277 // There is no edit to undo (== end()) when: | 280 // There is no edit to undo (== end()) when: |
278 // 1) in initial state. (nothing to undo) | 281 // 1) in initial state. (nothing to undo) |
279 // 2) very 1st edit is undone. | 282 // 2) very 1st edit is undone. |
280 // 3) all edit history is removed. | 283 // 3) all edit history is removed. |
281 // There is no edit to redo (== last element or no element) when: | 284 // There is no edit to redo (== last element or no element) when: |
282 // 1) in initial state. (nothing to redo) | 285 // 1) in initial state. (nothing to redo) |
283 // 2) new edit is added. (redo history is cleared) | 286 // 2) new edit is added. (redo history is cleared) |
284 // 3) redone all undone edits. | 287 // 3) redone all undone edits. |
285 EditHistory::iterator current_edit_; | 288 EditHistory::iterator current_edit_; |
286 | 289 |
287 DISALLOW_COPY_AND_ASSIGN(TextfieldModel); | 290 DISALLOW_COPY_AND_ASSIGN(TextfieldModel); |
288 }; | 291 }; |
289 | 292 |
290 } // namespace views | 293 } // namespace views |
291 | 294 |
292 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_MODEL_H_ | 295 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_MODEL_H_ |
OLD | NEW |