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

Unified Diff: chrome/browser/autocomplete/autocomplete_edit_view_gtk.h

Issue 4202005: [Linux] Improve preedit string and Instant suggestion support in omnibox. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update according to review comment. Created 10 years, 1 month 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: chrome/browser/autocomplete/autocomplete_edit_view_gtk.h
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h
index 34dd01c51985198db75e00ff1702823371860daa..07e0ed3866325905e02603e8220f1e6980c3f870 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h
@@ -174,6 +174,12 @@ class AutocompleteEditViewGtk : public AutocompleteEditView,
GtkTextBuffer*, GtkTextIter*, const gchar*, gint);
CHROMEG_CALLBACK_0(AutocompleteEditViewGtk, void,
HandleKeymapDirectionChanged, GdkKeymap*);
+ CHROMEG_CALLBACK_2(AutocompleteEditViewGtk, void, HandleDeleteRange,
+ GtkTextBuffer*, GtkTextIter*, GtkTextIter*);
+ // Unlike above HandleMarkSet and HandleMarkSetAfter, this handler will always
+ // be connected to the signal.
+ CHROMEG_CALLBACK_2(AutocompleteEditViewGtk, void, HandleMarkSetAlways,
+ GtkTextBuffer*, GtkTextIter*, GtkTextMark*);
CHROMEGTK_CALLBACK_1(AutocompleteEditViewGtk, gboolean, HandleKeyPress,
GdkEventKey*);
@@ -214,12 +220,16 @@ class AutocompleteEditViewGtk : public AutocompleteEditView,
// listen to focus change events on it.
CHROMEGTK_CALLBACK_1(AutocompleteEditViewGtk, void, HandleHierarchyChanged,
GtkWidget*);
- CHROMEGTK_CALLBACK_1(AutocompleteEditViewGtk, gboolean,
- HandleInstantViewButtonPress, GdkEventButton*);
-#if GTK_CHECK_VERSION(2,20,0)
+#if GTK_CHECK_VERSION(2, 20, 0)
CHROMEGTK_CALLBACK_1(AutocompleteEditViewGtk, void, HandlePreeditChanged,
const gchar*);
#endif
+ // Undo/redo operations won't trigger "begin-user-action" and
+ // "end-user-action" signals, so we need to hook into "undo" and "redo"
+ // signals and call OnBeforePossibleChange()/OnAfterPossibleChange() by
+ // ourselves.
+ CHROMEGTK_CALLBACK_0(AutocompleteEditViewGtk, void, HandleUndoRedo);
+ CHROMEGTK_CALLBACK_0(AutocompleteEditViewGtk, void, HandleUndoRedoAfter);
CHROMEG_CALLBACK_1(AutocompleteEditViewGtk, void, HandleWindowSetFocus,
GtkWindow*, GtkWidget*);
@@ -269,10 +279,7 @@ class AutocompleteEditViewGtk : public AutocompleteEditView,
GtkTextIter* iter_max);
// Return the number of characers in the current buffer.
- int GetTextLength();
-
- // Get the string contents for the given buffer.
- std::wstring GetTextFromBuffer(GtkTextBuffer* buffer) const;
+ int GetTextLength() const;
// Try to parse the current text as a URL and colorize the components.
void EmphasizeURLComponents();
@@ -306,6 +313,18 @@ class AutocompleteEditViewGtk : public AutocompleteEditView,
// If the selected text parses as a URL OwnPrimarySelection is invoked.
void UpdatePrimarySelectionIfValidURL();
+ // Retrieves the first and last iterators in the |text_buffer_|, but excludes
+ // the anchor holding the |instant_view_| widget.
+ void GetTextBufferBounds(GtkTextIter* start, GtkTextIter* end) const;
+
+ // Validates an iterator in the |text_buffer_|, to make sure it doesn't go
+ // beyond the anchor for holding the |instant_view_| widget.
+ void ValidateTextBufferIter(GtkTextIter* iter) const;
+
+ // Adjusts vertical alignment of the |instant_view_| in the |text_view_|, to
+ // make sure they have the same baseline.
+ void AdjustVerticalAlignmentOfInstantView();
+
// The widget we expose, used for vertically centering the real text edit,
// since the height will change based on the font / font size, etc.
OwnedWidgetGtk alignment_;
@@ -321,9 +340,16 @@ class AutocompleteEditViewGtk : public AutocompleteEditView,
GtkTextTag* normal_text_tag_;
// Objects for the instant suggestion text view.
+ GtkTextTag* instant_anchor_tag_;
+
+ // A widget for displaying instant suggestion text. It'll be attached to a
+ // child anchor in the |text_buffer_| object.
GtkWidget* instant_view_;
- GtkTextBuffer* instant_buffer_;
- GtkTextTag* instant_text_tag_;
+
+ // A mark to split the content and the instant anchor. Wherever the end
+ // iterator of the text buffer is required, the iterator to this mark should
+ // be used.
+ GtkTextMark* instant_mark_;
scoped_ptr<AutocompleteEditModel> model_;
scoped_ptr<AutocompletePopupView> popup_view_;
@@ -434,7 +460,7 @@ class AutocompleteEditViewGtk : public AutocompleteEditView,
// is not suggested text, that means the user manually made the selection.
bool selection_suggested_;
-#if GTK_CHECK_VERSION(2,20,0)
+#if GTK_CHECK_VERSION(2, 20, 0)
// Stores the text being composed by the input method.
std::wstring preedit_;
#endif

Powered by Google App Engine
This is Rietveld 408576698