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/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 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 // Returns true if the |text_buffer_| is empty. | 581 // Returns true if the |text_buffer_| is empty. |
582 return gtk_text_iter_equal(&start, &sel_start) && | 582 return gtk_text_iter_equal(&start, &sel_start) && |
583 gtk_text_iter_equal(&end, &sel_end); | 583 gtk_text_iter_equal(&end, &sel_end); |
584 } | 584 } |
585 | 585 |
586 bool OmniboxViewGtk::DeleteAtEndPressed() { | 586 bool OmniboxViewGtk::DeleteAtEndPressed() { |
587 return delete_at_end_pressed_; | 587 return delete_at_end_pressed_; |
588 } | 588 } |
589 | 589 |
590 void OmniboxViewGtk::GetSelectionBounds(string16::size_type* start, | 590 void OmniboxViewGtk::GetSelectionBounds(string16::size_type* start, |
591 string16::size_type* end) { | 591 string16::size_type* end) const { |
592 CharRange selection = GetSelection(); | 592 CharRange selection = GetSelection(); |
593 *start = static_cast<size_t>(selection.cp_min); | 593 *start = static_cast<size_t>(selection.cp_min); |
594 *end = static_cast<size_t>(selection.cp_max); | 594 *end = static_cast<size_t>(selection.cp_max); |
595 } | 595 } |
596 | 596 |
597 void OmniboxViewGtk::SelectAll(bool reversed) { | 597 void OmniboxViewGtk::SelectAll(bool reversed) { |
598 // SelectAll() is invoked as a side effect of other actions (e.g. switching | 598 // SelectAll() is invoked as a side effect of other actions (e.g. switching |
599 // tabs or hitting Escape) in autocomplete_edit.cc, so we don't update the | 599 // tabs or hitting Escape) in autocomplete_edit.cc, so we don't update the |
600 // PRIMARY selection here. | 600 // PRIMARY selection here. |
601 SelectAllInternal(reversed, false); | 601 SelectAllInternal(reversed, false); |
(...skipping 1750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2352 // baseline, so we need to move the |instant_view_| down to make sure it | 2352 // baseline, so we need to move the |instant_view_| down to make sure it |
2353 // has the same baseline as the |text_view_|. | 2353 // has the same baseline as the |text_view_|. |
2354 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_)); | 2354 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_)); |
2355 int height; | 2355 int height; |
2356 pango_layout_get_size(layout, NULL, &height); | 2356 pango_layout_get_size(layout, NULL, &height); |
2357 PangoLayoutIter* iter = pango_layout_get_iter(layout); | 2357 PangoLayoutIter* iter = pango_layout_get_iter(layout); |
2358 int baseline = pango_layout_iter_get_baseline(iter); | 2358 int baseline = pango_layout_iter_get_baseline(iter); |
2359 pango_layout_iter_free(iter); | 2359 pango_layout_iter_free(iter); |
2360 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL); | 2360 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL); |
2361 } | 2361 } |
OLD | NEW |