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

Side by Side Diff: chrome/browser/ui/gtk/find_bar_gtk.cc

Issue 8800029: GTK: Add TRACE_EVENTs around gtk ui events. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fix nit Created 9 years 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
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/find_bar_gtk.h" 5 #include "chrome/browser/ui/gtk/find_bar_gtk.h"
6 6
7 #include <gdk/gdkkeysyms.h> 7 #include <gdk/gdkkeysyms.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/debug/trace_event.h"
13 #include "base/i18n/rtl.h" 14 #include "base/i18n/rtl.h"
14 #include "base/string_number_conversions.h" 15 #include "base/string_number_conversions.h"
15 #include "base/string_util.h" 16 #include "base/string_util.h"
16 #include "base/utf_string_conversions.h" 17 #include "base/utf_string_conversions.h"
17 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/ui/browser.h" 19 #include "chrome/browser/ui/browser.h"
19 #include "chrome/browser/ui/find_bar/find_bar_controller.h" 20 #include "chrome/browser/ui/find_bar/find_bar_controller.h"
20 #include "chrome/browser/ui/find_bar/find_bar_state.h" 21 #include "chrome/browser/ui/find_bar/find_bar_state.h"
21 #include "chrome/browser/ui/find_bar/find_notification_details.h" 22 #include "chrome/browser/ui/find_bar/find_notification_details.h"
22 #include "chrome/browser/ui/find_bar/find_tab_helper.h" 23 #include "chrome/browser/ui/find_bar/find_tab_helper.h"
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 FindEntryTextInContents(button == find_next_button_->widget()); 804 FindEntryTextInContents(button == find_next_button_->widget());
804 } else { 805 } else {
805 NOTREACHED(); 806 NOTREACHED();
806 } 807 }
807 } 808 }
808 809
809 // static 810 // static
810 gboolean FindBarGtk::OnContentEventBoxExpose(GtkWidget* widget, 811 gboolean FindBarGtk::OnContentEventBoxExpose(GtkWidget* widget,
811 GdkEventExpose* event, 812 GdkEventExpose* event,
812 FindBarGtk* bar) { 813 FindBarGtk* bar) {
814 TRACE_EVENT0("ui::gtk", "FindBarGtk::OnContentEventBoxExpose");
813 if (bar->theme_service_->UsingNativeTheme()) { 815 if (bar->theme_service_->UsingNativeTheme()) {
814 // Draw the text entry background around where we input stuff. Note the 816 // Draw the text entry background around where we input stuff. Note the
815 // decrement to |width|. We do this because some theme engines 817 // decrement to |width|. We do this because some theme engines
816 // (*cough*Clearlooks*cough*) don't do any blending and use thickness to 818 // (*cough*Clearlooks*cough*) don't do any blending and use thickness to
817 // make sure that widgets never overlap. 819 // make sure that widgets never overlap.
818 int padding = gtk_widget_get_style(widget)->xthickness; 820 int padding = gtk_widget_get_style(widget)->xthickness;
819 GdkRectangle rec; 821 GdkRectangle rec;
820 gtk_widget_get_allocation(widget, &rec); 822 gtk_widget_get_allocation(widget, &rec);
821 rec.width -= padding; 823 rec.width -= padding;
822 824
823 gtk_util::DrawTextEntryBackground(bar->text_entry_, widget, 825 gtk_util::DrawTextEntryBackground(bar->text_entry_, widget,
824 &event->area, &rec); 826 &event->area, &rec);
825 } 827 }
826 828
827 return FALSE; 829 return FALSE;
828 } 830 }
829 831
830 // Used to handle custom painting of |container_|. 832 // Used to handle custom painting of |container_|.
831 gboolean FindBarGtk::OnExpose(GtkWidget* widget, GdkEventExpose* e, 833 gboolean FindBarGtk::OnExpose(GtkWidget* widget, GdkEventExpose* e,
832 FindBarGtk* bar) { 834 FindBarGtk* bar) {
835 TRACE_EVENT0("ui::gtk", "FindBarGtk::OnExpose");
836
833 GtkAllocation allocation; 837 GtkAllocation allocation;
834 gtk_widget_get_allocation(widget, &allocation); 838 gtk_widget_get_allocation(widget, &allocation);
835 839
836 if (bar->theme_service_->UsingNativeTheme()) { 840 if (bar->theme_service_->UsingNativeTheme()) {
837 if (bar->container_width_ != allocation.width || 841 if (bar->container_width_ != allocation.width ||
838 bar->container_height_ != allocation.height) { 842 bar->container_height_ != allocation.height) {
839 std::vector<GdkPoint> mask_points = MakeFramePolygonPoints( 843 std::vector<GdkPoint> mask_points = MakeFramePolygonPoints(
840 allocation.width, allocation.height, FRAME_MASK); 844 allocation.width, allocation.height, FRAME_MASK);
841 GdkRegion* mask_region = gdk_region_polygon(&mask_points[0], 845 GdkRegion* mask_region = gdk_region_polygon(&mask_points[0],
842 mask_points.size(), 846 mask_points.size(),
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 return FALSE; // Continue propagation. 979 return FALSE; // Continue propagation.
976 } 980 }
977 981
978 gboolean FindBarGtk::OnFocusOut(GtkWidget* entry, GdkEventFocus* event) { 982 gboolean FindBarGtk::OnFocusOut(GtkWidget* entry, GdkEventFocus* event) {
979 g_signal_handlers_disconnect_by_func( 983 g_signal_handlers_disconnect_by_func(
980 gdk_keymap_get_for_display(gtk_widget_get_display(entry)), 984 gdk_keymap_get_for_display(gtk_widget_get_display(entry)),
981 reinterpret_cast<gpointer>(&OnKeymapDirectionChanged), this); 985 reinterpret_cast<gpointer>(&OnKeymapDirectionChanged), this);
982 986
983 return FALSE; // Continue propagation. 987 return FALSE; // Continue propagation.
984 } 988 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698