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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 } | 78 } |
79 | 79 |
80 WebInputEventResult KeyboardEventManager::keyEvent( | 80 WebInputEventResult KeyboardEventManager::keyEvent( |
81 const WebKeyboardEvent& initialKeyEvent) | 81 const WebKeyboardEvent& initialKeyEvent) |
82 { | 82 { |
83 m_frame->chromeClient().clearToolTip(); | 83 m_frame->chromeClient().clearToolTip(); |
84 | 84 |
85 if (initialKeyEvent.windowsKeyCode == VK_CAPITAL) | 85 if (initialKeyEvent.windowsKeyCode == VK_CAPITAL) |
86 capsLockStateMayHaveChanged(); | 86 capsLockStateMayHaveChanged(); |
87 | 87 |
88 #if OS(WIN) | 88 if (m_scrollManager->middleClickAutoscrollInProgress()) { |
89 if (m_scrollManager->panScrollInProgress()) { | 89 DCHECK(RuntimeEnabledFeatures::middleClickAutoscrollEnabled()); |
90 // If a key is pressed while the panScroll is in progress then we want t
o stop | 90 // If a key is pressed while the middleClickAutoscroll is in progress th
en we want to stop |
91 if (initialKeyEvent.type == WebInputEvent::KeyDown || initialKeyEvent.ty
pe == WebInputEvent::RawKeyDown) | 91 if (initialKeyEvent.type == WebInputEvent::KeyDown || initialKeyEvent.ty
pe == WebInputEvent::RawKeyDown) |
92 m_scrollManager->stopAutoscroll(); | 92 m_scrollManager->stopAutoscroll(); |
93 | 93 |
94 // If we were in panscroll mode, we swallow the key event | 94 // If we were in panscroll mode, we swallow the key event |
95 return WebInputEventResult::HandledSuppressed; | 95 return WebInputEventResult::HandledSuppressed; |
96 } | 96 } |
97 #endif | |
98 | 97 |
99 // Check for cases where we are too early for events -- possible unmatched k
ey up | 98 // Check for cases where we are too early for events -- possible unmatched k
ey up |
100 // from pressing return in the location bar. | 99 // from pressing return in the location bar. |
101 Node* node = eventTargetNodeForDocument(m_frame->document()); | 100 Node* node = eventTargetNodeForDocument(m_frame->document()); |
102 if (!node) | 101 if (!node) |
103 return WebInputEventResult::NotHandled; | 102 return WebInputEventResult::NotHandled; |
104 | 103 |
105 UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); | 104 UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); |
106 | 105 |
107 // In IE, access keys are special, they are handled after default keydown pr
ocessing, but cannot be canceled - this is hard to match. | 106 // In IE, access keys are special, they are handled after default keydown pr
ocessing, but cannot be canceled - this is hard to match. |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 if (currentModifiers & ::cmdKey) | 355 if (currentModifiers & ::cmdKey) |
357 modifiers |= WebInputEvent::MetaKey; | 356 modifiers |= WebInputEvent::MetaKey; |
358 #else | 357 #else |
359 // TODO(crbug.com/538289): Implement on other platforms. | 358 // TODO(crbug.com/538289): Implement on other platforms. |
360 return static_cast<WebInputEvent::Modifiers>(0); | 359 return static_cast<WebInputEvent::Modifiers>(0); |
361 #endif | 360 #endif |
362 return static_cast<WebInputEvent::Modifiers>(modifiers); | 361 return static_cast<WebInputEvent::Modifiers>(modifiers); |
363 } | 362 } |
364 | 363 |
365 } // namespace blink | 364 } // namespace blink |
OLD | NEW |