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 973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
984 | 984 |
985 void RenderWidgetHostImpl::ForwardWheelEventWithLatencyInfo( | 985 void RenderWidgetHostImpl::ForwardWheelEventWithLatencyInfo( |
986 const blink::WebMouseWheelEvent& wheel_event, | 986 const blink::WebMouseWheelEvent& wheel_event, |
987 const ui::LatencyInfo& ui_latency) { | 987 const ui::LatencyInfo& ui_latency) { |
988 TRACE_EVENT2("input", "RenderWidgetHostImpl::ForwardWheelEvent", | 988 TRACE_EVENT2("input", "RenderWidgetHostImpl::ForwardWheelEvent", |
989 "dx", wheel_event.deltaX, "dy", wheel_event.deltaY); | 989 "dx", wheel_event.deltaX, "dy", wheel_event.deltaY); |
990 | 990 |
991 if (IgnoreInputEvents()) | 991 if (IgnoreInputEvents()) |
992 return; | 992 return; |
993 | 993 |
994 OnUserInput(wheel_event.type); | |
995 | |
994 if (touch_emulator_ && touch_emulator_->HandleMouseWheelEvent(wheel_event)) | 996 if (touch_emulator_ && touch_emulator_->HandleMouseWheelEvent(wheel_event)) |
995 return; | 997 return; |
996 | 998 |
997 MouseWheelEventWithLatencyInfo wheel_with_latency(wheel_event, ui_latency); | 999 MouseWheelEventWithLatencyInfo wheel_with_latency(wheel_event, ui_latency); |
998 latency_tracker_.OnInputEvent(wheel_event, &wheel_with_latency.latency); | 1000 latency_tracker_.OnInputEvent(wheel_event, &wheel_with_latency.latency); |
999 input_router_->SendWheelEvent(wheel_with_latency); | 1001 input_router_->SendWheelEvent(wheel_with_latency); |
1000 } | 1002 } |
1001 | 1003 |
1002 void RenderWidgetHostImpl::ForwardGestureEvent( | 1004 void RenderWidgetHostImpl::ForwardGestureEvent( |
1003 const blink::WebGestureEvent& gesture_event) { | 1005 const blink::WebGestureEvent& gesture_event) { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1098 suppress_next_char_events_ = true; | 1100 suppress_next_char_events_ = true; |
1099 return; | 1101 return; |
1100 } | 1102 } |
1101 | 1103 |
1102 if (key_event.type == WebKeyboardEvent::Char && | 1104 if (key_event.type == WebKeyboardEvent::Char && |
1103 (key_event.windowsKeyCode == ui::VKEY_RETURN || | 1105 (key_event.windowsKeyCode == ui::VKEY_RETURN || |
1104 key_event.windowsKeyCode == ui::VKEY_SPACE)) { | 1106 key_event.windowsKeyCode == ui::VKEY_SPACE)) { |
1105 OnUserGesture(); | 1107 OnUserGesture(); |
1106 } | 1108 } |
1107 | 1109 |
1110 if (key_event.type == WebKeyboardEvent::RawKeyDown) | |
jdduke (slow)
2015/10/21 20:53:51
Let's remove the explicit call here and in Forward
dominickn
2015/10/26 04:14:24
Done.
| |
1111 OnUserInput(key_event.type); | |
1112 | |
1108 // Double check the type to make sure caller hasn't sent us nonsense that | 1113 // Double check the type to make sure caller hasn't sent us nonsense that |
1109 // will mess up our key queue. | 1114 // will mess up our key queue. |
1110 if (!WebInputEvent::isKeyboardEventType(key_event.type)) | 1115 if (!WebInputEvent::isKeyboardEventType(key_event.type)) |
1111 return; | 1116 return; |
1112 | 1117 |
1113 if (suppress_next_char_events_) { | 1118 if (suppress_next_char_events_) { |
1114 // If preceding RawKeyDown event was handled by the browser, then we need | 1119 // If preceding RawKeyDown event was handled by the browser, then we need |
1115 // suppress all Char events generated by it. Please note that, one | 1120 // suppress all Char events generated by it. Please note that, one |
1116 // RawKeyDown event may generate multiple Char events, so we can't reset | 1121 // RawKeyDown event may generate multiple Char events, so we can't reset |
1117 // |suppress_next_char_events_| until we get a KeyUp or a RawKeyDown. | 1122 // |suppress_next_char_events_| until we get a KeyUp or a RawKeyDown. |
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1855 // events are being ignored in order to keep the renderer from getting | 1860 // events are being ignored in order to keep the renderer from getting |
1856 // confused about how many touches are active. | 1861 // confused about how many touches are active. |
1857 if (IgnoreInputEvents() && event.type != WebInputEvent::TouchCancel) | 1862 if (IgnoreInputEvents() && event.type != WebInputEvent::TouchCancel) |
1858 return INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; | 1863 return INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; |
1859 | 1864 |
1860 if (!process_->HasConnection()) | 1865 if (!process_->HasConnection()) |
1861 return INPUT_EVENT_ACK_STATE_UNKNOWN; | 1866 return INPUT_EVENT_ACK_STATE_UNKNOWN; |
1862 | 1867 |
1863 if (event.type == WebInputEvent::MouseDown || | 1868 if (event.type == WebInputEvent::MouseDown || |
1864 event.type == WebInputEvent::GestureTapDown) { | 1869 event.type == WebInputEvent::GestureTapDown) { |
1870 OnUserInput(event.type); | |
1865 OnUserGesture(); | 1871 OnUserGesture(); |
1866 } | 1872 } |
1867 | 1873 |
1868 return view_ ? view_->FilterInputEvent(event) | 1874 return view_ ? view_->FilterInputEvent(event) |
1869 : INPUT_EVENT_ACK_STATE_NOT_CONSUMED; | 1875 : INPUT_EVENT_ACK_STATE_NOT_CONSUMED; |
1870 } | 1876 } |
1871 | 1877 |
1872 void RenderWidgetHostImpl::IncrementInFlightEventCount() { | 1878 void RenderWidgetHostImpl::IncrementInFlightEventCount() { |
1873 increment_in_flight_event_count(); | 1879 increment_in_flight_event_count(); |
1874 if (!is_hidden_) | 1880 if (!is_hidden_) |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2193 } | 2199 } |
2194 | 2200 |
2195 #if defined(OS_WIN) | 2201 #if defined(OS_WIN) |
2196 gfx::NativeViewAccessible | 2202 gfx::NativeViewAccessible |
2197 RenderWidgetHostImpl::GetParentNativeViewAccessible() { | 2203 RenderWidgetHostImpl::GetParentNativeViewAccessible() { |
2198 return delegate_ ? delegate_->GetParentNativeViewAccessible() : NULL; | 2204 return delegate_ ? delegate_->GetParentNativeViewAccessible() : NULL; |
2199 } | 2205 } |
2200 #endif | 2206 #endif |
2201 | 2207 |
2202 } // namespace content | 2208 } // namespace content |
OLD | NEW |