| 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 24 matching lines...) Expand all Loading... |
| 35 #include "NotImplemented.h" | 35 #include "NotImplemented.h" |
| 36 #endif | 36 #endif |
| 37 | 37 |
| 38 namespace WebCore { | 38 namespace WebCore { |
| 39 | 39 |
| 40 void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type type, bool backwardCom
patibilityMode) | 40 void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type type, bool backwardCom
patibilityMode) |
| 41 { | 41 { |
| 42 #if PLATFORM(WIN_OS) | 42 #if PLATFORM(WIN_OS) |
| 43 // No KeyDown events on Windows to disambiguate. | 43 // No KeyDown events on Windows to disambiguate. |
| 44 ASSERT_NOT_REACHED(); | 44 ASSERT_NOT_REACHED(); |
| 45 #elif PLATFORM(DARWIN) | 45 #else |
| 46 // Can only change type from KeyDown to RawKeyDown or Char, as we lack infor
mation for other conversions. | 46 // Can only change type from KeyDown to RawKeyDown or Char, as we lack infor
mation for other conversions. |
| 47 ASSERT(m_type == KeyDown); | 47 ASSERT(m_type == KeyDown); |
| 48 ASSERT(type == RawKeyDown || type == Char); | 48 ASSERT(type == RawKeyDown || type == Char); |
| 49 m_type = type; | 49 m_type = type; |
| 50 if (backwardCompatibilityMode) | 50 if (backwardCompatibilityMode) |
| 51 return; | 51 return; |
| 52 | 52 |
| 53 if (type == RawKeyDown) { | 53 if (type == RawKeyDown) { |
| 54 m_text = String(); | 54 m_text = String(); |
| 55 m_unmodifiedText = String(); | 55 m_unmodifiedText = String(); |
| 56 } else { | 56 } else { |
| 57 m_keyIdentifier = String(); | 57 m_keyIdentifier = String(); |
| 58 m_windowsVirtualKeyCode = 0; | 58 m_windowsVirtualKeyCode = 0; |
| 59 #if PLATFORM(DARWIN) |
| 59 if (m_text.length() == 1 && (m_text[0U] >= 0xF700 && m_text[0U] <= 0xF7F
F)) { | 60 if (m_text.length() == 1 && (m_text[0U] >= 0xF700 && m_text[0U] <= 0xF7F
F)) { |
| 60 // According to NSEvents.h, OpenStep reserves the range 0xF700-0xF8F
F for function keys. However, some actual private use characters | 61 // According to NSEvents.h, OpenStep reserves the range 0xF700-0xF8F
F for function keys. However, some actual private use characters |
| 61 // happen to be in this range, e.g. the Apple logo (Option+Shift+K). | 62 // happen to be in this range, e.g. the Apple logo (Option+Shift+K). |
| 62 // 0xF7FF is an arbitrary cut-off. | 63 // 0xF7FF is an arbitrary cut-off. |
| 63 m_text = String(); | 64 m_text = String(); |
| 64 m_unmodifiedText = String(); | 65 m_unmodifiedText = String(); |
| 65 } | 66 } |
| 67 #endif |
| 66 } | 68 } |
| 67 #endif | 69 #endif |
| 68 } | 70 } |
| 69 | 71 |
| 70 bool PlatformKeyboardEvent::currentCapsLockState() | 72 bool PlatformKeyboardEvent::currentCapsLockState() |
| 71 { | 73 { |
| 72 #if PLATFORM(WIN_OS) | 74 #if PLATFORM(WIN_OS) |
| 73 // FIXME: Does this even work inside the sandbox? | 75 // FIXME: Does this even work inside the sandbox? |
| 74 return GetKeyState(VK_CAPITAL) & 1; | 76 return GetKeyState(VK_CAPITAL) & 1; |
| 75 #elif PLATFORM(DARWIN) | 77 #elif PLATFORM(DARWIN) |
| 76 return GetCurrentKeyModifiers() & alphaLock; | 78 return GetCurrentKeyModifiers() & alphaLock; |
| 77 #else | 79 #else |
| 78 notImplemented(); | 80 notImplemented(); |
| 79 return false; | 81 return false; |
| 80 #endif | 82 #endif |
| 81 } | 83 } |
| 82 | 84 |
| 83 } // namespace WebCore | 85 } // namespace WebCore |
| OLD | NEW |