OLD | NEW |
---|---|
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/autocomplete/autocomplete_edit_view_gtk.h" | 5 #include "chrome/browser/autocomplete/autocomplete_edit_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 1665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1676 | 1676 |
1677 void AutocompleteEditViewGtk::HandleViewMoveFocus(GtkWidget* widget, | 1677 void AutocompleteEditViewGtk::HandleViewMoveFocus(GtkWidget* widget, |
1678 GtkDirectionType direction) { | 1678 GtkDirectionType direction) { |
1679 if (!tab_was_pressed_) | 1679 if (!tab_was_pressed_) |
1680 return; | 1680 return; |
1681 | 1681 |
1682 // If special behavior is triggered, then stop the signal emission to | 1682 // If special behavior is triggered, then stop the signal emission to |
1683 // prevent the focus from being moved. | 1683 // prevent the focus from being moved. |
1684 bool handled = false; | 1684 bool handled = false; |
1685 | 1685 |
1686 // Trigger Tab to search behavior only when Tab key is pressed. | 1686 // Trigger Tab to search behavior only when Tab key is pressed. |
Peter Kasting
2011/04/01 00:09:09
You need to rework this function in a similar way
| |
1687 if (model_->is_keyword_hint()) | 1687 if (model_->is_keyword_hint()) |
1688 handled = model_->AcceptKeyword(); | 1688 handled = model_->AcceptKeyword(true); |
1689 | 1689 |
1690 #if GTK_CHECK_VERSION(2, 20, 0) | 1690 #if GTK_CHECK_VERSION(2, 20, 0) |
1691 if (!handled && !preedit_.empty()) | 1691 if (!handled && !preedit_.empty()) |
1692 handled = true; | 1692 handled = true; |
1693 #endif | 1693 #endif |
1694 | 1694 |
1695 if (!handled && GTK_WIDGET_VISIBLE(instant_view_)) | 1695 if (!handled && GTK_WIDGET_VISIBLE(instant_view_)) |
1696 handled = model_->CommitSuggestedText(true); | 1696 handled = model_->CommitSuggestedText(true); |
1697 | 1697 |
1698 if (!handled) { | 1698 if (!handled) { |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2327 // baseline, so we need to move the |instant_view_| down to make sure it | 2327 // baseline, so we need to move the |instant_view_| down to make sure it |
2328 // has the same baseline as the |text_view_|. | 2328 // has the same baseline as the |text_view_|. |
2329 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_)); | 2329 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_)); |
2330 int height; | 2330 int height; |
2331 pango_layout_get_size(layout, NULL, &height); | 2331 pango_layout_get_size(layout, NULL, &height); |
2332 PangoLayoutIter* iter = pango_layout_get_iter(layout); | 2332 PangoLayoutIter* iter = pango_layout_get_iter(layout); |
2333 int baseline = pango_layout_iter_get_baseline(iter); | 2333 int baseline = pango_layout_iter_get_baseline(iter); |
2334 pango_layout_iter_free(iter); | 2334 pango_layout_iter_free(iter); |
2335 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL); | 2335 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL); |
2336 } | 2336 } |
OLD | NEW |