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 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 in_flight_event_count_(0), | 165 in_flight_event_count_(0), |
166 in_get_backing_store_(false), | 166 in_get_backing_store_(false), |
167 ignore_input_events_(false), | 167 ignore_input_events_(false), |
168 text_direction_updated_(false), | 168 text_direction_updated_(false), |
169 text_direction_(blink::WebTextDirectionLeftToRight), | 169 text_direction_(blink::WebTextDirectionLeftToRight), |
170 text_direction_canceled_(false), | 170 text_direction_canceled_(false), |
171 suppress_next_char_events_(false), | 171 suppress_next_char_events_(false), |
172 pending_mouse_lock_request_(false), | 172 pending_mouse_lock_request_(false), |
173 allow_privileged_mouse_lock_(false), | 173 allow_privileged_mouse_lock_(false), |
174 has_touch_handler_(false), | 174 has_touch_handler_(false), |
| 175 is_in_gesture_scroll_(false), |
175 next_browser_snapshot_id_(1), | 176 next_browser_snapshot_id_(1), |
176 owned_by_render_frame_host_(false), | 177 owned_by_render_frame_host_(false), |
177 is_focused_(false), | 178 is_focused_(false), |
178 weak_factory_(this) { | 179 weak_factory_(this) { |
179 CHECK(delegate_); | 180 CHECK(delegate_); |
180 CHECK_NE(MSG_ROUTING_NONE, routing_id_); | 181 CHECK_NE(MSG_ROUTING_NONE, routing_id_); |
181 DCHECK_EQ(surface_id_, GpuSurfaceTracker::Get()->LookupSurfaceForRenderer( | 182 DCHECK_EQ(surface_id_, GpuSurfaceTracker::Get()->LookupSurfaceForRenderer( |
182 process_->GetID(), routing_id_)); | 183 process_->GetID(), routing_id_)); |
183 | 184 |
184 std::pair<RoutingIDWidgetMap::iterator, bool> result = | 185 std::pair<RoutingIDWidgetMap::iterator, bool> result = |
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
972 } | 973 } |
973 | 974 |
974 void RenderWidgetHostImpl::ForwardGestureEventWithLatencyInfo( | 975 void RenderWidgetHostImpl::ForwardGestureEventWithLatencyInfo( |
975 const blink::WebGestureEvent& gesture_event, | 976 const blink::WebGestureEvent& gesture_event, |
976 const ui::LatencyInfo& ui_latency) { | 977 const ui::LatencyInfo& ui_latency) { |
977 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardGestureEvent"); | 978 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardGestureEvent"); |
978 // Early out if necessary, prior to performing latency logic. | 979 // Early out if necessary, prior to performing latency logic. |
979 if (IgnoreInputEvents()) | 980 if (IgnoreInputEvents()) |
980 return; | 981 return; |
981 | 982 |
| 983 if (gesture_event.type == blink::WebInputEvent::GestureScrollBegin) { |
| 984 DCHECK(!is_in_gesture_scroll_); |
| 985 is_in_gesture_scroll_ = true; |
| 986 } else if (gesture_event.type == blink::WebInputEvent::GestureScrollEnd || |
| 987 gesture_event.type == blink::WebInputEvent::GestureFlingStart) { |
| 988 DCHECK(is_in_gesture_scroll_); |
| 989 is_in_gesture_scroll_ = false; |
| 990 } |
| 991 |
982 if (delegate_->PreHandleGestureEvent(gesture_event)) | 992 if (delegate_->PreHandleGestureEvent(gesture_event)) |
983 return; | 993 return; |
984 | 994 |
985 GestureEventWithLatencyInfo gesture_with_latency(gesture_event, ui_latency); | 995 GestureEventWithLatencyInfo gesture_with_latency(gesture_event, ui_latency); |
986 latency_tracker_.OnInputEvent(gesture_event, &gesture_with_latency.latency); | 996 latency_tracker_.OnInputEvent(gesture_event, &gesture_with_latency.latency); |
987 input_router_->SendGestureEvent(gesture_with_latency); | 997 input_router_->SendGestureEvent(gesture_with_latency); |
988 } | 998 } |
989 | 999 |
990 void RenderWidgetHostImpl::ForwardEmulatedTouchEvent( | 1000 void RenderWidgetHostImpl::ForwardEmulatedTouchEvent( |
991 const blink::WebTouchEvent& touch_event) { | 1001 const blink::WebTouchEvent& touch_event) { |
(...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2131 } | 2141 } |
2132 | 2142 |
2133 #if defined(OS_WIN) | 2143 #if defined(OS_WIN) |
2134 gfx::NativeViewAccessible | 2144 gfx::NativeViewAccessible |
2135 RenderWidgetHostImpl::GetParentNativeViewAccessible() { | 2145 RenderWidgetHostImpl::GetParentNativeViewAccessible() { |
2136 return delegate_ ? delegate_->GetParentNativeViewAccessible() : NULL; | 2146 return delegate_ ? delegate_->GetParentNativeViewAccessible() : NULL; |
2137 } | 2147 } |
2138 #endif | 2148 #endif |
2139 | 2149 |
2140 } // namespace content | 2150 } // namespace content |
OLD | NEW |