Ejemplo n.º 1
0
KeyboardEvent::KeyboardEvent(const AtomicString& eventType, const KeyboardEventInit& initializer)
    : UIEventWithKeyState(eventType, initializer)
    , m_keyIdentifier(initializer.keyIdentifier())
    , m_location(initializer.location())
{
    if (initializer.repeat())
        m_modifiers |= PlatformEvent::IsAutoRepeat;
    initLocationModifiers(initializer.location());
}
Ejemplo n.º 2
0
KeyboardEvent::KeyboardEvent(const AtomicString& eventType, bool canBubble, bool cancelable, AbstractView* view,
    const String& keyIdentifier, const String& code, const String& key, unsigned location, PlatformEvent::Modifiers modifiers)
    : UIEventWithKeyState(eventType, canBubble, cancelable, view, 0, modifiers, InputDeviceCapabilities::doesntFireTouchEventsSourceCapabilities())
    , m_keyIdentifier(keyIdentifier)
    , m_code(code)
    , m_key(key)
    , m_location(location)
{
    initLocationModifiers(location);
}
Ejemplo n.º 3
0
KeyboardEvent::KeyboardEvent(const PlatformKeyboardEvent& key, AbstractView* view)
    : UIEventWithKeyState(eventTypeForKeyboardEventType(key.type()), true, true, view, 0, key.modifiers(), InputDeviceCapabilities::doesntFireTouchEventsSourceCapabilities())
    , m_keyEvent(adoptPtr(new PlatformKeyboardEvent(key)))
    , m_keyIdentifier(key.keyIdentifier())
    , m_code(key.code())
    , m_key(key.key())
    , m_location(keyLocationCode(key))
{
    setPlatformTimeStamp(key.timestamp());
    initLocationModifiers(m_location);
}
Ejemplo n.º 4
0
void KeyboardEvent::initKeyboardEvent(ScriptState* scriptState, const AtomicString& type, bool canBubble, bool cancelable, AbstractView* view,
    const String& keyIdentifier, unsigned location, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
{
    if (dispatched())
        return;

    if (scriptState->world().isIsolatedWorld())
        UIEventWithKeyState::didCreateEventInIsolatedWorld(ctrlKey, altKey, shiftKey, metaKey);

    initUIEvent(type, canBubble, cancelable, view, 0);

    m_keyIdentifier = keyIdentifier;
    m_location = location;
    initModifiers(ctrlKey, altKey, shiftKey, metaKey);
    initLocationModifiers(location);
}
Ejemplo n.º 5
0
KeyboardEvent::KeyboardEvent(const WebKeyboardEvent& key,
                             LocalDOMWindow* domWindow)
    : UIEventWithKeyState(
          eventTypeForKeyboardEventType(key.type),
          true,
          true,
          domWindow,
          0,
          static_cast<PlatformEvent::Modifiers>(key.modifiers),
          key.timeStampSeconds,
          InputDeviceCapabilities::doesntFireTouchEventsSourceCapabilities()),
      m_keyEvent(WTF::makeUnique<WebKeyboardEvent>(key)),
      // TODO(crbug.com/482880): Fix this initialization to lazy initialization.
      m_code(Platform::current()->domCodeStringFromEnum(key.domCode)),
      m_key(Platform::current()->domKeyStringFromEnum(key.domKey)),
      m_location(keyLocationCode(key)),
      m_isComposing(hasCurrentComposition(domWindow)) {
  initLocationModifiers(m_location);
}