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)); |
1107 if (*is_in_gesture_scroll) | |
1108 base::debug::StackTrace().Print(); | |
bokan
2017/04/11 16:23:14
Left over debugging?
wjmaclean
2017/04/11 20:04:51
Done.
With the DCHECK not firing anymore, I misse
| |
1106 *is_in_gesture_scroll = true; | 1109 *is_in_gesture_scroll = true; |
1107 } else if (gesture_event.GetType() == | 1110 } else if ((gesture_event.GetType() == |
1108 blink::WebInputEvent::kGestureScrollEnd || | 1111 blink::WebInputEvent::kGestureScrollEnd && |
1112 !gesture_event.data.scroll_end.synthetic) || | |
1109 gesture_event.GetType() == | 1113 gesture_event.GetType() == |
1110 blink::WebInputEvent::kGestureFlingStart) { | 1114 blink::WebInputEvent::kGestureFlingStart) { |
1111 // TODO(wjmaclean): Re-enable the following DCHECK once crbug.com/695187 | 1115 // TODO(wjmaclean): Re-enable the following DCHECK once crbug.com/695187 |
1112 // is fixed. | 1116 // is fixed. |
1113 // DCHECK(*is_in_gesture_scroll || | 1117 // DCHECK(*is_in_gesture_scroll || |
1114 // (gesture_event.type() == blink::WebInputEvent::GestureFlingStart && | 1118 // (gesture_event.type() == blink::WebInputEvent::GestureFlingStart && |
1115 // gesture_event.sourceDevice == | 1119 // gesture_event.sourceDevice == |
1116 // blink::WebGestureDevice::WebGestureDeviceTouchpad)); | 1120 // blink::WebGestureDevice::WebGestureDeviceTouchpad)); |
1117 *is_in_gesture_scroll = false; | 1121 *is_in_gesture_scroll = false; |
1118 } | 1122 } |
(...skipping 21 matching lines...) Expand all Loading... | |
1140 input_router_->SendGestureEvent(gesture_with_latency); | 1144 input_router_->SendGestureEvent(gesture_with_latency); |
1141 | 1145 |
1142 if (scroll_update_needs_wrapping) { | 1146 if (scroll_update_needs_wrapping) { |
1143 ForwardGestureEventWithLatencyInfo( | 1147 ForwardGestureEventWithLatencyInfo( |
1144 CreateScrollEndForWrapping(gesture_event), | 1148 CreateScrollEndForWrapping(gesture_event), |
1145 ui::WebInputEventTraits::CreateLatencyInfoForWebGestureEvent( | 1149 ui::WebInputEventTraits::CreateLatencyInfoForWebGestureEvent( |
1146 gesture_event)); | 1150 gesture_event)); |
1147 } | 1151 } |
1148 } | 1152 } |
1149 | 1153 |
1154 bool RenderWidgetHostImpl::is_in_gesture_scroll( | |
1155 blink::WebGestureDevice device) { | |
1156 switch (device) { | |
1157 case blink::WebGestureDevice::kWebGestureDeviceTouchpad: | |
1158 return is_in_touchpad_gesture_scroll_; | |
1159 case blink::WebGestureDevice::kWebGestureDeviceTouchscreen: | |
1160 return is_in_touchscreen_gesture_scroll_; | |
1161 default: | |
1162 NOTREACHED(); | |
1163 return false; // Required to keep the compiler happy. | |
1164 } | |
1165 } | |
1166 | |
1150 void RenderWidgetHostImpl::ForwardEmulatedTouchEvent( | 1167 void RenderWidgetHostImpl::ForwardEmulatedTouchEvent( |
1151 const blink::WebTouchEvent& touch_event) { | 1168 const blink::WebTouchEvent& touch_event) { |
1152 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardEmulatedTouchEvent"); | 1169 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardEmulatedTouchEvent"); |
1153 ui::LatencyInfo latency_info(ui::SourceEventType::TOUCH); | 1170 ui::LatencyInfo latency_info(ui::SourceEventType::TOUCH); |
1154 TouchEventWithLatencyInfo touch_with_latency(touch_event, latency_info); | 1171 TouchEventWithLatencyInfo touch_with_latency(touch_event, latency_info); |
1155 DispatchInputEventWithLatencyInfo(touch_event, &touch_with_latency.latency); | 1172 DispatchInputEventWithLatencyInfo(touch_event, &touch_with_latency.latency); |
1156 input_router_->SendTouchEvent(touch_with_latency); | 1173 input_router_->SendTouchEvent(touch_with_latency); |
1157 } | 1174 } |
1158 | 1175 |
1159 void RenderWidgetHostImpl::ForwardTouchEventWithLatencyInfo( | 1176 void RenderWidgetHostImpl::ForwardTouchEventWithLatencyInfo( |
(...skipping 1558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2718 RenderProcessHost* rph = GetProcess(); | 2735 RenderProcessHost* rph = GetProcess(); |
2719 for (std::vector<IPC::Message>::const_iterator i = messages.begin(); | 2736 for (std::vector<IPC::Message>::const_iterator i = messages.begin(); |
2720 i != messages.end(); ++i) { | 2737 i != messages.end(); ++i) { |
2721 rph->OnMessageReceived(*i); | 2738 rph->OnMessageReceived(*i); |
2722 if (i->dispatch_error()) | 2739 if (i->dispatch_error()) |
2723 rph->OnBadMessageReceived(*i); | 2740 rph->OnBadMessageReceived(*i); |
2724 } | 2741 } |
2725 } | 2742 } |
2726 | 2743 |
2727 } // namespace content | 2744 } // namespace content |
OLD | NEW |