| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008, 2009 Google Inc. | 3 * Copyright (C) 2008, 2009 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 #include "platform/PlatformKeyboardEvent.h" | 27 #include "platform/PlatformKeyboardEvent.h" |
| 28 | 28 |
| 29 #if OS(WIN) | 29 #if OS(WIN) |
| 30 #include <windows.h> | 30 #include <windows.h> |
| 31 #elif OS(MACOSX) | 31 #elif OS(MACOSX) |
| 32 #import <Carbon/Carbon.h> | 32 #import <Carbon/Carbon.h> |
| 33 #else | |
| 34 #include "platform/NotImplemented.h" | |
| 35 #endif | 33 #endif |
| 36 | 34 |
| 37 namespace blink { | 35 namespace blink { |
| 38 | 36 |
| 39 #if OS(WIN) | 37 #if OS(WIN) |
| 40 static const unsigned short HIGHBITMASKSHORT = 0x8000; | 38 static const unsigned short HIGHBITMASKSHORT = 0x8000; |
| 41 #endif | 39 #endif |
| 42 | 40 |
| 43 PlatformKeyboardEvent::OverrideCapsLockState PlatformKeyboardEvent::s_overrideCa
psLockState = | 41 PlatformKeyboardEvent::OverrideCapsLockState PlatformKeyboardEvent::s_overrideCa
psLockState = |
| 44 PlatformKeyboardEvent::OverrideCapsLockState::Default; | 42 PlatformKeyboardEvent::OverrideCapsLockState::Default; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 bool PlatformKeyboardEvent::currentCapsLockState() | 74 bool PlatformKeyboardEvent::currentCapsLockState() |
| 77 { | 75 { |
| 78 switch (s_overrideCapsLockState) { | 76 switch (s_overrideCapsLockState) { |
| 79 case OverrideCapsLockState::Default: | 77 case OverrideCapsLockState::Default: |
| 80 #if OS(WIN) | 78 #if OS(WIN) |
| 81 // FIXME: Does this even work inside the sandbox? | 79 // FIXME: Does this even work inside the sandbox? |
| 82 return GetKeyState(VK_CAPITAL) & 1; | 80 return GetKeyState(VK_CAPITAL) & 1; |
| 83 #elif OS(MACOSX) | 81 #elif OS(MACOSX) |
| 84 return GetCurrentKeyModifiers() & alphaLock; | 82 return GetCurrentKeyModifiers() & alphaLock; |
| 85 #else | 83 #else |
| 86 notImplemented(); | 84 NOTIMPLEMENTED(); |
| 87 return false; | 85 return false; |
| 88 #endif | 86 #endif |
| 89 case OverrideCapsLockState::On: | 87 case OverrideCapsLockState::On: |
| 90 return true; | 88 return true; |
| 91 case OverrideCapsLockState::Off: | 89 case OverrideCapsLockState::Off: |
| 92 default: | 90 default: |
| 93 return false; | 91 return false; |
| 94 } | 92 } |
| 95 } | 93 } |
| 96 | 94 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 109 if (currentModifiers & ::shiftKey) | 107 if (currentModifiers & ::shiftKey) |
| 110 modifiers |= ShiftKey; | 108 modifiers |= ShiftKey; |
| 111 if (currentModifiers & ::controlKey) | 109 if (currentModifiers & ::controlKey) |
| 112 modifiers |= CtrlKey; | 110 modifiers |= CtrlKey; |
| 113 if (currentModifiers & ::optionKey) | 111 if (currentModifiers & ::optionKey) |
| 114 modifiers |= AltKey; | 112 modifiers |= AltKey; |
| 115 if (currentModifiers & ::cmdKey) | 113 if (currentModifiers & ::cmdKey) |
| 116 modifiers |= MetaKey; | 114 modifiers |= MetaKey; |
| 117 #else | 115 #else |
| 118 // See https://crbug.com/538289 | 116 // See https://crbug.com/538289 |
| 119 notImplemented(); | 117 NOTIMPLEMENTED(); |
| 120 #endif | 118 #endif |
| 121 return static_cast<Modifiers>(modifiers); | 119 return static_cast<Modifiers>(modifiers); |
| 122 } | 120 } |
| 123 | 121 |
| 124 } // namespace blink | 122 } // namespace blink |
| OLD | NEW |