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

Unified Diff: views/controls/textfield/textfield_views_model.h

Issue 7067015: An edit for SetText needs to be merged with previous edit for omnibox. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 9 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: views/controls/textfield/textfield_views_model.h
diff --git a/views/controls/textfield/textfield_views_model.h b/views/controls/textfield/textfield_views_model.h
index de7e5204cb4f286f67f977c0e23cdbc05bb32ec5..2ee9ee4e8351e8d0d794d2f310186d08f08dc50d 100644
--- a/views/controls/textfield/textfield_views_model.h
+++ b/views/controls/textfield/textfield_views_model.h
@@ -34,6 +34,19 @@ class Edit;
struct TextStyleRange;
+// C++ doesn't allow forward decl enum, so let's define here.
+enum MergeType {
+ // The edit should not be merged with next edit. It still may
+ // be merged with an edit with MERGE_WITH_PREVIOUS.
+ DO_NOT_MERGE, // Never merge
msw 2011/06/02 21:02:57 nit: remove "never merge", the comment above is be
oshima 2011/06/03 00:39:24 Done.
+ // The edit can be merged with next edit when possible.
+ MERGEABLE,
+ // Does the edit has to be merged with previous edit?
msw 2011/06/02 21:02:57 *have* to be
oshima 2011/06/03 00:39:24 Done.
+ // This forces the merge even if the previous edit is marked
+ // as DO_NOT_MERGE.
+ MERGE_WITH_PREVIOUS,
+};
+
} // namespace internal
typedef std::vector<internal::TextStyleRange*> TextStyleRanges;
@@ -313,10 +326,13 @@ class TextfieldViewsModel {
// Executes and records edit operations.
void ExecuteAndRecordDelete(size_t from, size_t to, bool mergeable);
- void ExecuteAndRecordReplace(const string16& text, bool mergeable);
- void ExecuteAndRecordReplaceAt(const string16& text,
- size_t at,
- bool mergeable);
+ void ExecuteAndRecordReplaceSelection(internal::MergeType merge_type,
+ const string16& text);
+ void ExecuteAndRecordReplace(internal::MergeType merge_type,
+ size_t old_cursor_pos,
+ size_t new_cursor_pos,
+ const string16& text,
+ size_t new_text_start);
void ExecuteAndRecordInsert(const string16& text, bool mergeable);
// Adds or merge |edit| into edit history. Return true if the edit

Powered by Google App Engine
This is Rietveld 408576698