| 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, 2005, 2006, 2007 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2005, 2006, 2007 Apple Inc. All rights reserved. |
| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 } | 68 } |
| 69 | 69 |
| 70 KeyboardEvent::KeyboardEvent() | 70 KeyboardEvent::KeyboardEvent() |
| 71 : m_location(DOM_KEY_LOCATION_STANDARD) | 71 : m_location(DOM_KEY_LOCATION_STANDARD) |
| 72 { | 72 { |
| 73 } | 73 } |
| 74 | 74 |
| 75 KeyboardEvent::KeyboardEvent(const PlatformKeyboardEvent& key, AbstractView* vie
w) | 75 KeyboardEvent::KeyboardEvent(const PlatformKeyboardEvent& key, AbstractView* vie
w) |
| 76 : UIEventWithKeyState(eventTypeForKeyboardEventType(key.type()), true, true,
view, 0, key.getModifiers(), key.timestamp(), InputDeviceCapabilities::doesntFi
reTouchEventsSourceCapabilities()) | 76 : UIEventWithKeyState(eventTypeForKeyboardEventType(key.type()), true, true,
view, 0, key.getModifiers(), key.timestamp(), InputDeviceCapabilities::doesntFi
reTouchEventsSourceCapabilities()) |
| 77 , m_keyEvent(wrapUnique(new PlatformKeyboardEvent(key))) | 77 , m_keyEvent(wrapUnique(new PlatformKeyboardEvent(key))) |
| 78 , m_keyIdentifier(key.keyIdentifier()) | |
| 79 , m_code(key.code()) | 78 , m_code(key.code()) |
| 80 , m_key(key.key()) | 79 , m_key(key.key()) |
| 81 , m_location(keyLocationCode(key)) | 80 , m_location(keyLocationCode(key)) |
| 82 { | 81 { |
| 83 initLocationModifiers(m_location); | 82 initLocationModifiers(m_location); |
| 84 } | 83 } |
| 85 | 84 |
| 86 KeyboardEvent::KeyboardEvent(const AtomicString& eventType, const KeyboardEventI
nit& initializer) | 85 KeyboardEvent::KeyboardEvent(const AtomicString& eventType, const KeyboardEventI
nit& initializer) |
| 87 : UIEventWithKeyState(eventType, initializer) | 86 : UIEventWithKeyState(eventType, initializer) |
| 88 , m_keyIdentifier(initializer.keyIdentifier()) | |
| 89 , m_code(initializer.code()) | 87 , m_code(initializer.code()) |
| 90 , m_key(initializer.key()) | 88 , m_key(initializer.key()) |
| 91 , m_location(initializer.location()) | 89 , m_location(initializer.location()) |
| 92 { | 90 { |
| 93 if (initializer.repeat()) | 91 if (initializer.repeat()) |
| 94 m_modifiers |= PlatformEvent::IsAutoRepeat; | 92 m_modifiers |= PlatformEvent::IsAutoRepeat; |
| 95 initLocationModifiers(initializer.location()); | 93 initLocationModifiers(initializer.location()); |
| 96 } | 94 } |
| 97 | 95 |
| 98 KeyboardEvent::KeyboardEvent(const AtomicString& eventType, bool canBubble, bool
cancelable, AbstractView* view, | 96 KeyboardEvent::KeyboardEvent(const AtomicString& eventType, bool canBubble, bool
cancelable, AbstractView* view, |
| 99 const String& keyIdentifier, const String& code, const String& key, unsigned
location, PlatformEvent::Modifiers modifiers, | 97 const String& code, const String& key, unsigned location, PlatformEvent::Mod
ifiers modifiers, |
| 100 double plaformTimeStamp) | 98 double plaformTimeStamp) |
| 101 : UIEventWithKeyState(eventType, canBubble, cancelable, view, 0, modifiers,
plaformTimeStamp, InputDeviceCapabilities::doesntFireTouchEventsSourceCapabiliti
es()) | 99 : UIEventWithKeyState(eventType, canBubble, cancelable, view, 0, modifiers,
plaformTimeStamp, InputDeviceCapabilities::doesntFireTouchEventsSourceCapabiliti
es()) |
| 102 , m_keyIdentifier(keyIdentifier) | |
| 103 , m_code(code) | 100 , m_code(code) |
| 104 , m_key(key) | 101 , m_key(key) |
| 105 , m_location(location) | 102 , m_location(location) |
| 106 { | 103 { |
| 107 initLocationModifiers(location); | 104 initLocationModifiers(location); |
| 108 } | 105 } |
| 109 | 106 |
| 110 KeyboardEvent::~KeyboardEvent() | 107 KeyboardEvent::~KeyboardEvent() |
| 111 { | 108 { |
| 112 } | 109 } |
| 113 | 110 |
| 114 void KeyboardEvent::initKeyboardEvent(ScriptState* scriptState, const AtomicStri
ng& type, bool canBubble, bool cancelable, AbstractView* view, | 111 void KeyboardEvent::initKeyboardEvent(ScriptState* scriptState, const AtomicStri
ng& type, bool canBubble, bool cancelable, AbstractView* view, |
| 115 const String& keyIdentifier, unsigned location, bool ctrlKey, bool altKey, b
ool shiftKey, bool metaKey) | 112 const String& keyIdentifier, unsigned location, bool ctrlKey, bool altKey, b
ool shiftKey, bool metaKey) |
| 116 { | 113 { |
| 117 if (isBeingDispatched()) | 114 if (isBeingDispatched()) |
| 118 return; | 115 return; |
| 119 | 116 |
| 120 if (scriptState->world().isIsolatedWorld()) | 117 if (scriptState->world().isIsolatedWorld()) |
| 121 UIEventWithKeyState::didCreateEventInIsolatedWorld(ctrlKey, altKey, shif
tKey, metaKey); | 118 UIEventWithKeyState::didCreateEventInIsolatedWorld(ctrlKey, altKey, shif
tKey, metaKey); |
| 122 | 119 |
| 123 initUIEvent(type, canBubble, cancelable, view, 0); | 120 initUIEvent(type, canBubble, cancelable, view, 0); |
| 124 | 121 |
| 125 m_keyIdentifier = keyIdentifier; | |
| 126 m_location = location; | 122 m_location = location; |
| 127 initModifiers(ctrlKey, altKey, shiftKey, metaKey); | 123 initModifiers(ctrlKey, altKey, shiftKey, metaKey); |
| 128 initLocationModifiers(location); | 124 initLocationModifiers(location); |
| 129 } | 125 } |
| 130 | 126 |
| 131 int KeyboardEvent::keyCode() const | 127 int KeyboardEvent::keyCode() const |
| 132 { | 128 { |
| 133 // IE: virtual key code for keyup/keydown, character code for keypress | 129 // IE: virtual key code for keyup/keydown, character code for keypress |
| 134 // Firefox: virtual key code for keyup/keydown, zero for keypress | 130 // Firefox: virtual key code for keyup/keydown, zero for keypress |
| 135 // We match IE. | 131 // We match IE. |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 break; | 188 break; |
| 193 } | 189 } |
| 194 } | 190 } |
| 195 | 191 |
| 196 DEFINE_TRACE(KeyboardEvent) | 192 DEFINE_TRACE(KeyboardEvent) |
| 197 { | 193 { |
| 198 UIEventWithKeyState::trace(visitor); | 194 UIEventWithKeyState::trace(visitor); |
| 199 } | 195 } |
| 200 | 196 |
| 201 } // namespace blink | 197 } // namespace blink |
| OLD | NEW |