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