| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 return adoptRefWillBeNoop(new KeyboardEvent(type, initializer)); | 94 return adoptRefWillBeNoop(new KeyboardEvent(type, initializer)); |
| 95 } | 95 } |
| 96 | 96 |
| 97 KeyboardEvent::KeyboardEvent() | 97 KeyboardEvent::KeyboardEvent() |
| 98 : m_location(DOM_KEY_LOCATION_STANDARD) | 98 : m_location(DOM_KEY_LOCATION_STANDARD) |
| 99 , m_isAutoRepeat(false) | 99 , m_isAutoRepeat(false) |
| 100 { | 100 { |
| 101 } | 101 } |
| 102 | 102 |
| 103 KeyboardEvent::KeyboardEvent(const PlatformKeyboardEvent& key, AbstractView* vie
w) | 103 KeyboardEvent::KeyboardEvent(const PlatformKeyboardEvent& key, AbstractView* vie
w) |
| 104 : UIEventWithKeyState(eventTypeForKeyboardEventType(key.type()), | 104 : UIEventWithKeyState(eventTypeForKeyboardEventType(key.type()), true, true,
view, 0, key.ctrlKey(), key.altKey(), key.shiftKey(), key.metaKey(), InputDevic
e::doesntFireTouchEventsInputDevice()) |
| 105 true, true, view, 0, key.ctrlKey(), key.altKey(), key.
shiftKey(), key.metaKey()) | |
| 106 , m_keyEvent(adoptPtr(new PlatformKeyboardEvent(key))) | 105 , m_keyEvent(adoptPtr(new PlatformKeyboardEvent(key))) |
| 107 , m_keyIdentifier(key.keyIdentifier()) | 106 , m_keyIdentifier(key.keyIdentifier()) |
| 108 , m_code(key.code()) | 107 , m_code(key.code()) |
| 109 , m_key(key.key()) | 108 , m_key(key.key()) |
| 110 , m_location(keyLocationCode(key)) | 109 , m_location(keyLocationCode(key)) |
| 111 , m_isAutoRepeat(key.isAutoRepeat()) | 110 , m_isAutoRepeat(key.isAutoRepeat()) |
| 112 { | 111 { |
| 113 setUICreateTime(key.timestamp()); | 112 setUICreateTime(key.timestamp()); |
| 114 } | 113 } |
| 115 | 114 |
| 116 KeyboardEvent::KeyboardEvent(const AtomicString& eventType, const KeyboardEventI
nit& initializer) | 115 KeyboardEvent::KeyboardEvent(const AtomicString& eventType, const KeyboardEventI
nit& initializer) |
| 117 : UIEventWithKeyState(eventType, initializer.bubbles(), initializer.cancelab
le(), initializer.view(), initializer.detail(), initializer.ctrlKey(), initializ
er.altKey(), initializer.shiftKey(), initializer.metaKey()) | 116 : UIEventWithKeyState(eventType, initializer.bubbles(), initializer.cancelab
le(), initializer.view(), initializer.detail(), initializer.ctrlKey(), initializ
er.altKey(), initializer.shiftKey(), initializer.metaKey(), initializer.sourceDe
vice()) |
| 118 , m_keyIdentifier(initializer.keyIdentifier()) | 117 , m_keyIdentifier(initializer.keyIdentifier()) |
| 119 , m_location(initializer.location()) | 118 , m_location(initializer.location()) |
| 120 , m_isAutoRepeat(initializer.repeat()) | 119 , m_isAutoRepeat(initializer.repeat()) |
| 121 { | 120 { |
| 122 } | 121 } |
| 123 | 122 |
| 124 KeyboardEvent::KeyboardEvent(const AtomicString& eventType, bool canBubble, bool
cancelable, AbstractView *view, | 123 KeyboardEvent::KeyboardEvent(const AtomicString& eventType, bool canBubble, bool
cancelable, AbstractView *view, |
| 125 const String& keyIdentifier, const String& code, const String& key, unsigned
location, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey) | 124 const String& keyIdentifier, const String& code, const String& key, unsigned
location, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey) |
| 126 : UIEventWithKeyState(eventType, canBubble, cancelable, view, 0, ctrlKey, al
tKey, shiftKey, metaKey) | 125 : UIEventWithKeyState(eventType, canBubble, cancelable, view, 0, ctrlKey, al
tKey, shiftKey, metaKey, InputDevice::doesntFireTouchEventsInputDevice()) |
| 127 , m_keyIdentifier(keyIdentifier) | 126 , m_keyIdentifier(keyIdentifier) |
| 128 , m_code(code) | 127 , m_code(code) |
| 129 , m_key(key) | 128 , m_key(key) |
| 130 , m_location(location) | 129 , m_location(location) |
| 131 , m_isAutoRepeat(false) | 130 , m_isAutoRepeat(false) |
| 132 { | 131 { |
| 133 } | 132 } |
| 134 | 133 |
| 135 KeyboardEvent::~KeyboardEvent() | 134 KeyboardEvent::~KeyboardEvent() |
| 136 { | 135 { |
| 137 } | 136 } |
| 138 | 137 |
| 139 void KeyboardEvent::initKeyboardEvent(ScriptState* scriptState, const AtomicStri
ng& type, bool canBubble, bool cancelable, AbstractView* view, | 138 void KeyboardEvent::initKeyboardEvent(ScriptState* scriptState, const AtomicStri
ng& type, bool canBubble, bool cancelable, AbstractView* view, |
| 140 const String& keyIdentifier, unsigned location, bool ctrlKey, bool altKey, b
ool shiftKey, bool metaKey) | 139 const String& keyIdentifier, unsigned location, bool ctrlKey, bool altKey, b
ool shiftKey, bool metaKey, InputDevice* sourceDevice) |
| 141 { | 140 { |
| 142 if (dispatched()) | 141 if (dispatched()) |
| 143 return; | 142 return; |
| 144 | 143 |
| 145 if (scriptState->world().isIsolatedWorld()) | 144 if (scriptState->world().isIsolatedWorld()) |
| 146 UIEventWithKeyState::didCreateEventInIsolatedWorld(ctrlKey, altKey, shif
tKey, metaKey); | 145 UIEventWithKeyState::didCreateEventInIsolatedWorld(ctrlKey, altKey, shif
tKey, metaKey); |
| 147 | 146 |
| 148 initUIEvent(type, canBubble, cancelable, view, 0); | 147 initUIEvent(type, canBubble, cancelable, view, 0, sourceDevice); |
| 149 | 148 |
| 150 m_keyIdentifier = keyIdentifier; | 149 m_keyIdentifier = keyIdentifier; |
| 151 m_location = location; | 150 m_location = location; |
| 152 m_ctrlKey = ctrlKey; | 151 m_ctrlKey = ctrlKey; |
| 153 m_shiftKey = shiftKey; | 152 m_shiftKey = shiftKey; |
| 154 m_altKey = altKey; | 153 m_altKey = altKey; |
| 155 m_metaKey = metaKey; | 154 m_metaKey = metaKey; |
| 156 } | 155 } |
| 157 | 156 |
| 158 bool KeyboardEvent::getModifierState(const String& keyIdentifier) const | 157 bool KeyboardEvent::getModifierState(const String& keyIdentifier) const |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 { | 234 { |
| 236 } | 235 } |
| 237 | 236 |
| 238 bool KeyboardEventDispatchMediator::dispatchEvent(EventDispatcher& dispatcher) c
onst | 237 bool KeyboardEventDispatchMediator::dispatchEvent(EventDispatcher& dispatcher) c
onst |
| 239 { | 238 { |
| 240 // Make sure not to return true if we already took default action while hand
ling the event. | 239 // Make sure not to return true if we already took default action while hand
ling the event. |
| 241 return EventDispatchMediator::dispatchEvent(dispatcher) && !event().defaultH
andled(); | 240 return EventDispatchMediator::dispatchEvent(dispatcher) && !event().defaultH
andled(); |
| 242 } | 241 } |
| 243 | 242 |
| 244 } // namespace blink | 243 } // namespace blink |
| OLD | NEW |