| 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/DocumentUserGestureToken.h" |
| 7 #include "core/dom/Element.h" | 8 #include "core/dom/Element.h" |
| 8 #include "core/editing/Editor.h" | 9 #include "core/editing/Editor.h" |
| 9 #include "core/events/KeyboardEvent.h" | 10 #include "core/events/KeyboardEvent.h" |
| 10 #include "core/html/HTMLDialogElement.h" | 11 #include "core/html/HTMLDialogElement.h" |
| 11 #include "core/input/EventHandlingUtil.h" | 12 #include "core/input/EventHandlingUtil.h" |
| 12 #include "core/input/ScrollManager.h" | 13 #include "core/input/ScrollManager.h" |
| 13 #include "core/layout/LayoutObject.h" | 14 #include "core/layout/LayoutObject.h" |
| 14 #include "core/layout/LayoutTextControlSingleLine.h" | 15 #include "core/layout/LayoutTextControlSingleLine.h" |
| 15 #include "core/loader/FrameLoaderClient.h" | 16 #include "core/loader/FrameLoaderClient.h" |
| 16 #include "core/page/ChromeClient.h" | 17 #include "core/page/ChromeClient.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 // If we were in panscroll mode, we swallow the key event | 98 // If we were in panscroll mode, we swallow the key event |
| 98 return WebInputEventResult::HandledSuppressed; | 99 return WebInputEventResult::HandledSuppressed; |
| 99 } | 100 } |
| 100 | 101 |
| 101 // Check for cases where we are too early for events -- possible unmatched key | 102 // Check for cases where we are too early for events -- possible unmatched key |
| 102 // up from pressing return in the location bar. | 103 // up from pressing return in the location bar. |
| 103 Node* node = eventTargetNodeForDocument(m_frame->document()); | 104 Node* node = eventTargetNodeForDocument(m_frame->document()); |
| 104 if (!node) | 105 if (!node) |
| 105 return WebInputEventResult::NotHandled; | 106 return WebInputEventResult::NotHandled; |
| 106 | 107 |
| 107 UserGestureIndicator gestureIndicator(UserGestureToken::create()); | 108 UserGestureIndicator gestureIndicator( |
| 109 DocumentUserGestureToken::create(m_frame->document())); |
| 108 | 110 |
| 109 // In IE, access keys are special, they are handled after default keydown | 111 // 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, | 112 // 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 | 113 // we process them before dispatching keydown, as the default keydown handler |
| 112 // implements Emacs key bindings, which may conflict with access keys. Then we | 114 // implements Emacs key bindings, which may conflict with access keys. Then we |
| 113 // dispatch keydown, but suppress its default handling. | 115 // dispatch keydown, but suppress its default handling. |
| 114 // On Windows, WebKit explicitly calls handleAccessKey() instead of | 116 // On Windows, WebKit explicitly calls handleAccessKey() instead of |
| 115 // dispatching a keypress event for WM_SYSCHAR messages. Other platforms | 117 // dispatching a keypress event for WM_SYSCHAR messages. Other platforms |
| 116 // currently match either Mac or Windows behavior, depending on whether they | 118 // currently match either Mac or Windows behavior, depending on whether they |
| 117 // send combined KeyDown events. | 119 // send combined KeyDown events. |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 if (currentModifiers & ::cmdKey) | 374 if (currentModifiers & ::cmdKey) |
| 373 modifiers |= WebInputEvent::MetaKey; | 375 modifiers |= WebInputEvent::MetaKey; |
| 374 #else | 376 #else |
| 375 // TODO(crbug.com/538289): Implement on other platforms. | 377 // TODO(crbug.com/538289): Implement on other platforms. |
| 376 return static_cast<WebInputEvent::Modifiers>(0); | 378 return static_cast<WebInputEvent::Modifiers>(0); |
| 377 #endif | 379 #endif |
| 378 return static_cast<WebInputEvent::Modifiers>(modifiers); | 380 return static_cast<WebInputEvent::Modifiers>(modifiers); |
| 379 } | 381 } |
| 380 | 382 |
| 381 } // namespace blink | 383 } // namespace blink |
| OLD | NEW |