PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder(const WebKeyboardEvent& e) { m_type = toPlatformKeyboardEventType(e.type); m_text = String(e.text); m_unmodifiedText = String(e.unmodifiedText); m_keyIdentifier = String(e.keyIdentifier); m_nativeVirtualKeyCode = e.nativeKeyCode; m_isSystemKey = e.isSystemKey; // TODO: BUG482880 Fix this initialization to lazy initialization. m_code = Platform::current()->domCodeStringFromEnum(e.domCode); m_key = Platform::current()->domKeyStringFromEnum(e.domKey); m_modifiers = e.modifiers; m_timestamp = e.timeStampSeconds; m_windowsVirtualKeyCode = e.windowsKeyCode; }
PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder(const WebKeyboardEvent& e) { m_type = toPlatformKeyboardEventType(e.type); m_text = String(e.text); m_unmodifiedText = String(e.unmodifiedText); m_keyIdentifier = String(e.keyIdentifier); m_autoRepeat = (e.modifiers & WebInputEvent::IsAutoRepeat); m_nativeVirtualKeyCode = e.nativeKeyCode; m_isKeypad = (e.modifiers & WebInputEvent::IsKeyPad); m_isSystemKey = e.isSystemKey; m_modifiers = 0; if (e.modifiers & WebInputEvent::ShiftKey) m_modifiers |= PlatformEvent::ShiftKey; if (e.modifiers & WebInputEvent::ControlKey) m_modifiers |= PlatformEvent::CtrlKey; if (e.modifiers & WebInputEvent::AltKey) m_modifiers |= PlatformEvent::AltKey; if (e.modifiers & WebInputEvent::MetaKey) m_modifiers |= PlatformEvent::MetaKey; // FIXME: PlatformKeyboardEvents expect a locational version of the keycode (e.g. VK_LSHIFT // instead of VK_SHIFT). This should be changed so the location/keycode are stored separately, // as in other places in the code. m_windowsVirtualKeyCode = e.windowsKeyCode; if (e.windowsKeyCode == VK_SHIFT) { if (e.modifiers & WebInputEvent::IsLeft) m_windowsVirtualKeyCode = VK_LSHIFT; else if (e.modifiers & WebInputEvent::IsRight) m_windowsVirtualKeyCode = VK_RSHIFT; } else if (e.windowsKeyCode == VK_CONTROL) { if (e.modifiers & WebInputEvent::IsLeft) m_windowsVirtualKeyCode = VK_LCONTROL; else if (e.modifiers & WebInputEvent::IsRight) m_windowsVirtualKeyCode = VK_RCONTROL; } else if (e.windowsKeyCode == VK_MENU) { if (e.modifiers & WebInputEvent::IsLeft) m_windowsVirtualKeyCode = VK_LMENU; else if (e.modifiers & WebInputEvent::IsRight) m_windowsVirtualKeyCode = VK_RMENU; } }
PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder(const WebKeyboardEvent& e) { m_type = toPlatformKeyboardEventType(e.type); m_text = String(e.text); m_unmodifiedText = String(e.unmodifiedText); m_keyIdentifier = String(e.keyIdentifier); m_autoRepeat = (e.modifiers & WebInputEvent::IsAutoRepeat); m_windowsVirtualKeyCode = e.windowsKeyCode; m_nativeVirtualKeyCode = e.nativeKeyCode; m_isKeypad = (e.modifiers & WebInputEvent::IsKeyPad); m_isSystemKey = e.isSystemKey; m_modifiers = 0; if (e.modifiers & WebInputEvent::ShiftKey) m_modifiers |= PlatformEvent::ShiftKey; if (e.modifiers & WebInputEvent::ControlKey) m_modifiers |= PlatformEvent::CtrlKey; if (e.modifiers & WebInputEvent::AltKey) m_modifiers |= PlatformEvent::AltKey; if (e.modifiers & WebInputEvent::MetaKey) m_modifiers |= PlatformEvent::MetaKey; }
PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder(const WebKeyboardEvent& e) { m_type = toPlatformKeyboardEventType(e.type); m_text = String(e.text); m_unmodifiedText = String(e.unmodifiedText); m_keyIdentifier = String(e.keyIdentifier); m_autoRepeat = (e.modifiers & WebInputEvent::IsAutoRepeat); m_nativeVirtualKeyCode = e.nativeKeyCode; m_isKeypad = (e.modifiers & WebInputEvent::IsKeyPad); m_isSystemKey = e.isSystemKey; // TODO: BUG482880 Fix this initialization to lazy initialization. m_code = Platform::current()->domCodeStringFromEnum(e.domCode); m_key = Platform::current()->domKeyStringFromEnum(e.domKey); m_modifiers = toPlatformEventModifiers(e.modifiers); // FIXME: PlatformKeyboardEvents expect a locational version of the keycode (e.g. VK_LSHIFT // instead of VK_SHIFT). This should be changed so the location/keycode are stored separately, // as in other places in the code. m_windowsVirtualKeyCode = e.windowsKeyCode; if (e.windowsKeyCode == VK_SHIFT) { if (e.modifiers & WebInputEvent::IsLeft) m_windowsVirtualKeyCode = VK_LSHIFT; else if (e.modifiers & WebInputEvent::IsRight) m_windowsVirtualKeyCode = VK_RSHIFT; } else if (e.windowsKeyCode == VK_CONTROL) { if (e.modifiers & WebInputEvent::IsLeft) m_windowsVirtualKeyCode = VK_LCONTROL; else if (e.modifiers & WebInputEvent::IsRight) m_windowsVirtualKeyCode = VK_RCONTROL; } else if (e.windowsKeyCode == VK_MENU) { if (e.modifiers & WebInputEvent::IsLeft) m_windowsVirtualKeyCode = VK_LMENU; else if (e.modifiers & WebInputEvent::IsRight) m_windowsVirtualKeyCode = VK_RMENU; } }