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 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 im_context_->UpdateInputMethodState(type, can_compose_inline); | 798 im_context_->UpdateInputMethodState(type, can_compose_inline); |
798 } | 799 } |
799 | 800 |
800 void RenderWidgetHostViewGtk::ImeCancelComposition() { | 801 void RenderWidgetHostViewGtk::ImeCancelComposition() { |
801 im_context_->CancelComposition(); | 802 im_context_->CancelComposition(); |
802 } | 803 } |
803 | 804 |
804 void RenderWidgetHostViewGtk::DidUpdateBackingStore( | 805 void RenderWidgetHostViewGtk::DidUpdateBackingStore( |
805 const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy, | 806 const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy, |
806 const std::vector<gfx::Rect>& copy_rects) { | 807 const std::vector<gfx::Rect>& copy_rects) { |
| 808 TRACE_EVENT0("ui::gtk", "RenderWidgetHostViewGtk::DidUpdateBackingStore"); |
| 809 |
807 if (is_hidden_) | 810 if (is_hidden_) |
808 return; | 811 return; |
809 | 812 |
810 // TODO(darin): Implement the equivalent of Win32's ScrollWindowEX. Can that | 813 // TODO(darin): Implement the equivalent of Win32's ScrollWindowEX. Can that |
811 // be done using XCopyArea? Perhaps similar to | 814 // be done using XCopyArea? Perhaps similar to |
812 // BackingStore::ScrollBackingStore? | 815 // BackingStore::ScrollBackingStore? |
813 if (about_to_validate_and_paint_) | 816 if (about_to_validate_and_paint_) |
814 invalid_rect_ = invalid_rect_.Union(scroll_rect); | 817 invalid_rect_ = invalid_rect_.Union(scroll_rect); |
815 else | 818 else |
816 Paint(scroll_rect); | 819 Paint(scroll_rect); |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1067 event->y += new_dragged_at_vertical_edge; | 1070 event->y += new_dragged_at_vertical_edge; |
1068 } else { | 1071 } else { |
1069 // Clear whenever we get a non-drag mouse move. | 1072 // Clear whenever we get a non-drag mouse move. |
1070 drag_monitor_size.SetSize(0, 0); | 1073 drag_monitor_size.SetSize(0, 0); |
1071 } | 1074 } |
1072 dragged_at_horizontal_edge_ = new_dragged_at_horizontal_edge; | 1075 dragged_at_horizontal_edge_ = new_dragged_at_horizontal_edge; |
1073 dragged_at_vertical_edge_ = new_dragged_at_vertical_edge; | 1076 dragged_at_vertical_edge_ = new_dragged_at_vertical_edge; |
1074 } | 1077 } |
1075 | 1078 |
1076 void RenderWidgetHostViewGtk::Paint(const gfx::Rect& damage_rect) { | 1079 void RenderWidgetHostViewGtk::Paint(const gfx::Rect& damage_rect) { |
| 1080 TRACE_EVENT0("ui::gtk", "RenderWidgetHostViewGtk::Paint"); |
| 1081 |
1077 // If the GPU process is rendering directly into the View, | 1082 // If the GPU process is rendering directly into the View, |
1078 // call the compositor directly. | 1083 // call the compositor directly. |
1079 RenderWidgetHost* render_widget_host = GetRenderWidgetHost(); | 1084 RenderWidgetHost* render_widget_host = GetRenderWidgetHost(); |
1080 if (render_widget_host->is_accelerated_compositing_active()) { | 1085 if (render_widget_host->is_accelerated_compositing_active()) { |
1081 host_->ScheduleComposite(); | 1086 host_->ScheduleComposite(); |
1082 return; | 1087 return; |
1083 } | 1088 } |
1084 | 1089 |
1085 GdkWindow* window = gtk_widget_get_window(view_.get()); | 1090 GdkWindow* window = gtk_widget_get_window(view_.get()); |
1086 DCHECK(!about_to_validate_and_paint_); | 1091 DCHECK(!about_to_validate_and_paint_); |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1359 } | 1364 } |
1360 } | 1365 } |
1361 | 1366 |
1362 // static | 1367 // static |
1363 void RenderWidgetHostView::GetDefaultScreenInfo( | 1368 void RenderWidgetHostView::GetDefaultScreenInfo( |
1364 WebKit::WebScreenInfo* results) { | 1369 WebKit::WebScreenInfo* results) { |
1365 GdkWindow* gdk_window = | 1370 GdkWindow* gdk_window = |
1366 gdk_display_get_default_group(gdk_display_get_default()); | 1371 gdk_display_get_default_group(gdk_display_get_default()); |
1367 content::GetScreenInfoFromNativeWindow(gdk_window, results); | 1372 content::GetScreenInfoFromNativeWindow(gdk_window, results); |
1368 } | 1373 } |
OLD | NEW |