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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 return new KeyboardEvent; | 49 return new KeyboardEvent; |
50 } | 50 } |
51 | 51 |
52 static KeyboardEvent* create(const PlatformKeyboardEvent& platformEvent, Abs
tractView* view) | 52 static KeyboardEvent* create(const PlatformKeyboardEvent& platformEvent, Abs
tractView* view) |
53 { | 53 { |
54 return new KeyboardEvent(platformEvent, view); | 54 return new KeyboardEvent(platformEvent, view); |
55 } | 55 } |
56 | 56 |
57 static KeyboardEvent* create(ScriptState*, const AtomicString& type, const K
eyboardEventInit&); | 57 static KeyboardEvent* create(ScriptState*, const AtomicString& type, const K
eyboardEventInit&); |
58 | 58 |
59 static KeyboardEvent* create(const AtomicString& type, bool canBubble, bool
cancelable, AbstractView* view, | 59 static KeyboardEvent* create(const AtomicString& type, bool canBubble, bool
cancelable, AbstractView* view, const String& code, const String& key, unsigned
location, |
60 const String& keyIdentifier, const String& code, const String& key, unsi
gned location, | |
61 PlatformEvent::Modifiers modifiers, double platformTimeStamp) | 60 PlatformEvent::Modifiers modifiers, double platformTimeStamp) |
62 { | 61 { |
63 return new KeyboardEvent(type, canBubble, cancelable, view, keyIdentifie
r, code, key, location, | 62 return new KeyboardEvent(type, canBubble, cancelable, view, code, key, l
ocation, |
64 modifiers, platformTimeStamp); | 63 modifiers, platformTimeStamp); |
65 } | 64 } |
66 | 65 |
67 ~KeyboardEvent() override; | 66 ~KeyboardEvent() override; |
68 | 67 |
69 void initKeyboardEvent(ScriptState*, const AtomicString& type, bool canBubbl
e, bool cancelable, AbstractView*, | 68 void initKeyboardEvent(ScriptState*, const AtomicString& type, bool canBubbl
e, bool cancelable, AbstractView*, |
70 const String& keyIdentifier, unsigned location, | 69 const String& keyIdentifier, unsigned location, |
71 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); | 70 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); |
72 | 71 |
73 const String& keyIdentifier() const { return m_keyIdentifier; } | |
74 const String& code() const { return m_code; } | 72 const String& code() const { return m_code; } |
75 const String& key() const { return m_key; } | 73 const String& key() const { return m_key; } |
76 | 74 |
77 unsigned location() const { return m_location; } | 75 unsigned location() const { return m_location; } |
78 | 76 |
79 const PlatformKeyboardEvent* keyEvent() const { return m_keyEvent.get(); } | 77 const PlatformKeyboardEvent* keyEvent() const { return m_keyEvent.get(); } |
80 | 78 |
81 int keyCode() const; // key code for keydown and keyup, character for keypre
ss | 79 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 | 80 int charCode() const; // character code for keypress, 0 for keydown and keyu
p |
83 bool repeat() const { return modifiers() & PlatformEvent::IsAutoRepeat; } | 81 bool repeat() const { return modifiers() & PlatformEvent::IsAutoRepeat; } |
84 | 82 |
85 const AtomicString& interfaceName() const override; | 83 const AtomicString& interfaceName() const override; |
86 bool isKeyboardEvent() const override; | 84 bool isKeyboardEvent() const override; |
87 int which() const override; | 85 int which() const override; |
88 | 86 |
89 DECLARE_VIRTUAL_TRACE(); | 87 DECLARE_VIRTUAL_TRACE(); |
90 | 88 |
91 private: | 89 private: |
92 KeyboardEvent(); | 90 KeyboardEvent(); |
93 KeyboardEvent(const PlatformKeyboardEvent&, AbstractView*); | 91 KeyboardEvent(const PlatformKeyboardEvent&, AbstractView*); |
94 KeyboardEvent(const AtomicString&, const KeyboardEventInit&); | 92 KeyboardEvent(const AtomicString&, const KeyboardEventInit&); |
95 KeyboardEvent(const AtomicString& type, bool canBubble, bool cancelable, Abs
tractView*, | 93 KeyboardEvent(const AtomicString& type, bool canBubble, bool cancelable, Abs
tractView*, |
96 const String& keyIdentifier, const String& code, const String& key, unsi
gned location, | 94 const String& code, const String& key, unsigned location, |
97 PlatformEvent::Modifiers, double platformTimeStamp); | 95 PlatformEvent::Modifiers, double platformTimeStamp); |
98 | 96 |
99 void initLocationModifiers(unsigned location); | 97 void initLocationModifiers(unsigned location); |
100 | 98 |
101 std::unique_ptr<PlatformKeyboardEvent> m_keyEvent; | 99 std::unique_ptr<PlatformKeyboardEvent> m_keyEvent; |
102 String m_keyIdentifier; | |
103 String m_code; | 100 String m_code; |
104 String m_key; | 101 String m_key; |
105 unsigned m_location; | 102 unsigned m_location; |
106 }; | 103 }; |
107 | 104 |
108 DEFINE_EVENT_TYPE_CASTS(KeyboardEvent); | 105 DEFINE_EVENT_TYPE_CASTS(KeyboardEvent); |
109 | 106 |
110 } // namespace blink | 107 } // namespace blink |
111 | 108 |
112 #endif // KeyboardEvent_h | 109 #endif // KeyboardEvent_h |
OLD | NEW |