OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_impl.h" | 5 #include "content/browser/renderer_host/render_widget_host_impl.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <tuple> | 10 #include <tuple> |
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1094 return; | 1094 return; |
1095 | 1095 |
1096 // TODO(wjmaclean) Remove the code for supporting resending gesture events | 1096 // TODO(wjmaclean) Remove the code for supporting resending gesture events |
1097 // when WebView transitions to OOPIF and BrowserPlugin is removed. | 1097 // when WebView transitions to OOPIF and BrowserPlugin is removed. |
1098 // http://crbug.com/533069 | 1098 // http://crbug.com/533069 |
1099 bool* is_in_gesture_scroll = | 1099 bool* is_in_gesture_scroll = |
1100 gesture_event.source_device == | 1100 gesture_event.source_device == |
1101 blink::WebGestureDevice::kWebGestureDeviceTouchpad | 1101 blink::WebGestureDevice::kWebGestureDeviceTouchpad |
1102 ? &is_in_touchpad_gesture_scroll_ | 1102 ? &is_in_touchpad_gesture_scroll_ |
1103 : &is_in_touchscreen_gesture_scroll_; | 1103 : &is_in_touchscreen_gesture_scroll_; |
1104 if (gesture_event.GetType() == blink::WebInputEvent::kGestureScrollBegin) { | 1104 if (gesture_event.GetType() == blink::WebInputEvent::kGestureScrollBegin && |
| 1105 !gesture_event.data.scroll_begin.synthetic) { |
1105 DCHECK(!(*is_in_gesture_scroll)); | 1106 DCHECK(!(*is_in_gesture_scroll)); |
1106 *is_in_gesture_scroll = true; | 1107 *is_in_gesture_scroll = true; |
1107 } else if (gesture_event.GetType() == | 1108 } else if ((gesture_event.GetType() == |
1108 blink::WebInputEvent::kGestureScrollEnd || | 1109 blink::WebInputEvent::kGestureScrollEnd && |
| 1110 !gesture_event.data.scroll_end.synthetic) || |
1109 gesture_event.GetType() == | 1111 gesture_event.GetType() == |
1110 blink::WebInputEvent::kGestureFlingStart) { | 1112 blink::WebInputEvent::kGestureFlingStart) { |
1111 // TODO(wjmaclean): Re-enable the following DCHECK once crbug.com/695187 | 1113 // TODO(wjmaclean): Re-enable the following DCHECK once crbug.com/695187 |
1112 // is fixed. | 1114 // is fixed. |
1113 // DCHECK(*is_in_gesture_scroll || | 1115 // DCHECK(*is_in_gesture_scroll || |
1114 // (gesture_event.type() == blink::WebInputEvent::GestureFlingStart && | 1116 // (gesture_event.type() == blink::WebInputEvent::GestureFlingStart && |
1115 // gesture_event.sourceDevice == | 1117 // gesture_event.sourceDevice == |
1116 // blink::WebGestureDevice::WebGestureDeviceTouchpad)); | 1118 // blink::WebGestureDevice::WebGestureDeviceTouchpad)); |
1117 *is_in_gesture_scroll = false; | 1119 *is_in_gesture_scroll = false; |
1118 } | 1120 } |
(...skipping 21 matching lines...) Expand all Loading... |
1140 input_router_->SendGestureEvent(gesture_with_latency); | 1142 input_router_->SendGestureEvent(gesture_with_latency); |
1141 | 1143 |
1142 if (scroll_update_needs_wrapping) { | 1144 if (scroll_update_needs_wrapping) { |
1143 ForwardGestureEventWithLatencyInfo( | 1145 ForwardGestureEventWithLatencyInfo( |
1144 CreateScrollEndForWrapping(gesture_event), | 1146 CreateScrollEndForWrapping(gesture_event), |
1145 ui::WebInputEventTraits::CreateLatencyInfoForWebGestureEvent( | 1147 ui::WebInputEventTraits::CreateLatencyInfoForWebGestureEvent( |
1146 gesture_event)); | 1148 gesture_event)); |
1147 } | 1149 } |
1148 } | 1150 } |
1149 | 1151 |
| 1152 bool RenderWidgetHostImpl::is_in_gesture_scroll( |
| 1153 blink::WebGestureDevice device) { |
| 1154 switch (device) { |
| 1155 case blink::WebGestureDevice::kWebGestureDeviceTouchpad: |
| 1156 return is_in_touchpad_gesture_scroll_; |
| 1157 case blink::WebGestureDevice::kWebGestureDeviceTouchscreen: |
| 1158 return is_in_touchscreen_gesture_scroll_; |
| 1159 default: |
| 1160 NOTREACHED(); |
| 1161 return false; // Required to keep the compiler happy. |
| 1162 } |
| 1163 } |
| 1164 |
1150 void RenderWidgetHostImpl::ForwardEmulatedTouchEvent( | 1165 void RenderWidgetHostImpl::ForwardEmulatedTouchEvent( |
1151 const blink::WebTouchEvent& touch_event) { | 1166 const blink::WebTouchEvent& touch_event) { |
1152 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardEmulatedTouchEvent"); | 1167 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardEmulatedTouchEvent"); |
1153 ui::LatencyInfo latency_info(ui::SourceEventType::TOUCH); | 1168 ui::LatencyInfo latency_info(ui::SourceEventType::TOUCH); |
1154 TouchEventWithLatencyInfo touch_with_latency(touch_event, latency_info); | 1169 TouchEventWithLatencyInfo touch_with_latency(touch_event, latency_info); |
1155 DispatchInputEventWithLatencyInfo(touch_event, &touch_with_latency.latency); | 1170 DispatchInputEventWithLatencyInfo(touch_event, &touch_with_latency.latency); |
1156 input_router_->SendTouchEvent(touch_with_latency); | 1171 input_router_->SendTouchEvent(touch_with_latency); |
1157 } | 1172 } |
1158 | 1173 |
1159 void RenderWidgetHostImpl::ForwardTouchEventWithLatencyInfo( | 1174 void RenderWidgetHostImpl::ForwardTouchEventWithLatencyInfo( |
(...skipping 1558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2718 RenderProcessHost* rph = GetProcess(); | 2733 RenderProcessHost* rph = GetProcess(); |
2719 for (std::vector<IPC::Message>::const_iterator i = messages.begin(); | 2734 for (std::vector<IPC::Message>::const_iterator i = messages.begin(); |
2720 i != messages.end(); ++i) { | 2735 i != messages.end(); ++i) { |
2721 rph->OnMessageReceived(*i); | 2736 rph->OnMessageReceived(*i); |
2722 if (i->dispatch_error()) | 2737 if (i->dispatch_error()) |
2723 rph->OnBadMessageReceived(*i); | 2738 rph->OnBadMessageReceived(*i); |
2724 } | 2739 } |
2725 } | 2740 } |
2726 | 2741 |
2727 } // namespace content | 2742 } // namespace content |
OLD | NEW |