| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 } | 50 } |
| 51 | 51 |
| 52 static PassRefPtrWillBeRawPtr<KeyboardEvent> create(const PlatformKeyboardEv
ent& platformEvent, AbstractView* view) | 52 static PassRefPtrWillBeRawPtr<KeyboardEvent> create(const PlatformKeyboardEv
ent& platformEvent, AbstractView* view) |
| 53 { | 53 { |
| 54 return adoptRefWillBeNoop(new KeyboardEvent(platformEvent, view)); | 54 return adoptRefWillBeNoop(new KeyboardEvent(platformEvent, view)); |
| 55 } | 55 } |
| 56 | 56 |
| 57 static PassRefPtrWillBeRawPtr<KeyboardEvent> create(ScriptState*, const Atom
icString& type, const KeyboardEventInit&); | 57 static PassRefPtrWillBeRawPtr<KeyboardEvent> create(ScriptState*, const Atom
icString& type, const KeyboardEventInit&); |
| 58 | 58 |
| 59 static PassRefPtrWillBeRawPtr<KeyboardEvent> create(const AtomicString& type
, bool canBubble, bool cancelable, AbstractView* view, | 59 static PassRefPtrWillBeRawPtr<KeyboardEvent> create(const AtomicString& type
, bool canBubble, bool cancelable, AbstractView* view, |
| 60 const String& keyIdentifier, const String& code, unsigned location, | 60 const String& keyIdentifier, const String& code, const String& key, unsi
gned location, |
| 61 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey) | 61 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey) |
| 62 { | 62 { |
| 63 return adoptRefWillBeNoop(new KeyboardEvent(type, canBubble, cancelable,
view, keyIdentifier, code, location, | 63 return adoptRefWillBeNoop(new KeyboardEvent(type, canBubble, cancelable,
view, keyIdentifier, code, key, location, |
| 64 ctrlKey, altKey, shiftKey, metaKey)); | 64 ctrlKey, altKey, shiftKey, metaKey)); |
| 65 } | 65 } |
| 66 | 66 |
| 67 virtual ~KeyboardEvent(); | 67 virtual ~KeyboardEvent(); |
| 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 | 76 |
| 76 unsigned location() const { return m_location; } | 77 unsigned location() const { return m_location; } |
| 77 | 78 |
| 78 bool getModifierState(const String& keyIdentifier) const; | 79 bool getModifierState(const String& keyIdentifier) const; |
| 79 | 80 |
| 80 const PlatformKeyboardEvent* keyEvent() const { return m_keyEvent.get(); } | 81 const PlatformKeyboardEvent* keyEvent() const { return m_keyEvent.get(); } |
| 81 | 82 |
| 82 virtual int keyCode() const override; // key code for keydown and keyup, cha
racter for keypress | 83 virtual int keyCode() const override; // key code for keydown and keyup, cha
racter for keypress |
| 83 virtual int charCode() const override; // character code for keypress, 0 for
keydown and keyup | 84 virtual int charCode() const override; // character code for keypress, 0 for
keydown and keyup |
| 84 bool repeat() const { return m_isAutoRepeat; } | 85 bool repeat() const { return m_isAutoRepeat; } |
| 85 | 86 |
| 86 virtual const AtomicString& interfaceName() const override; | 87 virtual const AtomicString& interfaceName() const override; |
| 87 virtual bool isKeyboardEvent() const override; | 88 virtual bool isKeyboardEvent() const override; |
| 88 virtual int which() const override; | 89 virtual int which() const override; |
| 89 | 90 |
| 90 DECLARE_VIRTUAL_TRACE(); | 91 DECLARE_VIRTUAL_TRACE(); |
| 91 | 92 |
| 92 private: | 93 private: |
| 93 KeyboardEvent(); | 94 KeyboardEvent(); |
| 94 KeyboardEvent(const PlatformKeyboardEvent&, AbstractView*); | 95 KeyboardEvent(const PlatformKeyboardEvent&, AbstractView*); |
| 95 KeyboardEvent(const AtomicString&, const KeyboardEventInit&); | 96 KeyboardEvent(const AtomicString&, const KeyboardEventInit&); |
| 96 KeyboardEvent(const AtomicString& type, bool canBubble, bool cancelable, Abs
tractView*, | 97 KeyboardEvent(const AtomicString& type, bool canBubble, bool cancelable, Abs
tractView*, |
| 97 const String& keyIdentifier, const String& code, unsigned location, | 98 const String& keyIdentifier, const String& code, const String& key, unsi
gned location, |
| 98 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); | 99 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); |
| 99 | 100 |
| 100 OwnPtr<PlatformKeyboardEvent> m_keyEvent; | 101 OwnPtr<PlatformKeyboardEvent> m_keyEvent; |
| 101 String m_keyIdentifier; | 102 String m_keyIdentifier; |
| 102 String m_code; | 103 String m_code; |
| 104 String m_key; |
| 103 unsigned m_location; | 105 unsigned m_location; |
| 104 bool m_isAutoRepeat : 1; | 106 bool m_isAutoRepeat : 1; |
| 105 }; | 107 }; |
| 106 | 108 |
| 107 class KeyboardEventDispatchMediator : public EventDispatchMediator { | 109 class KeyboardEventDispatchMediator : public EventDispatchMediator { |
| 108 public: | 110 public: |
| 109 static PassRefPtrWillBeRawPtr<KeyboardEventDispatchMediator> create(PassRefP
trWillBeRawPtr<KeyboardEvent>); | 111 static PassRefPtrWillBeRawPtr<KeyboardEventDispatchMediator> create(PassRefP
trWillBeRawPtr<KeyboardEvent>); |
| 110 private: | 112 private: |
| 111 explicit KeyboardEventDispatchMediator(PassRefPtrWillBeRawPtr<KeyboardEvent>
); | 113 explicit KeyboardEventDispatchMediator(PassRefPtrWillBeRawPtr<KeyboardEvent>
); |
| 112 virtual bool dispatchEvent(EventDispatcher&) const override; | 114 virtual bool dispatchEvent(EventDispatcher&) const override; |
| 113 }; | 115 }; |
| 114 | 116 |
| 115 DEFINE_EVENT_TYPE_CASTS(KeyboardEvent); | 117 DEFINE_EVENT_TYPE_CASTS(KeyboardEvent); |
| 116 | 118 |
| 117 } // namespace blink | 119 } // namespace blink |
| 118 | 120 |
| 119 #endif // KeyboardEvent_h | 121 #endif // KeyboardEvent_h |
| OLD | NEW |