| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2001 Peter Kelly (pmk@post.com) | 2 * Copyright (C) 2001 Peter Kelly (pmk@post.com) |
| 3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) | 3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) |
| 4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv
ed. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv
ed. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 class CORE_EXPORT KeyboardEvent final : public UIEventWithKeyState { | 37 class CORE_EXPORT KeyboardEvent final : public UIEventWithKeyState { |
| 38 DEFINE_WRAPPERTYPEINFO(); | 38 DEFINE_WRAPPERTYPEINFO(); |
| 39 public: | 39 public: |
| 40 enum KeyLocationCode { | 40 enum KeyLocationCode { |
| 41 DOM_KEY_LOCATION_STANDARD = 0x00, | 41 DOM_KEY_LOCATION_STANDARD = 0x00, |
| 42 DOM_KEY_LOCATION_LEFT = 0x01, | 42 DOM_KEY_LOCATION_LEFT = 0x01, |
| 43 DOM_KEY_LOCATION_RIGHT = 0x02, | 43 DOM_KEY_LOCATION_RIGHT = 0x02, |
| 44 DOM_KEY_LOCATION_NUMPAD = 0x03 | 44 DOM_KEY_LOCATION_NUMPAD = 0x03 |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 static PassRefPtrWillBeRawPtr<KeyboardEvent> create() | 47 static RawPtr<KeyboardEvent> create() |
| 48 { | 48 { |
| 49 return adoptRefWillBeNoop(new KeyboardEvent); | 49 return (new KeyboardEvent); |
| 50 } | 50 } |
| 51 | 51 |
| 52 static PassRefPtrWillBeRawPtr<KeyboardEvent> create(const PlatformKeyboardEv
ent& platformEvent, AbstractView* view) | 52 static RawPtr<KeyboardEvent> create(const PlatformKeyboardEvent& platformEve
nt, AbstractView* view) |
| 53 { | 53 { |
| 54 return adoptRefWillBeNoop(new KeyboardEvent(platformEvent, view)); | 54 return (new KeyboardEvent(platformEvent, view)); |
| 55 } | 55 } |
| 56 | 56 |
| 57 static PassRefPtrWillBeRawPtr<KeyboardEvent> create(ScriptState*, const Atom
icString& type, const KeyboardEventInit&); | 57 static RawPtr<KeyboardEvent> create(ScriptState*, const AtomicString& type,
const KeyboardEventInit&); |
| 58 | 58 |
| 59 static PassRefPtrWillBeRawPtr<KeyboardEvent> create(const AtomicString& type
, bool canBubble, bool cancelable, AbstractView* view, | 59 static RawPtr<KeyboardEvent> create(const AtomicString& type, bool canBubble
, bool cancelable, AbstractView* view, |
| 60 const String& keyIdentifier, const String& code, const String& key, unsi
gned location, | 60 const String& keyIdentifier, const String& code, const String& key, unsi
gned location, |
| 61 PlatformEvent::Modifiers modifiers, double platformTimeStamp) | 61 PlatformEvent::Modifiers modifiers, double platformTimeStamp) |
| 62 { | 62 { |
| 63 return adoptRefWillBeNoop(new KeyboardEvent(type, canBubble, cancelable,
view, keyIdentifier, code, key, location, | 63 return (new KeyboardEvent(type, canBubble, cancelable, view, keyIdentifi
er, code, key, location, |
| 64 modifiers, platformTimeStamp)); | 64 modifiers, platformTimeStamp)); |
| 65 } | 65 } |
| 66 | 66 |
| 67 ~KeyboardEvent() override; | 67 ~KeyboardEvent() override; |
| 68 | 68 |
| 69 void initKeyboardEvent(ScriptState*, const AtomicString& type, bool canBubbl
e, bool cancelable, AbstractView*, | 69 void initKeyboardEvent(ScriptState*, const AtomicString& type, bool canBubbl
e, bool cancelable, AbstractView*, |
| 70 const String& keyIdentifier, unsigned location, | 70 const String& keyIdentifier, unsigned location, |
| 71 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); | 71 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); |
| 72 | 72 |
| 73 const String& keyIdentifier() const { return m_keyIdentifier; } | 73 const String& keyIdentifier() const { return m_keyIdentifier; } |
| 74 const String& code() const { return m_code; } | 74 const String& code() const { return m_code; } |
| 75 const String& key() const { return m_key; } | 75 const String& key() const { return m_key; } |
| 76 | 76 |
| 77 unsigned location() const { return m_location; } | 77 unsigned location() const { return m_location; } |
| 78 | 78 |
| 79 const PlatformKeyboardEvent* keyEvent() const { return m_keyEvent.get(); } | 79 const PlatformKeyboardEvent* keyEvent() const { return m_keyEvent.get(); } |
| 80 | 80 |
| 81 int keyCode() const; // key code for keydown and keyup, character for keypre
ss | 81 int keyCode() const; // key code for keydown and keyup, character for keypre
ss |
| 82 int charCode() const; // character code for keypress, 0 for keydown and keyu
p | 82 int charCode() const; // character code for keypress, 0 for keydown and keyu
p |
| 83 bool repeat() const { return modifiers() & PlatformEvent::IsAutoRepeat; } | 83 bool repeat() const { return modifiers() & PlatformEvent::IsAutoRepeat; } |
| 84 | 84 |
| 85 const AtomicString& interfaceName() const override; | 85 const AtomicString& interfaceName() const override; |
| 86 bool isKeyboardEvent() const override; | 86 bool isKeyboardEvent() const override; |
| 87 int which() const override; | 87 int which() const override; |
| 88 | 88 |
| 89 PassRefPtrWillBeRawPtr<EventDispatchMediator> createMediator() override; | 89 RawPtr<EventDispatchMediator> createMediator() override; |
| 90 | 90 |
| 91 DECLARE_VIRTUAL_TRACE(); | 91 DECLARE_VIRTUAL_TRACE(); |
| 92 | 92 |
| 93 private: | 93 private: |
| 94 KeyboardEvent(); | 94 KeyboardEvent(); |
| 95 KeyboardEvent(const PlatformKeyboardEvent&, AbstractView*); | 95 KeyboardEvent(const PlatformKeyboardEvent&, AbstractView*); |
| 96 KeyboardEvent(const AtomicString&, const KeyboardEventInit&); | 96 KeyboardEvent(const AtomicString&, const KeyboardEventInit&); |
| 97 KeyboardEvent(const AtomicString& type, bool canBubble, bool cancelable, Abs
tractView*, | 97 KeyboardEvent(const AtomicString& type, bool canBubble, bool cancelable, Abs
tractView*, |
| 98 const String& keyIdentifier, const String& code, const String& key, unsi
gned location, | 98 const String& keyIdentifier, const String& code, const String& key, unsi
gned location, |
| 99 PlatformEvent::Modifiers, double platformTimeStamp); | 99 PlatformEvent::Modifiers, double platformTimeStamp); |
| 100 | 100 |
| 101 void initLocationModifiers(unsigned location); | 101 void initLocationModifiers(unsigned location); |
| 102 | 102 |
| 103 OwnPtr<PlatformKeyboardEvent> m_keyEvent; | 103 OwnPtr<PlatformKeyboardEvent> m_keyEvent; |
| 104 String m_keyIdentifier; | 104 String m_keyIdentifier; |
| 105 String m_code; | 105 String m_code; |
| 106 String m_key; | 106 String m_key; |
| 107 unsigned m_location; | 107 unsigned m_location; |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 class KeyboardEventDispatchMediator : public EventDispatchMediator { | 110 class KeyboardEventDispatchMediator : public EventDispatchMediator { |
| 111 public: | 111 public: |
| 112 static PassRefPtrWillBeRawPtr<KeyboardEventDispatchMediator> create(PassRefP
trWillBeRawPtr<KeyboardEvent>); | 112 static RawPtr<KeyboardEventDispatchMediator> create(RawPtr<KeyboardEvent>); |
| 113 private: | 113 private: |
| 114 explicit KeyboardEventDispatchMediator(PassRefPtrWillBeRawPtr<KeyboardEvent>
); | 114 explicit KeyboardEventDispatchMediator(RawPtr<KeyboardEvent>); |
| 115 bool dispatchEvent(EventDispatcher&) const override; | 115 bool dispatchEvent(EventDispatcher&) const override; |
| 116 }; | 116 }; |
| 117 | 117 |
| 118 DEFINE_EVENT_TYPE_CASTS(KeyboardEvent); | 118 DEFINE_EVENT_TYPE_CASTS(KeyboardEvent); |
| 119 | 119 |
| 120 } // namespace blink | 120 } // namespace blink |
| 121 | 121 |
| 122 #endif // KeyboardEvent_h | 122 #endif // KeyboardEvent_h |
| OLD | NEW |