OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 1522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1533 | 1533 |
1534 handled = true; | 1534 handled = true; |
1535 } | 1535 } |
1536 | 1536 |
1537 if (supports_pre_edit_ && !handled && !pre_edit_.empty()) | 1537 if (supports_pre_edit_ && !handled && !pre_edit_.empty()) |
1538 handled = true; | 1538 handled = true; |
1539 | 1539 |
1540 if (!handled && gtk_widget_get_visible(instant_view_)) | 1540 if (!handled && gtk_widget_get_visible(instant_view_)) |
1541 handled = model()->CommitSuggestedText(true); | 1541 handled = model()->CommitSuggestedText(true); |
1542 | 1542 |
1543 if (!handled) | |
1544 handled = model()->AcceptCurrentInstantPreview(); | |
1545 | |
1546 if (handled) { | 1543 if (handled) { |
1547 static guint signal_id = g_signal_lookup("move-focus", GTK_TYPE_WIDGET); | 1544 static guint signal_id = g_signal_lookup("move-focus", GTK_TYPE_WIDGET); |
1548 g_signal_stop_emission(widget, signal_id, 0); | 1545 g_signal_stop_emission(widget, signal_id, 0); |
1549 } | 1546 } |
1550 } | 1547 } |
1551 | 1548 |
1552 void OmniboxViewGtk::HandleCopyClipboard(GtkWidget* sender) { | 1549 void OmniboxViewGtk::HandleCopyClipboard(GtkWidget* sender) { |
1553 HandleCopyOrCutClipboard(true); | 1550 HandleCopyOrCutClipboard(true); |
1554 } | 1551 } |
1555 | 1552 |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2144 void OmniboxViewGtk::AdjustVerticalAlignmentOfInstantView() { | 2141 void OmniboxViewGtk::AdjustVerticalAlignmentOfInstantView() { |
2145 // By default, GtkTextView layouts an anchored child widget just above the | 2142 // By default, GtkTextView layouts an anchored child widget just above the |
2146 // baseline, so we need to move the |instant_view_| down to make sure it | 2143 // baseline, so we need to move the |instant_view_| down to make sure it |
2147 // has the same baseline as the |text_view_|. | 2144 // has the same baseline as the |text_view_|. |
2148 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_)); | 2145 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_)); |
2149 int height; | 2146 int height; |
2150 pango_layout_get_size(layout, NULL, &height); | 2147 pango_layout_get_size(layout, NULL, &height); |
2151 int baseline = pango_layout_get_baseline(layout); | 2148 int baseline = pango_layout_get_baseline(layout); |
2152 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL); | 2149 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL); |
2153 } | 2150 } |
OLD | NEW |