| 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" |
| 33 #endif | 35 #endif |
| 34 | 36 |
| 35 namespace blink { | 37 namespace blink { |
| 36 | 38 |
| 37 #if OS(WIN) | 39 #if OS(WIN) |
| 38 static const unsigned short HIGHBITMASKSHORT = 0x8000; | 40 static const unsigned short HIGHBITMASKSHORT = 0x8000; |
| 39 #endif | 41 #endif |
| 40 | 42 |
| 41 PlatformKeyboardEvent::OverrideCapsLockState PlatformKeyboardEvent::s_overrideCa
psLockState = | 43 PlatformKeyboardEvent::OverrideCapsLockState PlatformKeyboardEvent::s_overrideCa
psLockState = |
| 42 PlatformKeyboardEvent::OverrideCapsLockState::Default; | 44 PlatformKeyboardEvent::OverrideCapsLockState::Default; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 bool PlatformKeyboardEvent::currentCapsLockState() | 76 bool PlatformKeyboardEvent::currentCapsLockState() |
| 75 { | 77 { |
| 76 switch (s_overrideCapsLockState) { | 78 switch (s_overrideCapsLockState) { |
| 77 case OverrideCapsLockState::Default: | 79 case OverrideCapsLockState::Default: |
| 78 #if OS(WIN) | 80 #if OS(WIN) |
| 79 // FIXME: Does this even work inside the sandbox? | 81 // FIXME: Does this even work inside the sandbox? |
| 80 return GetKeyState(VK_CAPITAL) & 1; | 82 return GetKeyState(VK_CAPITAL) & 1; |
| 81 #elif OS(MACOSX) | 83 #elif OS(MACOSX) |
| 82 return GetCurrentKeyModifiers() & alphaLock; | 84 return GetCurrentKeyModifiers() & alphaLock; |
| 83 #else | 85 #else |
| 84 NOTIMPLEMENTED(); | 86 notImplemented(); |
| 85 return false; | 87 return false; |
| 86 #endif | 88 #endif |
| 87 case OverrideCapsLockState::On: | 89 case OverrideCapsLockState::On: |
| 88 return true; | 90 return true; |
| 89 case OverrideCapsLockState::Off: | 91 case OverrideCapsLockState::Off: |
| 90 default: | 92 default: |
| 91 return false; | 93 return false; |
| 92 } | 94 } |
| 93 } | 95 } |
| 94 | 96 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 107 if (currentModifiers & ::shiftKey) | 109 if (currentModifiers & ::shiftKey) |
| 108 modifiers |= ShiftKey; | 110 modifiers |= ShiftKey; |
| 109 if (currentModifiers & ::controlKey) | 111 if (currentModifiers & ::controlKey) |
| 110 modifiers |= CtrlKey; | 112 modifiers |= CtrlKey; |
| 111 if (currentModifiers & ::optionKey) | 113 if (currentModifiers & ::optionKey) |
| 112 modifiers |= AltKey; | 114 modifiers |= AltKey; |
| 113 if (currentModifiers & ::cmdKey) | 115 if (currentModifiers & ::cmdKey) |
| 114 modifiers |= MetaKey; | 116 modifiers |= MetaKey; |
| 115 #else | 117 #else |
| 116 // See https://crbug.com/538289 | 118 // See https://crbug.com/538289 |
| 117 NOTIMPLEMENTED(); | 119 notImplemented(); |
| 118 #endif | 120 #endif |
| 119 return static_cast<Modifiers>(modifiers); | 121 return static_cast<Modifiers>(modifiers); |
| 120 } | 122 } |
| 121 | 123 |
| 122 } // namespace blink | 124 } // namespace blink |
| OLD | NEW |