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