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

Unified Diff: chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc

Issue 9419043: Revert 122412 - Enabled pressing TAB to traverse through the Omnibox results (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 10 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
« no previous file with comments | « chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h ('k') | chrome/browser/ui/omnibox/omnibox_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc
===================================================================
--- chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc (revision 122471)
+++ chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc (working copy)
@@ -555,22 +555,16 @@
bool update_popup) {
model_->SetUserText(text);
// TODO(deanm): something about selection / focus change here.
- SetWindowTextAndCaretPos(display_text, display_text.length(), update_popup,
- true);
+ SetWindowTextAndCaretPos(display_text, display_text.length());
+ if (update_popup)
+ UpdatePopup();
+ TextChanged();
}
void OmniboxViewGtk::SetWindowTextAndCaretPos(const string16& text,
- size_t caret_pos,
- bool update_popup,
- bool notify_text_changed) {
+ size_t caret_pos) {
CharRange range(static_cast<int>(caret_pos), static_cast<int>(caret_pos));
SetTextAndSelectedRange(text, range);
-
- if (update_popup)
- UpdatePopup();
-
- if (notify_text_changed)
- TextChanged();
}
void OmniboxViewGtk::SetForcedQuery() {
@@ -645,7 +639,7 @@
saved_temporary_selection_ = GetSelection();
StartUpdatingHighlightedText();
- SetWindowTextAndCaretPos(display_text, display_text.length(), false, false);
+ SetWindowTextAndCaretPos(display_text, display_text.length());
FinishUpdatingHighlightedText();
TextChanged();
}
@@ -1084,8 +1078,7 @@
// if IME did not handle it then "move-focus" signal will be emitted by the
// default signal handler of |text_view_|. So we can intercept "move-focus"
// signal of |text_view_| to know if a Tab key press event was handled by IME,
- // and trigger Tab to search or result traversal behavior when necessary in
- // the signal handler.
+ // and trigger Tab to search behavior when necessary in the signal handler.
//
// But for Enter key, if IME did not handle the key event, the default signal
// handler will delete current selection range and insert '\n' and always
@@ -1127,10 +1120,8 @@
tab_was_pressed_ = (event->keyval == GDK_Tab ||
event->keyval == GDK_ISO_Left_Tab ||
event->keyval == GDK_KP_Tab) &&
- !(event->state & GDK_CONTROL_MASK);
+ !(event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK));
- shift_was_pressed_ = event->state & GDK_SHIFT_MASK;
-
delete_was_pressed_ = event->keyval == GDK_Delete ||
event->keyval == GDK_KP_Delete;
@@ -1727,25 +1718,24 @@
bool handled = false;
// Trigger Tab to search behavior only when Tab key is pressed.
- if (model_->is_keyword_hint() && !shift_was_pressed_) {
+ if (model_->is_keyword_hint())
handled = model_->AcceptKeyword();
- } else if (model_->popup_model()->IsOpen()) {
- if (shift_was_pressed_ &&
- model_->popup_model()->selected_line_state() ==
- AutocompletePopupModel::KEYWORD)
- model_->ClearKeyword(GetText());
- else
- model_->OnUpOrDownKeyPressed(shift_was_pressed_ ? -1 : 1);
- handled = true;
- }
-
if (supports_pre_edit_ && !handled && !pre_edit_.empty())
handled = true;
if (!handled && gtk_widget_get_visible(instant_view_))
handled = model_->CommitSuggestedText(true);
+ if (!handled) {
+ if (!IsCaretAtEnd()) {
+ OnBeforePossibleChange();
+ PlaceCaretAt(GetTextLength());
+ OnAfterPossibleChange();
+ handled = true;
+ }
+ }
+
if (!handled)
handled = model_->AcceptCurrentInstantPreview();
« no previous file with comments | « chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h ('k') | chrome/browser/ui/omnibox/omnibox_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698