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.h" | 5 #include "content/browser/renderer_host/render_widget_host.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "content/common/view_messages.h" | 27 #include "content/common/view_messages.h" |
28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli
ne.h" | 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli
ne.h" |
29 #include "ui/base/keycodes/keyboard_codes.h" | 29 #include "ui/base/keycodes/keyboard_codes.h" |
30 #include "webkit/glue/webcursor.h" | 30 #include "webkit/glue/webcursor.h" |
31 #include "webkit/plugins/npapi/webplugin.h" | 31 #include "webkit/plugins/npapi/webplugin.h" |
32 | 32 |
33 using base::Time; | 33 using base::Time; |
34 using base::TimeDelta; | 34 using base::TimeDelta; |
35 using base::TimeTicks; | 35 using base::TimeTicks; |
36 | 36 |
| 37 using WebKit::WebGestureEvent; |
37 using WebKit::WebInputEvent; | 38 using WebKit::WebInputEvent; |
38 using WebKit::WebKeyboardEvent; | 39 using WebKit::WebKeyboardEvent; |
39 using WebKit::WebMouseEvent; | 40 using WebKit::WebMouseEvent; |
40 using WebKit::WebMouseWheelEvent; | 41 using WebKit::WebMouseWheelEvent; |
41 using WebKit::WebTextDirection; | 42 using WebKit::WebTextDirection; |
42 | 43 |
43 // How long to (synchronously) wait for the renderer to respond with a | 44 // How long to (synchronously) wait for the renderer to respond with a |
44 // PaintRect message, when our backing-store is invalid, before giving up and | 45 // PaintRect message, when our backing-store is invalid, before giving up and |
45 // returning a null or incorrectly sized backing-store from GetBackingStore. | 46 // returning a null or incorrectly sized backing-store from GetBackingStore. |
46 // This timeout impacts the "choppiness" of our window resize perf. | 47 // This timeout impacts the "choppiness" of our window resize perf. |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 return; | 554 return; |
554 } | 555 } |
555 mouse_wheel_pending_ = true; | 556 mouse_wheel_pending_ = true; |
556 | 557 |
557 HISTOGRAM_COUNTS_100("MPArch.RWH_WheelQueueSize", | 558 HISTOGRAM_COUNTS_100("MPArch.RWH_WheelQueueSize", |
558 coalesced_mouse_wheel_events_.size()); | 559 coalesced_mouse_wheel_events_.size()); |
559 | 560 |
560 ForwardInputEvent(wheel_event, sizeof(WebMouseWheelEvent), false); | 561 ForwardInputEvent(wheel_event, sizeof(WebMouseWheelEvent), false); |
561 } | 562 } |
562 | 563 |
| 564 void RenderWidgetHost::ForwardGestureEvent( |
| 565 const WebKit::WebGestureEvent& gesture_event) { |
| 566 TRACE_EVENT0("renderer_host", "RenderWidgetHost::ForwardWheelEvent"); |
| 567 if (ignore_input_events_ || process_->ignore_input_events()) |
| 568 return; |
| 569 |
| 570 ForwardInputEvent(gesture_event, sizeof(WebGestureEvent), false); |
| 571 } |
| 572 |
563 void RenderWidgetHost::ForwardKeyboardEvent( | 573 void RenderWidgetHost::ForwardKeyboardEvent( |
564 const NativeWebKeyboardEvent& key_event) { | 574 const NativeWebKeyboardEvent& key_event) { |
565 TRACE_EVENT0("renderer_host", "RenderWidgetHost::ForwardKeyboardEvent"); | 575 TRACE_EVENT0("renderer_host", "RenderWidgetHost::ForwardKeyboardEvent"); |
566 if (ignore_input_events_ || process_->ignore_input_events()) | 576 if (ignore_input_events_ || process_->ignore_input_events()) |
567 return; | 577 return; |
568 | 578 |
569 if (key_event.type == WebKeyboardEvent::Char && | 579 if (key_event.type == WebKeyboardEvent::Char && |
570 (key_event.windowsKeyCode == ui::VKEY_RETURN || | 580 (key_event.windowsKeyCode == ui::VKEY_RETURN || |
571 key_event.windowsKeyCode == ui::VKEY_SPACE)) { | 581 key_event.windowsKeyCode == ui::VKEY_SPACE)) { |
572 OnUserGesture(); | 582 OnUserGesture(); |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 Details<PaintAtSizeAckDetails>(&details)); | 873 Details<PaintAtSizeAckDetails>(&details)); |
864 } | 874 } |
865 | 875 |
866 void RenderWidgetHost::OnMsgUpdateRect( | 876 void RenderWidgetHost::OnMsgUpdateRect( |
867 const ViewHostMsg_UpdateRect_Params& params) { | 877 const ViewHostMsg_UpdateRect_Params& params) { |
868 TRACE_EVENT0("renderer_host", "RenderWidgetHost::OnMsgUpdateRect"); | 878 TRACE_EVENT0("renderer_host", "RenderWidgetHost::OnMsgUpdateRect"); |
869 TimeTicks paint_start = TimeTicks::Now(); | 879 TimeTicks paint_start = TimeTicks::Now(); |
870 | 880 |
871 // Update our knowledge of the RenderWidget's size. | 881 // Update our knowledge of the RenderWidget's size. |
872 current_size_ = params.view_size; | 882 current_size_ = params.view_size; |
| 883 // Update our knowledge of the RenderWidget's contents size. |
| 884 contents_size_ = params.contents_size; |
873 // Update our knowledge of the RenderWidget's scroll offset. | 885 // Update our knowledge of the RenderWidget's scroll offset. |
874 last_scroll_offset_ = params.scroll_offset; | 886 last_scroll_offset_ = params.scroll_offset; |
875 | 887 |
876 bool is_resize_ack = | 888 bool is_resize_ack = |
877 ViewHostMsg_UpdateRect_Flags::is_resize_ack(params.flags); | 889 ViewHostMsg_UpdateRect_Flags::is_resize_ack(params.flags); |
878 | 890 |
879 // resize_ack_pending_ needs to be cleared before we call DidPaintRect, since | 891 // resize_ack_pending_ needs to be cleared before we call DidPaintRect, since |
880 // that will end up reaching GetBackingStore. | 892 // that will end up reaching GetBackingStore. |
881 if (is_resize_ack) { | 893 if (is_resize_ack) { |
882 DCHECK(resize_ack_pending_); | 894 DCHECK(resize_ack_pending_); |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1203 view_->CreatePluginContainer(deferred_plugin_handles_[i]); | 1215 view_->CreatePluginContainer(deferred_plugin_handles_[i]); |
1204 #endif | 1216 #endif |
1205 } | 1217 } |
1206 | 1218 |
1207 deferred_plugin_handles_.clear(); | 1219 deferred_plugin_handles_.clear(); |
1208 } | 1220 } |
1209 | 1221 |
1210 void RenderWidgetHost::StartUserGesture() { | 1222 void RenderWidgetHost::StartUserGesture() { |
1211 OnUserGesture(); | 1223 OnUserGesture(); |
1212 } | 1224 } |
OLD | NEW |