| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 KeyboardEvent::KeyLocationCode keyLocationCode(const WebInputEvent& key) { | 56 KeyboardEvent::KeyLocationCode keyLocationCode(const WebInputEvent& key) { |
| 57 if (key.modifiers & WebInputEvent::IsKeyPad) | 57 if (key.modifiers & WebInputEvent::IsKeyPad) |
| 58 return KeyboardEvent::kDomKeyLocationNumpad; | 58 return KeyboardEvent::kDomKeyLocationNumpad; |
| 59 if (key.modifiers & WebInputEvent::IsLeft) | 59 if (key.modifiers & WebInputEvent::IsLeft) |
| 60 return KeyboardEvent::kDomKeyLocationLeft; | 60 return KeyboardEvent::kDomKeyLocationLeft; |
| 61 if (key.modifiers & WebInputEvent::IsRight) | 61 if (key.modifiers & WebInputEvent::IsRight) |
| 62 return KeyboardEvent::kDomKeyLocationRight; | 62 return KeyboardEvent::kDomKeyLocationRight; |
| 63 return KeyboardEvent::kDomKeyLocationStandard; | 63 return KeyboardEvent::kDomKeyLocationStandard; |
| 64 } | 64 } |
| 65 | 65 |
| 66 TimeTicks timeStampSecondsToTimeTicks(double seconds) { |
| 67 return TimeTicks() + TimeDelta::FromSecondsD(seconds); |
| 68 } |
| 69 |
| 66 bool hasCurrentComposition(LocalDOMWindow* domWindow) { | 70 bool hasCurrentComposition(LocalDOMWindow* domWindow) { |
| 67 if (!domWindow) | 71 if (!domWindow) |
| 68 return false; | 72 return false; |
| 69 LocalFrame* localFrame = domWindow->frame(); | 73 LocalFrame* localFrame = domWindow->frame(); |
| 70 if (!localFrame) | 74 if (!localFrame) |
| 71 return false; | 75 return false; |
| 72 return localFrame->inputMethodController().hasComposition(); | 76 return localFrame->inputMethodController().hasComposition(); |
| 73 } | 77 } |
| 74 | 78 |
| 75 } // namespace | 79 } // namespace |
| (...skipping 12 matching lines...) Expand all Loading... |
| 88 | 92 |
| 89 KeyboardEvent::KeyboardEvent(const WebKeyboardEvent& key, | 93 KeyboardEvent::KeyboardEvent(const WebKeyboardEvent& key, |
| 90 LocalDOMWindow* domWindow) | 94 LocalDOMWindow* domWindow) |
| 91 : UIEventWithKeyState( | 95 : UIEventWithKeyState( |
| 92 eventTypeForKeyboardEventType(key.type), | 96 eventTypeForKeyboardEventType(key.type), |
| 93 true, | 97 true, |
| 94 true, | 98 true, |
| 95 domWindow, | 99 domWindow, |
| 96 0, | 100 0, |
| 97 static_cast<PlatformEvent::Modifiers>(key.modifiers), | 101 static_cast<PlatformEvent::Modifiers>(key.modifiers), |
| 98 key.timeStampSeconds, | 102 timeStampSecondsToTimeTicks(key.timeStampSeconds), |
| 99 InputDeviceCapabilities::doesntFireTouchEventsSourceCapabilities()), | 103 InputDeviceCapabilities::doesntFireTouchEventsSourceCapabilities()), |
| 100 m_keyEvent(makeUnique<WebKeyboardEvent>(key)), | 104 m_keyEvent(makeUnique<WebKeyboardEvent>(key)), |
| 101 // TODO(crbug.com/482880): Fix this initialization to lazy initialization. | 105 // TODO(crbug.com/482880): Fix this initialization to lazy initialization. |
| 102 m_code(Platform::current()->domCodeStringFromEnum(key.domCode)), | 106 m_code(Platform::current()->domCodeStringFromEnum(key.domCode)), |
| 103 m_key(Platform::current()->domKeyStringFromEnum(key.domKey)), | 107 m_key(Platform::current()->domKeyStringFromEnum(key.domKey)), |
| 104 m_location(keyLocationCode(key)), | 108 m_location(keyLocationCode(key)), |
| 105 m_isComposing(hasCurrentComposition(domWindow)) { | 109 m_isComposing(hasCurrentComposition(domWindow)) { |
| 106 initLocationModifiers(m_location); | 110 initLocationModifiers(m_location); |
| 107 } | 111 } |
| 108 | 112 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 m_modifiers |= PlatformEvent::IsRight; | 206 m_modifiers |= PlatformEvent::IsRight; |
| 203 break; | 207 break; |
| 204 } | 208 } |
| 205 } | 209 } |
| 206 | 210 |
| 207 DEFINE_TRACE(KeyboardEvent) { | 211 DEFINE_TRACE(KeyboardEvent) { |
| 208 UIEventWithKeyState::trace(visitor); | 212 UIEventWithKeyState::trace(visitor); |
| 209 } | 213 } |
| 210 | 214 |
| 211 } // namespace blink | 215 } // namespace blink |
| OLD | NEW |