| 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" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 else if (event->key() == "ArrowUp") | 50 else if (event->key() == "ArrowUp") |
| 51 retVal = WebFocusTypeUp; | 51 retVal = WebFocusTypeUp; |
| 52 else if (event->key() == "ArrowLeft") | 52 else if (event->key() == "ArrowLeft") |
| 53 retVal = WebFocusTypeLeft; | 53 retVal = WebFocusTypeLeft; |
| 54 else if (event->key() == "ArrowRight") | 54 else if (event->key() == "ArrowRight") |
| 55 retVal = WebFocusTypeRight; | 55 retVal = WebFocusTypeRight; |
| 56 return retVal; | 56 return retVal; |
| 57 } | 57 } |
| 58 | 58 |
| 59 bool mapKeyCodeForScroll(int keyCode, | 59 bool mapKeyCodeForScroll(int keyCode, |
| 60 PlatformEvent::Modifiers modifiers, | 60 WebInputEvent::Modifiers modifiers, |
| 61 ScrollDirection* scrollDirection, | 61 ScrollDirection* scrollDirection, |
| 62 ScrollGranularity* scrollGranularity) { | 62 ScrollGranularity* scrollGranularity) { |
| 63 if (modifiers & PlatformEvent::ShiftKey || modifiers & PlatformEvent::MetaKey) | 63 if (modifiers & WebInputEvent::ShiftKey || modifiers & WebInputEvent::MetaKey) |
| 64 return false; | 64 return false; |
| 65 | 65 |
| 66 if (modifiers & PlatformEvent::AltKey) { | 66 if (modifiers & WebInputEvent::AltKey) { |
| 67 // Alt-Up/Down should behave like PageUp/Down on Mac. (Note that Alt-keys | 67 // Alt-Up/Down should behave like PageUp/Down on Mac. (Note that Alt-keys |
| 68 // on other platforms are suppressed due to isSystemKey being set.) | 68 // on other platforms are suppressed due to isSystemKey being set.) |
| 69 if (keyCode == VKEY_UP) | 69 if (keyCode == VKEY_UP) |
| 70 keyCode = VKEY_PRIOR; | 70 keyCode = VKEY_PRIOR; |
| 71 else if (keyCode == VKEY_DOWN) | 71 else if (keyCode == VKEY_DOWN) |
| 72 keyCode = VKEY_NEXT; | 72 keyCode = VKEY_NEXT; |
| 73 else | 73 else |
| 74 return false; | 74 return false; |
| 75 } | 75 } |
| 76 | 76 |
| 77 if (modifiers & PlatformEvent::CtrlKey) { | 77 if (modifiers & WebInputEvent::ControlKey) { |
| 78 // Match FF behavior in the sense that Ctrl+home/end are the only Ctrl | 78 // Match FF behavior in the sense that Ctrl+home/end are the only Ctrl |
| 79 // key combinations which affect scrolling. | 79 // key combinations which affect scrolling. |
| 80 if (keyCode != VKEY_HOME && keyCode != VKEY_END) | 80 if (keyCode != VKEY_HOME && keyCode != VKEY_END) |
| 81 return false; | 81 return false; |
| 82 } | 82 } |
| 83 | 83 |
| 84 switch (keyCode) { | 84 switch (keyCode) { |
| 85 case VKEY_LEFT: | 85 case VKEY_LEFT: |
| 86 *scrollDirection = ScrollLeftIgnoringWritingMode; | 86 *scrollDirection = ScrollLeftIgnoringWritingMode; |
| 87 *scrollGranularity = ScrollByLine; | 87 *scrollGranularity = ScrollByLine; |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 if (currentModifiers & ::cmdKey) | 452 if (currentModifiers & ::cmdKey) |
| 453 modifiers |= WebInputEvent::MetaKey; | 453 modifiers |= WebInputEvent::MetaKey; |
| 454 #else | 454 #else |
| 455 // TODO(crbug.com/538289): Implement on other platforms. | 455 // TODO(crbug.com/538289): Implement on other platforms. |
| 456 return static_cast<WebInputEvent::Modifiers>(0); | 456 return static_cast<WebInputEvent::Modifiers>(0); |
| 457 #endif | 457 #endif |
| 458 return static_cast<WebInputEvent::Modifiers>(modifiers); | 458 return static_cast<WebInputEvent::Modifiers>(modifiers); |
| 459 } | 459 } |
| 460 | 460 |
| 461 } // namespace blink | 461 } // namespace blink |
| OLD | NEW |