| Index: ui/views/controls/textfield/textfield_views_model.h
|
| diff --git a/ui/views/controls/textfield/textfield_views_model.h b/ui/views/controls/textfield/textfield_views_model.h
|
| index bc1de8857529a59ccd7b62b62e15259fc311bb68..ab5d0c89f6be7e94340b95ca7cd9f2b59b4c12a1 100644
|
| --- a/ui/views/controls/textfield/textfield_views_model.h
|
| +++ b/ui/views/controls/textfield/textfield_views_model.h
|
| @@ -64,21 +64,20 @@ class VIEWS_EXPORT TextfieldViewsModel {
|
|
|
| // Edit related methods.
|
|
|
| - const base::string16& GetText() const;
|
| - // Sets the text. Returns true if the text has been modified. The
|
| - // current composition text will be confirmed first. Setting
|
| - // the same text will not add edit history because it's not user
|
| - // visible change nor user-initiated change. This allow a client
|
| - // code to set the same text multiple times without worrying about
|
| - // messing edit history.
|
| - bool SetText(const base::string16& text);
|
| + const base::string16& text() const { return render_text_->text(); }
|
| + // Sets the text. Returns true if the text has been modified. The current
|
| + // composition text will be confirmed first. Setting the same text will not
|
| + // add edit history because it's not user visible change nor user-initiated
|
| + // change. This allow a client code to set the same text multiple times
|
| + // without worrying about messing edit history.
|
| + bool SetText(const base::string16& new_text);
|
|
|
| gfx::RenderText* render_text() { return render_text_.get(); }
|
|
|
| - // Inserts given |text| at the current cursor position.
|
| + // Inserts given |new_text| at the current cursor position.
|
| // The current composition text will be cleared.
|
| - void InsertText(const base::string16& text) {
|
| - InsertTextInternal(text, false);
|
| + void InsertText(const base::string16& new_text) {
|
| + InsertTextInternal(new_text, false);
|
| }
|
|
|
| // Inserts a character at the current cursor position.
|
| @@ -88,8 +87,8 @@ class VIEWS_EXPORT TextfieldViewsModel {
|
|
|
| // Replaces characters at the current position with characters in given text.
|
| // The current composition text will be cleared.
|
| - void ReplaceText(const base::string16& text) {
|
| - ReplaceTextInternal(text, false);
|
| + void ReplaceText(const base::string16& new_text) {
|
| + ReplaceTextInternal(new_text, false);
|
| }
|
|
|
| // Replaces the char at the current position with given character.
|
| @@ -99,7 +98,7 @@ class VIEWS_EXPORT TextfieldViewsModel {
|
|
|
| // Appends the text.
|
| // The current composition text will be confirmed.
|
| - void Append(const base::string16& text);
|
| + void Append(const base::string16& new_text);
|
|
|
| // Deletes the first character after the current cursor position (as if, the
|
| // the user has pressed delete key in the textfield). Returns true if
|
| @@ -195,10 +194,9 @@ class VIEWS_EXPORT TextfieldViewsModel {
|
| // composition text.
|
| void DeleteSelection();
|
|
|
| - // Deletes the selected text (if any) and insert text at given
|
| - // position.
|
| - void DeleteSelectionAndInsertTextAt(
|
| - const base::string16& text, size_t position);
|
| + // Deletes the selected text (if any) and insert text at given position.
|
| + void DeleteSelectionAndInsertTextAt(const base::string16& new_text,
|
| + size_t position);
|
|
|
| // Retrieves the text content in a given range.
|
| base::string16 GetTextFromRange(const gfx::Range& range) const;
|
| @@ -226,9 +224,10 @@ class VIEWS_EXPORT TextfieldViewsModel {
|
| // Returns true if there is composition text.
|
| bool HasCompositionText() const;
|
|
|
| + // Clears all edit history.
|
| + void ClearEditHistory();
|
| +
|
| private:
|
| - friend class NativeTextfieldViews;
|
| - friend class NativeTextfieldViewsTest;
|
| friend class TextfieldViewsModelTest;
|
| friend class UndoRedo_BasicTest;
|
| friend class UndoRedo_CutCopyPasteTest;
|
| @@ -239,17 +238,14 @@ class VIEWS_EXPORT TextfieldViewsModel {
|
| FRIEND_TEST_ALL_PREFIXES(TextfieldViewsModelTest, UndoRedo_CutCopyPasteTest);
|
| FRIEND_TEST_ALL_PREFIXES(TextfieldViewsModelTest, UndoRedo_ReplaceTest);
|
|
|
| - // Insert the given |text|. |mergeable| indicates if this insert
|
| + // Insert the given |new_text|. |mergeable| indicates if this insert
|
| // operation can be merged to previous edit in the edit history.
|
| - void InsertTextInternal(const base::string16& text, bool mergeable);
|
| + void InsertTextInternal(const base::string16& new_text, bool mergeable);
|
|
|
| - // Replace the current text with the given |text|. |mergeable|
|
| + // Replace the current text with the given |new_text|. |mergeable|
|
| // indicates if this replace operation can be merged to previous
|
| // edit in the edit history.
|
| - void ReplaceTextInternal(const base::string16& text, bool mergeable);
|
| -
|
| - // Clears all edit history.
|
| - void ClearEditHistory();
|
| + void ReplaceTextInternal(const base::string16& new_text, bool mergeable);
|
|
|
| // Clears redo history.
|
| void ClearRedoHistory();
|
| @@ -257,13 +253,13 @@ class VIEWS_EXPORT TextfieldViewsModel {
|
| // Executes and records edit operations.
|
| void ExecuteAndRecordDelete(gfx::Range range, bool mergeable);
|
| void ExecuteAndRecordReplaceSelection(internal::MergeType merge_type,
|
| - const base::string16& text);
|
| + const base::string16& new_text);
|
| void ExecuteAndRecordReplace(internal::MergeType merge_type,
|
| size_t old_cursor_pos,
|
| size_t new_cursor_pos,
|
| - const base::string16& text,
|
| + const base::string16& new_text,
|
| size_t new_text_start);
|
| - void ExecuteAndRecordInsert(const base::string16& text, bool mergeable);
|
| + void ExecuteAndRecordInsert(const base::string16& new_text, bool mergeable);
|
|
|
| // Adds or merge |edit| into edit history. Return true if the edit
|
| // has been merged and must be deleted after redo.
|
|
|