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 "content/browser/renderer_host/render_widget_host_view_gtk.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_gtk.h" |
6 | 6 |
7 // If this gets included after the gtk headers, then a bunch of compiler | 7 // If this gets included after the gtk headers, then a bunch of compiler |
8 // errors happen because of a "#define Status int" in Xlib.h, which interacts | 8 // errors happen because of a "#define Status int" in Xlib.h, which interacts |
9 // badly with net::URLRequestStatus::Status. | 9 // badly with net::URLRequestStatus::Status. |
10 #include "content/common/view_messages.h" | 10 #include "content/common/view_messages.h" |
11 | 11 |
12 #include <cairo/cairo.h> | 12 #include <cairo/cairo.h> |
13 #include <gdk/gdk.h> | 13 #include <gdk/gdk.h> |
14 #include <gdk/gdkkeysyms.h> | 14 #include <gdk/gdkkeysyms.h> |
15 #include <gdk/gdkx.h> | 15 #include <gdk/gdkx.h> |
16 #include <gtk/gtk.h> | 16 #include <gtk/gtk.h> |
17 | 17 |
18 #include <algorithm> | 18 #include <algorithm> |
19 #include <string> | 19 #include <string> |
20 | 20 |
21 #include "base/command_line.h" | 21 #include "base/command_line.h" |
| 22 #include "base/debug/trace_event.h" |
22 #include "base/logging.h" | 23 #include "base/logging.h" |
23 #include "base/message_loop.h" | 24 #include "base/message_loop.h" |
24 #include "base/metrics/histogram.h" | 25 #include "base/metrics/histogram.h" |
25 #include "base/string_number_conversions.h" | 26 #include "base/string_number_conversions.h" |
26 #include "base/time.h" | 27 #include "base/time.h" |
27 #include "base/utf_string_conversions.h" | 28 #include "base/utf_string_conversions.h" |
28 #include "content/browser/renderer_host/backing_store_gtk.h" | 29 #include "content/browser/renderer_host/backing_store_gtk.h" |
29 #include "content/browser/renderer_host/gtk_im_context_wrapper.h" | 30 #include "content/browser/renderer_host/gtk_im_context_wrapper.h" |
30 #include "content/browser/renderer_host/gtk_window_utils.h" | 31 #include "content/browser/renderer_host/gtk_window_utils.h" |
31 #include "content/browser/renderer_host/render_view_host.h" | 32 #include "content/browser/renderer_host/render_view_host.h" |
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 im_context_->UpdateInputMethodState(type, can_compose_inline); | 797 im_context_->UpdateInputMethodState(type, can_compose_inline); |
797 } | 798 } |
798 | 799 |
799 void RenderWidgetHostViewGtk::ImeCancelComposition() { | 800 void RenderWidgetHostViewGtk::ImeCancelComposition() { |
800 im_context_->CancelComposition(); | 801 im_context_->CancelComposition(); |
801 } | 802 } |
802 | 803 |
803 void RenderWidgetHostViewGtk::DidUpdateBackingStore( | 804 void RenderWidgetHostViewGtk::DidUpdateBackingStore( |
804 const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy, | 805 const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy, |
805 const std::vector<gfx::Rect>& copy_rects) { | 806 const std::vector<gfx::Rect>& copy_rects) { |
| 807 TRACE_EVENT0("ui::gtk", "RenderWidgetHostViewGtk::DidUpdateBackingStore"); |
| 808 |
806 if (is_hidden_) | 809 if (is_hidden_) |
807 return; | 810 return; |
808 | 811 |
809 // TODO(darin): Implement the equivalent of Win32's ScrollWindowEX. Can that | 812 // TODO(darin): Implement the equivalent of Win32's ScrollWindowEX. Can that |
810 // be done using XCopyArea? Perhaps similar to | 813 // be done using XCopyArea? Perhaps similar to |
811 // BackingStore::ScrollBackingStore? | 814 // BackingStore::ScrollBackingStore? |
812 if (about_to_validate_and_paint_) | 815 if (about_to_validate_and_paint_) |
813 invalid_rect_ = invalid_rect_.Union(scroll_rect); | 816 invalid_rect_ = invalid_rect_.Union(scroll_rect); |
814 else | 817 else |
815 Paint(scroll_rect); | 818 Paint(scroll_rect); |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1066 event->y += new_dragged_at_vertical_edge; | 1069 event->y += new_dragged_at_vertical_edge; |
1067 } else { | 1070 } else { |
1068 // Clear whenever we get a non-drag mouse move. | 1071 // Clear whenever we get a non-drag mouse move. |
1069 drag_monitor_size.SetSize(0, 0); | 1072 drag_monitor_size.SetSize(0, 0); |
1070 } | 1073 } |
1071 dragged_at_horizontal_edge_ = new_dragged_at_horizontal_edge; | 1074 dragged_at_horizontal_edge_ = new_dragged_at_horizontal_edge; |
1072 dragged_at_vertical_edge_ = new_dragged_at_vertical_edge; | 1075 dragged_at_vertical_edge_ = new_dragged_at_vertical_edge; |
1073 } | 1076 } |
1074 | 1077 |
1075 void RenderWidgetHostViewGtk::Paint(const gfx::Rect& damage_rect) { | 1078 void RenderWidgetHostViewGtk::Paint(const gfx::Rect& damage_rect) { |
| 1079 TRACE_EVENT0("ui::gtk", "RenderWidgetHostViewGtk::Paint"); |
| 1080 |
1076 // If the GPU process is rendering directly into the View, | 1081 // If the GPU process is rendering directly into the View, |
1077 // call the compositor directly. | 1082 // call the compositor directly. |
1078 RenderWidgetHost* render_widget_host = GetRenderWidgetHost(); | 1083 RenderWidgetHost* render_widget_host = GetRenderWidgetHost(); |
1079 if (render_widget_host->is_accelerated_compositing_active()) { | 1084 if (render_widget_host->is_accelerated_compositing_active()) { |
1080 host_->ScheduleComposite(); | 1085 host_->ScheduleComposite(); |
1081 return; | 1086 return; |
1082 } | 1087 } |
1083 | 1088 |
1084 GdkWindow* window = gtk_widget_get_window(view_.get()); | 1089 GdkWindow* window = gtk_widget_get_window(view_.get()); |
1085 DCHECK(!about_to_validate_and_paint_); | 1090 DCHECK(!about_to_validate_and_paint_); |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1358 } | 1363 } |
1359 } | 1364 } |
1360 | 1365 |
1361 // static | 1366 // static |
1362 void RenderWidgetHostView::GetDefaultScreenInfo( | 1367 void RenderWidgetHostView::GetDefaultScreenInfo( |
1363 WebKit::WebScreenInfo* results) { | 1368 WebKit::WebScreenInfo* results) { |
1364 GdkWindow* gdk_window = | 1369 GdkWindow* gdk_window = |
1365 gdk_display_get_default_group(gdk_display_get_default()); | 1370 gdk_display_get_default_group(gdk_display_get_default()); |
1366 content::GetScreenInfoFromNativeWindow(gdk_window, results); | 1371 content::GetScreenInfoFromNativeWindow(gdk_window, results); |
1367 } | 1372 } |
OLD | NEW |