OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "KeyboardEventManager.h" | 5 #include "KeyboardEventManager.h" |
6 | 6 |
7 #include "core/dom/Element.h" | 7 #include "core/dom/Element.h" |
8 #include "core/editing/Editor.h" | 8 #include "core/editing/Editor.h" |
9 #include "core/events/KeyboardEvent.h" | 9 #include "core/events/KeyboardEvent.h" |
10 #include "core/html/HTMLDialogElement.h" | 10 #include "core/html/HTMLDialogElement.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // If we were in panscroll mode, we swallow the key event | 97 // If we were in panscroll mode, we swallow the key event |
98 return WebInputEventResult::HandledSuppressed; | 98 return WebInputEventResult::HandledSuppressed; |
99 } | 99 } |
100 | 100 |
101 // Check for cases where we are too early for events -- possible unmatched key | 101 // Check for cases where we are too early for events -- possible unmatched key |
102 // up from pressing return in the location bar. | 102 // up from pressing return in the location bar. |
103 Node* node = eventTargetNodeForDocument(m_frame->document()); | 103 Node* node = eventTargetNodeForDocument(m_frame->document()); |
104 if (!node) | 104 if (!node) |
105 return WebInputEventResult::NotHandled; | 105 return WebInputEventResult::NotHandled; |
106 | 106 |
| 107 // TODO(japhet): UserGestureIndicator should setHasReceivedUserGesture() |
| 108 // on the Document. |
107 UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); | 109 UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); |
| 110 m_frame->document()->setHasReceivedUserGesture(); |
108 | 111 |
109 // In IE, access keys are special, they are handled after default keydown | 112 // In IE, access keys are special, they are handled after default keydown |
110 // processing, but cannot be canceled - this is hard to match. On Mac OS X, | 113 // processing, but cannot be canceled - this is hard to match. On Mac OS X, |
111 // we process them before dispatching keydown, as the default keydown handler | 114 // we process them before dispatching keydown, as the default keydown handler |
112 // implements Emacs key bindings, which may conflict with access keys. Then we | 115 // implements Emacs key bindings, which may conflict with access keys. Then we |
113 // dispatch keydown, but suppress its default handling. | 116 // dispatch keydown, but suppress its default handling. |
114 // On Windows, WebKit explicitly calls handleAccessKey() instead of | 117 // On Windows, WebKit explicitly calls handleAccessKey() instead of |
115 // dispatching a keypress event for WM_SYSCHAR messages. Other platforms | 118 // dispatching a keypress event for WM_SYSCHAR messages. Other platforms |
116 // currently match either Mac or Windows behavior, depending on whether they | 119 // currently match either Mac or Windows behavior, depending on whether they |
117 // send combined KeyDown events. | 120 // send combined KeyDown events. |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 if (currentModifiers & ::cmdKey) | 375 if (currentModifiers & ::cmdKey) |
373 modifiers |= WebInputEvent::MetaKey; | 376 modifiers |= WebInputEvent::MetaKey; |
374 #else | 377 #else |
375 // TODO(crbug.com/538289): Implement on other platforms. | 378 // TODO(crbug.com/538289): Implement on other platforms. |
376 return static_cast<WebInputEvent::Modifiers>(0); | 379 return static_cast<WebInputEvent::Modifiers>(0); |
377 #endif | 380 #endif |
378 return static_cast<WebInputEvent::Modifiers>(modifiers); | 381 return static_cast<WebInputEvent::Modifiers>(modifiers); |
379 } | 382 } |
380 | 383 |
381 } // namespace blink | 384 } // namespace blink |
OLD | NEW |