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

Side by Side Diff: chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc

Issue 7484035: Reapplies r91761. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h" 5 #include "chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h"
6 6
7 #include <gdk/gdkkeysyms.h> 7 #include <gdk/gdkkeysyms.h>
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after
1252 return FALSE; 1252 return FALSE;
1253 1253
1254 DCHECK(text_view_); 1254 DCHECK(text_view_);
1255 1255
1256 if (event->button == 1) { 1256 if (event->button == 1) {
1257 #if defined(OS_CHROMEOS) 1257 #if defined(OS_CHROMEOS)
1258 // When the first button is pressed, track some stuff that will help us 1258 // When the first button is pressed, track some stuff that will help us
1259 // determine whether we should select all of the text when the button is 1259 // determine whether we should select all of the text when the button is
1260 // released. 1260 // released.
1261 button_1_pressed_ = true; 1261 button_1_pressed_ = true;
1262 text_view_focused_before_button_press_ = GTK_WIDGET_HAS_FOCUS(text_view_); 1262 text_view_focused_before_button_press_ = gtk_widget_has_focus(text_view_);
1263 text_selected_during_click_ = false; 1263 text_selected_during_click_ = false;
1264 #endif 1264 #endif
1265 1265
1266 // Button press event may change the selection, we need to record the change 1266 // Button press event may change the selection, we need to record the change
1267 // and report it to |model_| later when button is released. 1267 // and report it to |model_| later when button is released.
1268 OnBeforePossibleChange(); 1268 OnBeforePossibleChange();
1269 } else if (event->button == 2) { 1269 } else if (event->button == 2) {
1270 // GtkTextView pastes PRIMARY selection with middle click. 1270 // GtkTextView pastes PRIMARY selection with middle click.
1271 // We can't call model_->on_paste_replacing_all() here, because the actual 1271 // We can't call model_->on_paste_replacing_all() here, because the actual
1272 // paste clipboard action may not be performed if the clipboard is empty. 1272 // paste clipboard action may not be performed if the clipboard is empty.
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
1693 1693
1694 // Trigger Tab to search behavior only when Tab key is pressed. 1694 // Trigger Tab to search behavior only when Tab key is pressed.
1695 if (model_->is_keyword_hint()) 1695 if (model_->is_keyword_hint())
1696 handled = model_->AcceptKeyword(); 1696 handled = model_->AcceptKeyword();
1697 1697
1698 #if GTK_CHECK_VERSION(2, 20, 0) 1698 #if GTK_CHECK_VERSION(2, 20, 0)
1699 if (!handled && !pre_edit_.empty()) 1699 if (!handled && !pre_edit_.empty())
1700 handled = true; 1700 handled = true;
1701 #endif 1701 #endif
1702 1702
1703 if (!handled && GTK_WIDGET_VISIBLE(instant_view_)) 1703 if (!handled && gtk_widget_get_visible(instant_view_))
1704 handled = model_->CommitSuggestedText(true); 1704 handled = model_->CommitSuggestedText(true);
1705 1705
1706 if (!handled) { 1706 if (!handled) {
1707 if (!IsCaretAtEnd()) { 1707 if (!IsCaretAtEnd()) {
1708 OnBeforePossibleChange(); 1708 OnBeforePossibleChange();
1709 PlaceCaretAt(GetTextLength()); 1709 PlaceCaretAt(GetTextLength());
1710 OnAfterPossibleChange(); 1710 OnAfterPossibleChange();
1711 handled = true; 1711 handled = true;
1712 } 1712 }
1713 } 1713 }
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
2334 // baseline, so we need to move the |instant_view_| down to make sure it 2334 // baseline, so we need to move the |instant_view_| down to make sure it
2335 // has the same baseline as the |text_view_|. 2335 // has the same baseline as the |text_view_|.
2336 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_)); 2336 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_));
2337 int height; 2337 int height;
2338 pango_layout_get_size(layout, NULL, &height); 2338 pango_layout_get_size(layout, NULL, &height);
2339 PangoLayoutIter* iter = pango_layout_get_iter(layout); 2339 PangoLayoutIter* iter = pango_layout_get_iter(layout);
2340 int baseline = pango_layout_iter_get_baseline(iter); 2340 int baseline = pango_layout_iter_get_baseline(iter);
2341 pango_layout_iter_free(iter); 2341 pango_layout_iter_free(iter);
2342 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL); 2342 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL);
2343 } 2343 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.cc ('k') | chrome/browser/ui/gtk/reload_button_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698