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/DocumentUserGestureToken.h" |
8 #include "core/dom/Element.h" | 8 #include "core/dom/Element.h" |
9 #include "core/editing/Editor.h" | 9 #include "core/editing/Editor.h" |
10 #include "core/events/KeyboardEvent.h" | 10 #include "core/events/KeyboardEvent.h" |
11 #include "core/html/HTMLDialogElement.h" | 11 #include "core/html/HTMLDialogElement.h" |
12 #include "core/input/EventHandler.h" | 12 #include "core/input/EventHandler.h" |
13 #include "core/input/EventHandlingUtil.h" | 13 #include "core/input/EventHandlingUtil.h" |
| 14 #include "core/input/InputDeviceCapabilities.h" |
14 #include "core/input/ScrollManager.h" | 15 #include "core/input/ScrollManager.h" |
15 #include "core/layout/LayoutObject.h" | 16 #include "core/layout/LayoutObject.h" |
16 #include "core/layout/LayoutTextControlSingleLine.h" | 17 #include "core/layout/LayoutTextControlSingleLine.h" |
17 #include "core/loader/FrameLoaderClient.h" | 18 #include "core/loader/FrameLoaderClient.h" |
18 #include "core/page/ChromeClient.h" | 19 #include "core/page/ChromeClient.h" |
19 #include "core/page/FocusController.h" | 20 #include "core/page/FocusController.h" |
20 #include "core/page/Page.h" | 21 #include "core/page/Page.h" |
21 #include "core/page/SpatialNavigation.h" | 22 #include "core/page/SpatialNavigation.h" |
22 #include "platform/KeyboardCodes.h" | 23 #include "platform/KeyboardCodes.h" |
23 #include "platform/UserGestureIndicator.h" | 24 #include "platform/UserGestureIndicator.h" |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 if (!page->tabKeyCyclesThroughElements()) | 388 if (!page->tabKeyCyclesThroughElements()) |
388 return; | 389 return; |
389 | 390 |
390 WebFocusType focusType = | 391 WebFocusType focusType = |
391 event->shiftKey() ? WebFocusTypeBackward : WebFocusTypeForward; | 392 event->shiftKey() ? WebFocusTypeBackward : WebFocusTypeForward; |
392 | 393 |
393 // Tabs can be used in design mode editing. | 394 // Tabs can be used in design mode editing. |
394 if (m_frame->document()->inDesignMode()) | 395 if (m_frame->document()->inDesignMode()) |
395 return; | 396 return; |
396 | 397 |
397 if (page->focusController().advanceFocus( | 398 if (page->focusController().advanceFocus(focusType, |
398 focusType, | 399 m_frame->document() |
399 InputDeviceCapabilities::doesntFireTouchEventsSourceCapabilities())) | 400 ->domWindow() |
| 401 ->getInputDeviceCapabilities() |
| 402 ->firesTouchEvents(false))) |
400 event->setDefaultHandled(); | 403 event->setDefaultHandled(); |
401 } | 404 } |
402 | 405 |
403 void KeyboardEventManager::defaultEscapeEventHandler(KeyboardEvent* event) { | 406 void KeyboardEventManager::defaultEscapeEventHandler(KeyboardEvent* event) { |
404 if (HTMLDialogElement* dialog = m_frame->document()->activeModalDialog()) | 407 if (HTMLDialogElement* dialog = m_frame->document()->activeModalDialog()) |
405 dialog->dispatchEvent(Event::createCancelable(EventTypeNames::cancel)); | 408 dialog->dispatchEvent(Event::createCancelable(EventTypeNames::cancel)); |
406 } | 409 } |
407 | 410 |
408 static OverrideCapsLockState s_overrideCapsLockState; | 411 static OverrideCapsLockState s_overrideCapsLockState; |
409 | 412 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 if (currentModifiers & ::cmdKey) | 455 if (currentModifiers & ::cmdKey) |
453 modifiers |= WebInputEvent::MetaKey; | 456 modifiers |= WebInputEvent::MetaKey; |
454 #else | 457 #else |
455 // TODO(crbug.com/538289): Implement on other platforms. | 458 // TODO(crbug.com/538289): Implement on other platforms. |
456 return static_cast<WebInputEvent::Modifiers>(0); | 459 return static_cast<WebInputEvent::Modifiers>(0); |
457 #endif | 460 #endif |
458 return static_cast<WebInputEvent::Modifiers>(modifiers); | 461 return static_cast<WebInputEvent::Modifiers>(modifiers); |
459 } | 462 } |
460 | 463 |
461 } // namespace blink | 464 } // namespace blink |
OLD | NEW |