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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
46 static PassRefPtrWillBeRawPtr<KeyboardEvent> create() | 46 static PassRefPtrWillBeRawPtr<KeyboardEvent> create() |
47 { | 47 { |
48 return adoptRefWillBeNoop(new KeyboardEvent); | 48 return adoptRefWillBeNoop(new KeyboardEvent); |
49 } | 49 } |
50 | 50 |
51 static PassRefPtrWillBeRawPtr<KeyboardEvent> create(const PlatformKeyboardEv ent& platformEvent, AbstractView* view) | 51 static PassRefPtrWillBeRawPtr<KeyboardEvent> create(const PlatformKeyboardEv ent& platformEvent, AbstractView* view) |
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) |
Wez
2015/03/04 23:00:25
Do we need to update this creator function as well
| |
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, const String& code, unsigned location, | 62 const String& keyIdentifier, const String& code, const String& key, unsi gned 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, code, location, | 65 return adoptRefWillBeNoop(new KeyboardEvent(type, canBubble, cancelable, view, keyIdentifier, code, key, 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; } | 76 const String& code() const { return m_code; } |
77 const String& key() const { return m_key; } | |
77 | 78 |
78 unsigned location() const { return m_location; } | 79 unsigned location() const { return m_location; } |
79 | 80 |
80 bool getModifierState(const String& keyIdentifier) const; | 81 bool getModifierState(const String& keyIdentifier) const; |
81 | 82 |
82 const PlatformKeyboardEvent* keyEvent() const { return m_keyEvent.get(); } | 83 const PlatformKeyboardEvent* keyEvent() const { return m_keyEvent.get(); } |
83 | 84 |
84 virtual int keyCode() const override; // key code for keydown and keyup, cha racter for keypress | 85 virtual int keyCode() const override; // key code for keydown and keyup, cha racter for keypress |
85 virtual int charCode() const override; // character code for keypress, 0 for keydown and keyup | 86 virtual int charCode() const override; // character code for keypress, 0 for keydown and keyup |
86 bool repeat() const { return m_isAutoRepeat; } | 87 bool repeat() const { return m_isAutoRepeat; } |
87 | 88 |
88 virtual const AtomicString& interfaceName() const override; | 89 virtual const AtomicString& interfaceName() const override; |
89 virtual bool isKeyboardEvent() const override; | 90 virtual bool isKeyboardEvent() const override; |
90 virtual int which() const override; | 91 virtual int which() const override; |
91 | 92 |
92 virtual void trace(Visitor*) override; | 93 virtual void trace(Visitor*) override; |
93 | 94 |
94 private: | 95 private: |
95 KeyboardEvent(); | 96 KeyboardEvent(); |
96 KeyboardEvent(const PlatformKeyboardEvent&, AbstractView*); | 97 KeyboardEvent(const PlatformKeyboardEvent&, AbstractView*); |
97 KeyboardEvent(const AtomicString&, const KeyboardEventInit&); | 98 KeyboardEvent(const AtomicString&, const KeyboardEventInit&); |
98 KeyboardEvent(const AtomicString& type, bool canBubble, bool cancelable, Abs tractView*, | 99 KeyboardEvent(const AtomicString& type, bool canBubble, bool cancelable, Abs tractView*, |
99 const String& keyIdentifier, const String& code, unsigned location, | 100 const String& keyIdentifier, const String& code, const String& key, unsi gned location, |
100 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); | 101 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); |
101 | 102 |
102 OwnPtr<PlatformKeyboardEvent> m_keyEvent; | 103 OwnPtr<PlatformKeyboardEvent> m_keyEvent; |
103 String m_keyIdentifier; | 104 String m_keyIdentifier; |
104 String m_code; | 105 String m_code; |
106 String m_key; | |
105 unsigned m_location; | 107 unsigned m_location; |
106 bool m_isAutoRepeat : 1; | 108 bool m_isAutoRepeat : 1; |
107 }; | 109 }; |
108 | 110 |
109 class KeyboardEventDispatchMediator : public EventDispatchMediator { | 111 class KeyboardEventDispatchMediator : public EventDispatchMediator { |
110 public: | 112 public: |
111 static PassRefPtrWillBeRawPtr<KeyboardEventDispatchMediator> create(PassRefP trWillBeRawPtr<KeyboardEvent>); | 113 static PassRefPtrWillBeRawPtr<KeyboardEventDispatchMediator> create(PassRefP trWillBeRawPtr<KeyboardEvent>); |
112 private: | 114 private: |
113 explicit KeyboardEventDispatchMediator(PassRefPtrWillBeRawPtr<KeyboardEvent> ); | 115 explicit KeyboardEventDispatchMediator(PassRefPtrWillBeRawPtr<KeyboardEvent> ); |
114 virtual bool dispatchEvent(EventDispatcher&) const override; | 116 virtual bool dispatchEvent(EventDispatcher&) const override; |
115 }; | 117 }; |
116 | 118 |
117 DEFINE_EVENT_TYPE_CASTS(KeyboardEvent); | 119 DEFINE_EVENT_TYPE_CASTS(KeyboardEvent); |
118 | 120 |
119 } // namespace blink | 121 } // namespace blink |
120 | 122 |
121 #endif // KeyboardEvent_h | 123 #endif // KeyboardEvent_h |
OLD | NEW |