| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 #else | 122 #else |
| 123 PlatformEvent::CtrlKey | 123 PlatformEvent::CtrlKey |
| 124 #endif | 124 #endif |
| 125 }, | 125 }, |
| 126 {"Fn", PlatformEvent::FnKey}, | 126 {"Fn", PlatformEvent::FnKey}, |
| 127 {"CapsLock", PlatformEvent::CapsLockOn}, | 127 {"CapsLock", PlatformEvent::CapsLockOn}, |
| 128 {"ScrollLock", PlatformEvent::ScrollLockOn}, | 128 {"ScrollLock", PlatformEvent::ScrollLockOn}, |
| 129 {"NumLock", PlatformEvent::NumLockOn}, | 129 {"NumLock", PlatformEvent::NumLockOn}, |
| 130 {"Symbol", PlatformEvent::SymbolKey}, | 130 {"Symbol", PlatformEvent::SymbolKey}, |
| 131 }; | 131 }; |
| 132 for (size_t i = 0; i < WTF_ARRAY_LENGTH(kIdentifiers); ++i) { | 132 for (const auto& identifier : kIdentifiers) { |
| 133 if (keyIdentifier == kIdentifiers[i].identifier) | 133 if (keyIdentifier == identifier.identifier) |
| 134 return m_modifiers & kIdentifiers[i].mask; | 134 return m_modifiers & identifier.mask; |
| 135 } | 135 } |
| 136 return false; | 136 return false; |
| 137 } | 137 } |
| 138 | 138 |
| 139 void UIEventWithKeyState::initModifiers(bool ctrlKey, | 139 void UIEventWithKeyState::initModifiers(bool ctrlKey, |
| 140 bool altKey, | 140 bool altKey, |
| 141 bool shiftKey, | 141 bool shiftKey, |
| 142 bool metaKey) { | 142 bool metaKey) { |
| 143 m_modifiers = 0; | 143 m_modifiers = 0; |
| 144 if (ctrlKey) | 144 if (ctrlKey) |
| 145 m_modifiers |= PlatformEvent::CtrlKey; | 145 m_modifiers |= PlatformEvent::CtrlKey; |
| 146 if (altKey) | 146 if (altKey) |
| 147 m_modifiers |= PlatformEvent::AltKey; | 147 m_modifiers |= PlatformEvent::AltKey; |
| 148 if (shiftKey) | 148 if (shiftKey) |
| 149 m_modifiers |= PlatformEvent::ShiftKey; | 149 m_modifiers |= PlatformEvent::ShiftKey; |
| 150 if (metaKey) | 150 if (metaKey) |
| 151 m_modifiers |= PlatformEvent::MetaKey; | 151 m_modifiers |= PlatformEvent::MetaKey; |
| 152 } | 152 } |
| 153 | 153 |
| 154 UIEventWithKeyState* findEventWithKeyState(Event* event) { | 154 UIEventWithKeyState* findEventWithKeyState(Event* event) { |
| 155 for (Event* e = event; e; e = e->underlyingEvent()) | 155 for (Event* e = event; e; e = e->underlyingEvent()) |
| 156 if (e->isKeyboardEvent() || e->isMouseEvent()) | 156 if (e->isKeyboardEvent() || e->isMouseEvent()) |
| 157 return static_cast<UIEventWithKeyState*>(e); | 157 return static_cast<UIEventWithKeyState*>(e); |
| 158 return nullptr; | 158 return nullptr; |
| 159 } | 159 } |
| 160 | 160 |
| 161 } // namespace blink | 161 } // namespace blink |
| OLD | NEW |