| 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 19 matching lines...) Expand all Loading... |
| 30 namespace blink { | 30 namespace blink { |
| 31 | 31 |
| 32 class EventDispatcher; | 32 class EventDispatcher; |
| 33 class Node; | 33 class Node; |
| 34 class PlatformKeyboardEvent; | 34 class PlatformKeyboardEvent; |
| 35 | 35 |
| 36 struct KeyboardEventInit : public UIEventInit { | 36 struct KeyboardEventInit : public UIEventInit { |
| 37 KeyboardEventInit(); | 37 KeyboardEventInit(); |
| 38 | 38 |
| 39 String keyIdentifier; | 39 String keyIdentifier; |
| 40 String code; |
| 40 unsigned location; | 41 unsigned location; |
| 41 bool ctrlKey; | 42 bool ctrlKey; |
| 42 bool altKey; | 43 bool altKey; |
| 43 bool shiftKey; | 44 bool shiftKey; |
| 44 bool metaKey; | 45 bool metaKey; |
| 45 bool repeat; | 46 bool repeat; |
| 46 }; | 47 }; |
| 47 | 48 |
| 48 class KeyboardEvent final : public UIEventWithKeyState { | 49 class KeyboardEvent final : public UIEventWithKeyState { |
| 49 DEFINE_WRAPPERTYPEINFO(); | 50 DEFINE_WRAPPERTYPEINFO(); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 78 ctrlKey, altKey, shiftKey, metaKey)); | 79 ctrlKey, altKey, shiftKey, metaKey)); |
| 79 } | 80 } |
| 80 | 81 |
| 81 virtual ~KeyboardEvent(); | 82 virtual ~KeyboardEvent(); |
| 82 | 83 |
| 83 void initKeyboardEvent(const AtomicString& type, bool canBubble, bool cancel
able, AbstractView*, | 84 void initKeyboardEvent(const AtomicString& type, bool canBubble, bool cancel
able, AbstractView*, |
| 84 const String& keyIdentifier, unsigned location, | 85 const String& keyIdentifier, unsigned location, |
| 85 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); | 86 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); |
| 86 | 87 |
| 87 const String& keyIdentifier() const { return m_keyIdentifier; } | 88 const String& keyIdentifier() const { return m_keyIdentifier; } |
| 89 const String& code() { return m_code; }; |
| 90 |
| 88 unsigned location() const { return m_location; } | 91 unsigned location() const { return m_location; } |
| 89 | 92 |
| 90 bool getModifierState(const String& keyIdentifier) const; | 93 bool getModifierState(const String& keyIdentifier) const; |
| 91 | 94 |
| 92 const PlatformKeyboardEvent* keyEvent() const { return m_keyEvent.get(); } | 95 const PlatformKeyboardEvent* keyEvent() const { return m_keyEvent.get(); } |
| 93 | 96 |
| 94 virtual int keyCode() const override; // key code for keydown and keyup, cha
racter for keypress | 97 virtual int keyCode() const override; // key code for keydown and keyup, cha
racter for keypress |
| 95 virtual int charCode() const override; // character code for keypress, 0 for
keydown and keyup | 98 virtual int charCode() const override; // character code for keypress, 0 for
keydown and keyup |
| 96 bool repeat() const { return m_isAutoRepeat; } | 99 bool repeat() const { return m_isAutoRepeat; } |
| 97 | 100 |
| 98 virtual const AtomicString& interfaceName() const override; | 101 virtual const AtomicString& interfaceName() const override; |
| 99 virtual bool isKeyboardEvent() const override; | 102 virtual bool isKeyboardEvent() const override; |
| 100 virtual int which() const override; | 103 virtual int which() const override; |
| 101 | 104 |
| 102 virtual void trace(Visitor*) override; | 105 virtual void trace(Visitor*) override; |
| 103 | 106 |
| 104 private: | 107 private: |
| 105 KeyboardEvent(); | 108 KeyboardEvent(); |
| 106 KeyboardEvent(const PlatformKeyboardEvent&, AbstractView*); | 109 KeyboardEvent(const PlatformKeyboardEvent&, AbstractView*); |
| 107 KeyboardEvent(const AtomicString&, const KeyboardEventInit&); | 110 KeyboardEvent(const AtomicString&, const KeyboardEventInit&); |
| 108 KeyboardEvent(const AtomicString& type, bool canBubble, bool cancelable, Abs
tractView*, | 111 KeyboardEvent(const AtomicString& type, bool canBubble, bool cancelable, Abs
tractView*, |
| 109 const String& keyIdentifier, unsigned location, | 112 const String& keyIdentifier, unsigned location, |
| 110 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); | 113 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); |
| 111 | 114 |
| 112 OwnPtr<PlatformKeyboardEvent> m_keyEvent; | 115 OwnPtr<PlatformKeyboardEvent> m_keyEvent; |
| 113 String m_keyIdentifier; | 116 String m_keyIdentifier; |
| 114 unsigned m_location; | 117 unsigned m_location; |
| 115 bool m_isAutoRepeat : 1; | 118 bool m_isAutoRepeat : 1; |
| 119 String m_code; |
| 116 }; | 120 }; |
| 117 | 121 |
| 118 class KeyboardEventDispatchMediator : public EventDispatchMediator { | 122 class KeyboardEventDispatchMediator : public EventDispatchMediator { |
| 119 public: | 123 public: |
| 120 static PassRefPtrWillBeRawPtr<KeyboardEventDispatchMediator> create(PassRefP
trWillBeRawPtr<KeyboardEvent>); | 124 static PassRefPtrWillBeRawPtr<KeyboardEventDispatchMediator> create(PassRefP
trWillBeRawPtr<KeyboardEvent>); |
| 121 private: | 125 private: |
| 122 explicit KeyboardEventDispatchMediator(PassRefPtrWillBeRawPtr<KeyboardEvent>
); | 126 explicit KeyboardEventDispatchMediator(PassRefPtrWillBeRawPtr<KeyboardEvent>
); |
| 123 virtual bool dispatchEvent(EventDispatcher*) const override; | 127 virtual bool dispatchEvent(EventDispatcher*) const override; |
| 124 }; | 128 }; |
| 125 | 129 |
| 126 DEFINE_EVENT_TYPE_CASTS(KeyboardEvent); | 130 DEFINE_EVENT_TYPE_CASTS(KeyboardEvent); |
| 127 | 131 |
| 128 } // namespace blink | 132 } // namespace blink |
| 129 | 133 |
| 130 #endif // KeyboardEvent_h | 134 #endif // KeyboardEvent_h |
| OLD | NEW |