OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Apple Computer, Inc. | 2 * Copyright (C) 2006 Apple Computer, Inc. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 PlatformEvent::CtrlKey | 114 PlatformEvent::CtrlKey |
115 #endif | 115 #endif |
116 }, | 116 }, |
117 { "OS", PlatformEvent::OSKey }, | 117 { "OS", PlatformEvent::OSKey }, |
118 { "Fn", PlatformEvent::FnKey }, | 118 { "Fn", PlatformEvent::FnKey }, |
119 { "CapsLock", PlatformEvent::CapsLockOn }, | 119 { "CapsLock", PlatformEvent::CapsLockOn }, |
120 { "ScrollLock", PlatformEvent::ScrollLockOn }, | 120 { "ScrollLock", PlatformEvent::ScrollLockOn }, |
121 { "NumLock", PlatformEvent::NumLockOn }, | 121 { "NumLock", PlatformEvent::NumLockOn }, |
122 { "Symbol", PlatformEvent::SymbolKey }, | 122 { "Symbol", PlatformEvent::SymbolKey }, |
123 }; | 123 }; |
124 for (size_t i = 0; i < arraysize(kIdentifiers); ++i) { | 124 for (size_t i = 0; i < WTF_ARRAY_LENGTH(kIdentifiers); ++i) { |
125 if (keyIdentifier == kIdentifiers[i].identifier) | 125 if (keyIdentifier == kIdentifiers[i].identifier) |
126 return m_modifiers & kIdentifiers[i].mask; | 126 return m_modifiers & kIdentifiers[i].mask; |
127 } | 127 } |
128 return false; | 128 return false; |
129 } | 129 } |
130 | 130 |
131 void UIEventWithKeyState::initModifiers(bool ctrlKey, bool altKey, bool shiftKey
, bool metaKey) | 131 void UIEventWithKeyState::initModifiers(bool ctrlKey, bool altKey, bool shiftKey
, bool metaKey) |
132 { | 132 { |
133 m_modifiers = 0; | 133 m_modifiers = 0; |
134 if (ctrlKey) | 134 if (ctrlKey) |
135 m_modifiers |= PlatformEvent::CtrlKey; | 135 m_modifiers |= PlatformEvent::CtrlKey; |
136 if (altKey) | 136 if (altKey) |
137 m_modifiers |= PlatformEvent::AltKey; | 137 m_modifiers |= PlatformEvent::AltKey; |
138 if (shiftKey) | 138 if (shiftKey) |
139 m_modifiers |= PlatformEvent::ShiftKey; | 139 m_modifiers |= PlatformEvent::ShiftKey; |
140 if (metaKey) | 140 if (metaKey) |
141 m_modifiers |= PlatformEvent::MetaKey; | 141 m_modifiers |= PlatformEvent::MetaKey; |
142 } | 142 } |
143 | 143 |
144 UIEventWithKeyState* findEventWithKeyState(Event* event) | 144 UIEventWithKeyState* findEventWithKeyState(Event* event) |
145 { | 145 { |
146 for (Event* e = event; e; e = e->underlyingEvent()) | 146 for (Event* e = event; e; e = e->underlyingEvent()) |
147 if (e->isKeyboardEvent() || e->isMouseEvent()) | 147 if (e->isKeyboardEvent() || e->isMouseEvent()) |
148 return static_cast<UIEventWithKeyState*>(e); | 148 return static_cast<UIEventWithKeyState*>(e); |
149 return nullptr; | 149 return nullptr; |
150 } | 150 } |
151 | 151 |
152 } // namespace blink | 152 } // namespace blink |
OLD | NEW |