| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 case VK_RSHIFT: | 80 case VK_RSHIFT: |
| 81 case VK_RMENU: | 81 case VK_RMENU: |
| 82 case VK_RWIN: | 82 case VK_RWIN: |
| 83 return KeyboardEvent::DOMKeyLocationRight; | 83 return KeyboardEvent::DOMKeyLocationRight; |
| 84 default: | 84 default: |
| 85 return KeyboardEvent::DOMKeyLocationStandard; | 85 return KeyboardEvent::DOMKeyLocationStandard; |
| 86 } | 86 } |
| 87 } | 87 } |
| 88 | 88 |
| 89 KeyboardEventInit::KeyboardEventInit() | 89 KeyboardEventInit::KeyboardEventInit() |
| 90 : keyLocation(0) | 90 : location(0) |
| 91 , ctrlKey(false) | 91 , ctrlKey(false) |
| 92 , altKey(false) | 92 , altKey(false) |
| 93 , shiftKey(false) | 93 , shiftKey(false) |
| 94 , metaKey(false) | 94 , metaKey(false) |
| 95 { | 95 { |
| 96 } | 96 } |
| 97 | 97 |
| 98 KeyboardEvent::KeyboardEvent() | 98 KeyboardEvent::KeyboardEvent() |
| 99 : m_keyLocation(DOMKeyLocationStandard) | 99 : m_location(DOMKeyLocationStandard) |
| 100 , m_altGraphKey(false) | 100 , m_altGraphKey(false) |
| 101 { | 101 { |
| 102 ScriptWrappable::init(this); | 102 ScriptWrappable::init(this); |
| 103 } | 103 } |
| 104 | 104 |
| 105 KeyboardEvent::KeyboardEvent(const PlatformKeyboardEvent& key, AbstractView* vie
w) | 105 KeyboardEvent::KeyboardEvent(const PlatformKeyboardEvent& key, AbstractView* vie
w) |
| 106 : UIEventWithKeyState(eventTypeForKeyboardEventType(key.type()), | 106 : UIEventWithKeyState(eventTypeForKeyboardEventType(key.type()), |
| 107 true, true, view, 0, key.ctrlKey(), key.altKey(), key.
shiftKey(), key.metaKey()) | 107 true, true, view, 0, key.ctrlKey(), key.altKey(), key.
shiftKey(), key.metaKey()) |
| 108 , m_keyEvent(adoptPtr(new PlatformKeyboardEvent(key))) | 108 , m_keyEvent(adoptPtr(new PlatformKeyboardEvent(key))) |
| 109 , m_keyIdentifier(key.keyIdentifier()) | 109 , m_keyIdentifier(key.keyIdentifier()) |
| 110 , m_keyLocation(keyLocationCode(key)) | 110 , m_location(keyLocationCode(key)) |
| 111 , m_altGraphKey(false) | 111 , m_altGraphKey(false) |
| 112 { | 112 { |
| 113 ScriptWrappable::init(this); | 113 ScriptWrappable::init(this); |
| 114 } | 114 } |
| 115 | 115 |
| 116 KeyboardEvent::KeyboardEvent(const AtomicString& eventType, const KeyboardEventI
nit& initializer) | 116 KeyboardEvent::KeyboardEvent(const AtomicString& eventType, const KeyboardEventI
nit& initializer) |
| 117 : UIEventWithKeyState(eventType, initializer.bubbles, initializer.cancelable
, initializer.view, initializer.detail, initializer.ctrlKey, initializer.altKey,
initializer.shiftKey, initializer.metaKey) | 117 : UIEventWithKeyState(eventType, initializer.bubbles, initializer.cancelable
, initializer.view, initializer.detail, initializer.ctrlKey, initializer.altKey,
initializer.shiftKey, initializer.metaKey) |
| 118 , m_keyIdentifier(initializer.keyIdentifier) | 118 , m_keyIdentifier(initializer.keyIdentifier) |
| 119 , m_keyLocation(initializer.keyLocation) | 119 , m_location(initializer.location) |
| 120 , m_altGraphKey(false) | 120 , m_altGraphKey(false) |
| 121 { | 121 { |
| 122 ScriptWrappable::init(this); | 122 ScriptWrappable::init(this); |
| 123 } | 123 } |
| 124 | 124 |
| 125 KeyboardEvent::KeyboardEvent(const AtomicString& eventType, bool canBubble, bool
cancelable, AbstractView *view, | 125 KeyboardEvent::KeyboardEvent(const AtomicString& eventType, bool canBubble, bool
cancelable, AbstractView *view, |
| 126 const String &keyIdentifier, unsigned keyLocation, | 126 const String &keyIdentifier, unsigned location, |
| 127 bool ctrlKey, bool altKey, bool shiftKey, bool meta
Key, bool altGraphKey) | 127 bool ctrlKey, bool altKey, bool shiftKey, bool meta
Key, bool altGraphKey) |
| 128 : UIEventWithKeyState(eventType, canBubble, cancelable, view, 0, ctrlKey, al
tKey, shiftKey, metaKey) | 128 : UIEventWithKeyState(eventType, canBubble, cancelable, view, 0, ctrlKey, al
tKey, shiftKey, metaKey) |
| 129 , m_keyIdentifier(keyIdentifier) | 129 , m_keyIdentifier(keyIdentifier) |
| 130 , m_keyLocation(keyLocation) | 130 , m_location(location) |
| 131 , m_altGraphKey(altGraphKey) | 131 , m_altGraphKey(altGraphKey) |
| 132 { | 132 { |
| 133 ScriptWrappable::init(this); | 133 ScriptWrappable::init(this); |
| 134 } | 134 } |
| 135 | 135 |
| 136 KeyboardEvent::~KeyboardEvent() | 136 KeyboardEvent::~KeyboardEvent() |
| 137 { | 137 { |
| 138 } | 138 } |
| 139 | 139 |
| 140 void KeyboardEvent::initKeyboardEvent(const AtomicString& type, bool canBubble,
bool cancelable, AbstractView* view, | 140 void KeyboardEvent::initKeyboardEvent(const AtomicString& type, bool canBubble,
bool cancelable, AbstractView* view, |
| 141 const String &keyIdentifier, unsigned keyL
ocation, | 141 const String &keyIdentifier, unsigned loca
tion, |
| 142 bool ctrlKey, bool altKey, bool shiftKey,
bool metaKey, bool altGraphKey) | 142 bool ctrlKey, bool altKey, bool shiftKey,
bool metaKey, bool altGraphKey) |
| 143 { | 143 { |
| 144 if (dispatched()) | 144 if (dispatched()) |
| 145 return; | 145 return; |
| 146 | 146 |
| 147 initUIEvent(type, canBubble, cancelable, view, 0); | 147 initUIEvent(type, canBubble, cancelable, view, 0); |
| 148 | 148 |
| 149 m_keyIdentifier = keyIdentifier; | 149 m_keyIdentifier = keyIdentifier; |
| 150 m_keyLocation = keyLocation; | 150 m_location = location; |
| 151 m_ctrlKey = ctrlKey; | 151 m_ctrlKey = ctrlKey; |
| 152 m_shiftKey = shiftKey; | 152 m_shiftKey = shiftKey; |
| 153 m_altKey = altKey; | 153 m_altKey = altKey; |
| 154 m_metaKey = metaKey; | 154 m_metaKey = metaKey; |
| 155 m_altGraphKey = altGraphKey; | 155 m_altGraphKey = altGraphKey; |
| 156 } | 156 } |
| 157 | 157 |
| 158 bool KeyboardEvent::getModifierState(const String& keyIdentifier) const | 158 bool KeyboardEvent::getModifierState(const String& keyIdentifier) const |
| 159 { | 159 { |
| 160 // FIXME: The following keyIdentifiers are not supported yet (crbug.com/2654
58): | 160 // FIXME: The following keyIdentifiers are not supported yet (crbug.com/2654
58): |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 { | 231 { |
| 232 } | 232 } |
| 233 | 233 |
| 234 bool KeyboardEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) c
onst | 234 bool KeyboardEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) c
onst |
| 235 { | 235 { |
| 236 // Make sure not to return true if we already took default action while hand
ling the event. | 236 // Make sure not to return true if we already took default action while hand
ling the event. |
| 237 return EventDispatchMediator::dispatchEvent(dispatcher) && !event()->default
Handled(); | 237 return EventDispatchMediator::dispatchEvent(dispatcher) && !event()->default
Handled(); |
| 238 } | 238 } |
| 239 | 239 |
| 240 } // namespace WebCore | 240 } // namespace WebCore |
| OLD | NEW |