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 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1126 // First, let keypress listeners take a shot at handling the event. If a | 1126 // First, let keypress listeners take a shot at handling the event. If a |
1127 // listener handles the event, it should not be propagated to the renderer. | 1127 // listener handles the event, it should not be propagated to the renderer. |
1128 if (KeyPressListenersHandleEvent(key_event)) { | 1128 if (KeyPressListenersHandleEvent(key_event)) { |
1129 // Some keypresses that are accepted by the listener might have follow up | 1129 // Some keypresses that are accepted by the listener might have follow up |
1130 // char events, which should be ignored. | 1130 // char events, which should be ignored. |
1131 if (key_event.type == WebKeyboardEvent::RawKeyDown) | 1131 if (key_event.type == WebKeyboardEvent::RawKeyDown) |
1132 suppress_next_char_events_ = true; | 1132 suppress_next_char_events_ = true; |
1133 return; | 1133 return; |
1134 } | 1134 } |
1135 | 1135 |
1136 if (key_event.type == WebKeyboardEvent::Char && | |
1137 (key_event.windowsKeyCode == ui::VKEY_RETURN || | |
1138 key_event.windowsKeyCode == ui::VKEY_SPACE)) { | |
1139 if (delegate_) | |
1140 delegate_->OnUserGesture(this); | |
1141 } | |
1142 | |
1143 // Double check the type to make sure caller hasn't sent us nonsense that | 1136 // Double check the type to make sure caller hasn't sent us nonsense that |
1144 // will mess up our key queue. | 1137 // will mess up our key queue. |
1145 if (!WebInputEvent::isKeyboardEventType(key_event.type)) | 1138 if (!WebInputEvent::isKeyboardEventType(key_event.type)) |
1146 return; | 1139 return; |
1147 | 1140 |
1148 if (suppress_next_char_events_) { | 1141 if (suppress_next_char_events_) { |
1149 // If preceding RawKeyDown event was handled by the browser, then we need | 1142 // If preceding RawKeyDown event was handled by the browser, then we need |
1150 // suppress all Char events generated by it. Please note that, one | 1143 // suppress all Char events generated by it. Please note that, one |
1151 // RawKeyDown event may generate multiple Char events, so we can't reset | 1144 // RawKeyDown event may generate multiple Char events, so we can't reset |
1152 // |suppress_next_char_events_| until we get a KeyUp or a RawKeyDown. | 1145 // |suppress_next_char_events_| until we get a KeyUp or a RawKeyDown. |
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1900 const blink::WebInputEvent& event, const ui::LatencyInfo& latency_info) { | 1893 const blink::WebInputEvent& event, const ui::LatencyInfo& latency_info) { |
1901 // Don't ignore touch cancel events, since they may be sent while input | 1894 // Don't ignore touch cancel events, since they may be sent while input |
1902 // events are being ignored in order to keep the renderer from getting | 1895 // events are being ignored in order to keep the renderer from getting |
1903 // confused about how many touches are active. | 1896 // confused about how many touches are active. |
1904 if (ShouldDropInputEvents() && event.type != WebInputEvent::TouchCancel) | 1897 if (ShouldDropInputEvents() && event.type != WebInputEvent::TouchCancel) |
1905 return INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; | 1898 return INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; |
1906 | 1899 |
1907 if (!process_->HasConnection()) | 1900 if (!process_->HasConnection()) |
1908 return INPUT_EVENT_ACK_STATE_UNKNOWN; | 1901 return INPUT_EVENT_ACK_STATE_UNKNOWN; |
1909 | 1902 |
1910 if (event.type == WebInputEvent::MouseDown || | |
1911 event.type == WebInputEvent::GestureTapDown) { | |
1912 if (delegate_) | |
1913 delegate_->OnUserGesture(this); | |
1914 } | |
1915 | |
1916 if (delegate_) { | 1903 if (delegate_) { |
1917 if (event.type == WebInputEvent::MouseDown || | 1904 if (event.type == WebInputEvent::MouseDown || |
1918 event.type == WebInputEvent::GestureTapDown || | 1905 event.type == WebInputEvent::GestureTapDown || |
1919 event.type == WebInputEvent::RawKeyDown) { | 1906 event.type == WebInputEvent::RawKeyDown) { |
1920 delegate_->OnUserInteraction(event.type); | 1907 delegate_->OnUserInteraction(this, event.type); |
1921 } else if (event.type == WebInputEvent::MouseWheel) { | 1908 } else if (event.type == WebInputEvent::MouseWheel) { |
1922 if (mouse_wheel_coalesce_timer_->Elapsed().InSecondsF() > | 1909 if (mouse_wheel_coalesce_timer_->Elapsed().InSecondsF() > |
tdresser
2016/02/25 14:42:48
dtapuska@ is working on dispatching gesture events
dtapuska
2016/02/25 14:48:58
Can you please add code for GestureScrollBegin? Yo
dominickn
2016/02/26 00:36:11
Thanks for the FYI. It looks like GestureScrollBeg
tdresser
2016/02/26 13:14:18
What do you mean GestureScrollBegin fires for "tap
| |
1923 kMouseWheelCoalesceIntervalInSeconds) { | 1910 kMouseWheelCoalesceIntervalInSeconds) { |
1924 delegate_->OnUserInteraction(event.type); | 1911 delegate_->OnUserInteraction(this, event.type); |
1925 } | 1912 } |
1926 | 1913 |
1927 mouse_wheel_coalesce_timer_.reset(new base::ElapsedTimer()); | 1914 mouse_wheel_coalesce_timer_.reset(new base::ElapsedTimer()); |
1928 } | 1915 } |
1929 } | 1916 } |
1930 | 1917 |
1931 return view_ ? view_->FilterInputEvent(event) | 1918 return view_ ? view_->FilterInputEvent(event) |
1932 : INPUT_EVENT_ACK_STATE_NOT_CONSUMED; | 1919 : INPUT_EVENT_ACK_STATE_NOT_CONSUMED; |
1933 } | 1920 } |
1934 | 1921 |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2253 } | 2240 } |
2254 | 2241 |
2255 #if defined(OS_WIN) | 2242 #if defined(OS_WIN) |
2256 gfx::NativeViewAccessible | 2243 gfx::NativeViewAccessible |
2257 RenderWidgetHostImpl::GetParentNativeViewAccessible() { | 2244 RenderWidgetHostImpl::GetParentNativeViewAccessible() { |
2258 return delegate_ ? delegate_->GetParentNativeViewAccessible() : NULL; | 2245 return delegate_ ? delegate_->GetParentNativeViewAccessible() : NULL; |
2259 } | 2246 } |
2260 #endif | 2247 #endif |
2261 | 2248 |
2262 } // namespace content | 2249 } // namespace content |
OLD | NEW |