| 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. |
| 11 * | 11 * |
| 12 * This library is distributed in the hope that it will be useful, | 12 * This library is distributed in the hope that it will be useful, |
| 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 * Library General Public License for more details. | 15 * Library General Public License for more details. |
| 16 * | 16 * |
| 17 * You should have received a copy of the GNU Library General Public License | 17 * You should have received a copy of the GNU Library General Public License |
| 18 * along with this library; see the file COPYING.LIB. If not, write to | 18 * along with this library; see the file COPYING.LIB. If not, write to |
| 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 20 * Boston, MA 02110-1301, USA. | 20 * Boston, MA 02110-1301, USA. |
| 21 */ | 21 */ |
| 22 | 22 |
| 23 #include "core/events/KeyboardEvent.h" | 23 #include "core/events/KeyboardEvent.h" |
| 24 | 24 |
| 25 #include "bindings/core/v8/DOMWrapperWorld.h" | 25 #include "bindings/core/v8/DOMWrapperWorld.h" |
| 26 #include "bindings/core/v8/ScriptState.h" | 26 #include "bindings/core/v8/ScriptState.h" |
| 27 #include "core/editing/InputMethodController.h" | 27 #include "core/editing/InputMethodController.h" |
| 28 #include "core/input/InputDeviceCapabilities.h" |
| 28 #include "platform/WindowsKeyboardCodes.h" | 29 #include "platform/WindowsKeyboardCodes.h" |
| 29 #include "public/platform/Platform.h" | 30 #include "public/platform/Platform.h" |
| 30 #include "public/platform/WebInputEvent.h" | 31 #include "public/platform/WebInputEvent.h" |
| 31 #include "wtf/PtrUtil.h" | 32 #include "wtf/PtrUtil.h" |
| 32 | 33 |
| 33 namespace blink { | 34 namespace blink { |
| 34 | 35 |
| 35 namespace { | 36 namespace { |
| 36 | 37 |
| 37 const AtomicString& eventTypeForKeyboardEventType(WebInputEvent::Type type) { | 38 const AtomicString& eventTypeForKeyboardEventType(WebInputEvent::Type type) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 KeyboardEvent::KeyboardEvent(const WebKeyboardEvent& key, | 90 KeyboardEvent::KeyboardEvent(const WebKeyboardEvent& key, |
| 90 LocalDOMWindow* domWindow) | 91 LocalDOMWindow* domWindow) |
| 91 : UIEventWithKeyState( | 92 : UIEventWithKeyState( |
| 92 eventTypeForKeyboardEventType(key.type()), | 93 eventTypeForKeyboardEventType(key.type()), |
| 93 true, | 94 true, |
| 94 true, | 95 true, |
| 95 domWindow, | 96 domWindow, |
| 96 0, | 97 0, |
| 97 static_cast<PlatformEvent::Modifiers>(key.modifiers()), | 98 static_cast<PlatformEvent::Modifiers>(key.modifiers()), |
| 98 TimeTicks::FromSeconds(key.timeStampSeconds()), | 99 TimeTicks::FromSeconds(key.timeStampSeconds()), |
| 99 InputDeviceCapabilities::doesntFireTouchEventsSourceCapabilities()), | 100 domWindow |
| 101 ? domWindow->getInputDeviceCapabilities()->firesTouchEvents(false) |
| 102 : nullptr), |
| 100 m_keyEvent(WTF::makeUnique<WebKeyboardEvent>(key)), | 103 m_keyEvent(WTF::makeUnique<WebKeyboardEvent>(key)), |
| 101 // TODO(crbug.com/482880): Fix this initialization to lazy initialization. | 104 // TODO(crbug.com/482880): Fix this initialization to lazy initialization. |
| 102 m_code(Platform::current()->domCodeStringFromEnum(key.domCode)), | 105 m_code(Platform::current()->domCodeStringFromEnum(key.domCode)), |
| 103 m_key(Platform::current()->domKeyStringFromEnum(key.domKey)), | 106 m_key(Platform::current()->domKeyStringFromEnum(key.domKey)), |
| 104 m_location(keyLocationCode(key)), | 107 m_location(keyLocationCode(key)), |
| 105 m_isComposing(hasCurrentComposition(domWindow)) { | 108 m_isComposing(hasCurrentComposition(domWindow)) { |
| 106 initLocationModifiers(m_location); | 109 initLocationModifiers(m_location); |
| 107 } | 110 } |
| 108 | 111 |
| 109 KeyboardEvent::KeyboardEvent(const AtomicString& eventType, | 112 KeyboardEvent::KeyboardEvent(const AtomicString& eventType, |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 m_modifiers |= PlatformEvent::IsRight; | 205 m_modifiers |= PlatformEvent::IsRight; |
| 203 break; | 206 break; |
| 204 } | 207 } |
| 205 } | 208 } |
| 206 | 209 |
| 207 DEFINE_TRACE(KeyboardEvent) { | 210 DEFINE_TRACE(KeyboardEvent) { |
| 208 UIEventWithKeyState::trace(visitor); | 211 UIEventWithKeyState::trace(visitor); |
| 209 } | 212 } |
| 210 | 213 |
| 211 } // namespace blink | 214 } // namespace blink |
| OLD | NEW |