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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 const bool newTabModifierSet = metaKey; | 76 const bool newTabModifierSet = metaKey; |
77 #else | 77 #else |
78 const bool newTabModifierSet = ctrlKey; | 78 const bool newTabModifierSet = ctrlKey; |
79 #endif | 79 #endif |
80 s_newTabModifierSetFromIsolatedWorld |= newTabModifierSet; | 80 s_newTabModifierSetFromIsolatedWorld |= newTabModifierSet; |
81 } | 81 } |
82 | 82 |
83 void UIEventWithKeyState::setFromPlatformModifiers( | 83 void UIEventWithKeyState::setFromPlatformModifiers( |
84 EventModifierInit& initializer, | 84 EventModifierInit& initializer, |
85 const PlatformEvent::Modifiers modifiers) { | 85 const PlatformEvent::Modifiers modifiers) { |
86 if (modifiers & PlatformEvent::CtrlKey) | 86 setFromWebInputEventModifiers( |
| 87 initializer, static_cast<WebInputEvent::Modifiers>(modifiers)); |
| 88 } |
| 89 |
| 90 void UIEventWithKeyState::setFromWebInputEventModifiers( |
| 91 EventModifierInit& initializer, |
| 92 WebInputEvent::Modifiers modifiers) { |
| 93 if (modifiers & WebInputEvent::ControlKey) |
87 initializer.setCtrlKey(true); | 94 initializer.setCtrlKey(true); |
88 if (modifiers & PlatformEvent::ShiftKey) | 95 if (modifiers & WebInputEvent::ShiftKey) |
89 initializer.setShiftKey(true); | 96 initializer.setShiftKey(true); |
90 if (modifiers & PlatformEvent::AltKey) | 97 if (modifiers & WebInputEvent::AltKey) |
91 initializer.setAltKey(true); | 98 initializer.setAltKey(true); |
92 if (modifiers & PlatformEvent::MetaKey) | 99 if (modifiers & WebInputEvent::MetaKey) |
93 initializer.setMetaKey(true); | 100 initializer.setMetaKey(true); |
94 if (modifiers & PlatformEvent::AltGrKey) | 101 if (modifiers & WebInputEvent::AltGrKey) |
95 initializer.setModifierAltGraph(true); | 102 initializer.setModifierAltGraph(true); |
96 if (modifiers & PlatformEvent::FnKey) | 103 if (modifiers & WebInputEvent::FnKey) |
97 initializer.setModifierFn(true); | 104 initializer.setModifierFn(true); |
98 if (modifiers & PlatformEvent::CapsLockOn) | 105 if (modifiers & WebInputEvent::CapsLockOn) |
99 initializer.setModifierCapsLock(true); | 106 initializer.setModifierCapsLock(true); |
100 if (modifiers & PlatformEvent::ScrollLockOn) | 107 if (modifiers & WebInputEvent::ScrollLockOn) |
101 initializer.setModifierScrollLock(true); | 108 initializer.setModifierScrollLock(true); |
102 if (modifiers & PlatformEvent::NumLockOn) | 109 if (modifiers & WebInputEvent::NumLockOn) |
103 initializer.setModifierNumLock(true); | 110 initializer.setModifierNumLock(true); |
104 if (modifiers & PlatformEvent::SymbolKey) | 111 if (modifiers & WebInputEvent::SymbolKey) |
105 initializer.setModifierSymbol(true); | 112 initializer.setModifierSymbol(true); |
106 } | 113 } |
107 | 114 |
108 bool UIEventWithKeyState::getModifierState(const String& keyIdentifier) const { | 115 bool UIEventWithKeyState::getModifierState(const String& keyIdentifier) const { |
109 struct Identifier { | 116 struct Identifier { |
110 const char* identifier; | 117 const char* identifier; |
111 PlatformEvent::Modifiers mask; | 118 PlatformEvent::Modifiers mask; |
112 }; | 119 }; |
113 static const Identifier kIdentifiers[] = { | 120 static const Identifier kIdentifiers[] = { |
114 {"Shift", PlatformEvent::ShiftKey}, | 121 {"Shift", PlatformEvent::ShiftKey}, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 } | 159 } |
153 | 160 |
154 UIEventWithKeyState* findEventWithKeyState(Event* event) { | 161 UIEventWithKeyState* findEventWithKeyState(Event* event) { |
155 for (Event* e = event; e; e = e->underlyingEvent()) | 162 for (Event* e = event; e; e = e->underlyingEvent()) |
156 if (e->isKeyboardEvent() || e->isMouseEvent()) | 163 if (e->isKeyboardEvent() || e->isMouseEvent()) |
157 return static_cast<UIEventWithKeyState*>(e); | 164 return static_cast<UIEventWithKeyState*>(e); |
158 return nullptr; | 165 return nullptr; |
159 } | 166 } |
160 | 167 |
161 } // namespace blink | 168 } // namespace blink |
OLD | NEW |