diff options
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/event_conversion.cc | 5 | ||||
-rw-r--r-- | webkit/port/platform/chromium/PlatformKeyboardEventChromium.cpp | 28 |
2 files changed, 28 insertions, 5 deletions
diff --git a/webkit/glue/event_conversion.cc b/webkit/glue/event_conversion.cc index 517e8c2..a0d3a8d 100644 --- a/webkit/glue/event_conversion.cc +++ b/webkit/glue/event_conversion.cc @@ -110,8 +110,7 @@ MakePlatformMouseEvent::MakePlatformMouseEvent(Widget* widget, // MakePlatformWheelEvent ----------------------------------------------------- MakePlatformWheelEvent::MakePlatformWheelEvent(Widget* widget, - const WebMouseWheelEvent& e) - { + const WebMouseWheelEvent& e) { m_position = widget->convertFromContainingWindow(IntPoint(e.x, e.y)); m_globalPosition = IntPoint(e.global_x, e.global_y); m_deltaX = static_cast<float>(e.delta_x); @@ -256,7 +255,6 @@ static String GetKeyIdentifierForWindowsKeyCode(unsigned short keyCode) { MakePlatformKeyboardEvent::MakePlatformKeyboardEvent(const WebKeyboardEvent& e) { -#if defined(OS_WIN) || defined(OS_LINUX) m_type = ToPlatformKeyboardEventType(e.type); if (m_type == Char || m_type == KeyDown) m_text = m_unmodifiedText = ToSingleCharacterString(e.key_code); @@ -268,7 +266,6 @@ MakePlatformKeyboardEvent::MakePlatformKeyboardEvent(const WebKeyboardEvent& e) } else { m_windowsVirtualKeyCode = 0; } -#endif m_autoRepeat = (e.modifiers & WebInputEvent::IS_AUTO_REPEAT) != 0; m_isKeypad = (e.modifiers & WebInputEvent::IS_KEYPAD) != 0; m_shiftKey = (e.modifiers & WebInputEvent::SHIFT_KEY) != 0; diff --git a/webkit/port/platform/chromium/PlatformKeyboardEventChromium.cpp b/webkit/port/platform/chromium/PlatformKeyboardEventChromium.cpp index 06d096d..70dd4f4 100644 --- a/webkit/port/platform/chromium/PlatformKeyboardEventChromium.cpp +++ b/webkit/port/platform/chromium/PlatformKeyboardEventChromium.cpp @@ -28,17 +28,41 @@ #if PLATFORM(WIN_OS) #include <windows.h> +#elif PLATFORM(DARWIN) +#import <Carbon/Carbon.h> #else #include "NotImplemented.h" #endif namespace WebCore { -void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type, bool) +void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type type, bool backwardCompatibilityMode) { #if PLATFORM(WIN_OS) // No KeyDown events on Windows to disambiguate. ASSERT_NOT_REACHED(); +#elif PLATFORM(DARWIN) + // Can only change type from KeyDown to RawKeyDown or Char, as we lack information for other conversions. + ASSERT(m_type == KeyDown); + ASSERT(type == RawKeyDown || type == Char); + m_type = type; + if (backwardCompatibilityMode) + return; + + if (type == RawKeyDown) { + m_text = String(); + m_unmodifiedText = String(); + } else { + m_keyIdentifier = String(); + m_windowsVirtualKeyCode = 0; + if (m_text.length() == 1 && (m_text[0U] >= 0xF700 && m_text[0U] <= 0xF7FF)) { + // According to NSEvents.h, OpenStep reserves the range 0xF700-0xF8FF for function keys. However, some actual private use characters + // happen to be in this range, e.g. the Apple logo (Option+Shift+K). + // 0xF7FF is an arbitrary cut-off. + m_text = String(); + m_unmodifiedText = String(); + } + } #endif } @@ -47,6 +71,8 @@ bool PlatformKeyboardEvent::currentCapsLockState() #if PLATFORM(WIN_OS) // TODO(darin): does this even work inside the sandbox? return GetKeyState(VK_CAPITAL) & 1; +#elif PLATFORM(DARWIN) + return GetCurrentKeyModifiers() & alphaLock; #else notImplemented(); return false; |