Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(877)

Side by Side Diff: third_party/WebKit/Source/core/events/KeyboardEvent.cpp

Issue 2655873003: Remove PlatformEvent it is no longer used. (Closed)
Patch Set: Remove PlatformEvent it is no longer used. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 KeyboardEvent::KeyboardEvent() : m_location(kDomKeyLocationStandard) {} 87 KeyboardEvent::KeyboardEvent() : m_location(kDomKeyLocationStandard) {}
88 88
89 KeyboardEvent::KeyboardEvent(const WebKeyboardEvent& key, 89 KeyboardEvent::KeyboardEvent(const WebKeyboardEvent& key,
90 LocalDOMWindow* domWindow) 90 LocalDOMWindow* domWindow)
91 : UIEventWithKeyState( 91 : UIEventWithKeyState(
92 eventTypeForKeyboardEventType(key.type()), 92 eventTypeForKeyboardEventType(key.type()),
93 true, 93 true,
94 true, 94 true,
95 domWindow, 95 domWindow,
96 0, 96 0,
97 static_cast<PlatformEvent::Modifiers>(key.modifiers()), 97 static_cast<WebInputEvent::Modifiers>(key.modifiers()),
98 TimeTicks::FromSeconds(key.timeStampSeconds()), 98 TimeTicks::FromSeconds(key.timeStampSeconds()),
99 InputDeviceCapabilities::doesntFireTouchEventsSourceCapabilities()), 99 InputDeviceCapabilities::doesntFireTouchEventsSourceCapabilities()),
100 m_keyEvent(WTF::makeUnique<WebKeyboardEvent>(key)), 100 m_keyEvent(WTF::makeUnique<WebKeyboardEvent>(key)),
101 // TODO(crbug.com/482880): Fix this initialization to lazy initialization. 101 // TODO(crbug.com/482880): Fix this initialization to lazy initialization.
102 m_code(Platform::current()->domCodeStringFromEnum(key.domCode)), 102 m_code(Platform::current()->domCodeStringFromEnum(key.domCode)),
103 m_key(Platform::current()->domKeyStringFromEnum(key.domKey)), 103 m_key(Platform::current()->domKeyStringFromEnum(key.domKey)),
104 m_location(keyLocationCode(key)), 104 m_location(keyLocationCode(key)),
105 m_isComposing(hasCurrentComposition(domWindow)) { 105 m_isComposing(hasCurrentComposition(domWindow)) {
106 initLocationModifiers(m_location); 106 initLocationModifiers(m_location);
107 } 107 }
108 108
109 KeyboardEvent::KeyboardEvent(const AtomicString& eventType, 109 KeyboardEvent::KeyboardEvent(const AtomicString& eventType,
110 const KeyboardEventInit& initializer) 110 const KeyboardEventInit& initializer)
111 : UIEventWithKeyState(eventType, initializer), 111 : UIEventWithKeyState(eventType, initializer),
112 m_code(initializer.code()), 112 m_code(initializer.code()),
113 m_key(initializer.key()), 113 m_key(initializer.key()),
114 m_location(initializer.location()), 114 m_location(initializer.location()),
115 m_isComposing(initializer.isComposing()) { 115 m_isComposing(initializer.isComposing()) {
116 if (initializer.repeat()) 116 if (initializer.repeat())
117 m_modifiers |= PlatformEvent::IsAutoRepeat; 117 m_modifiers |= WebInputEvent::IsAutoRepeat;
118 initLocationModifiers(initializer.location()); 118 initLocationModifiers(initializer.location());
119 } 119 }
120 120
121 KeyboardEvent::~KeyboardEvent() {} 121 KeyboardEvent::~KeyboardEvent() {}
122 122
123 void KeyboardEvent::initKeyboardEvent(ScriptState* scriptState, 123 void KeyboardEvent::initKeyboardEvent(ScriptState* scriptState,
124 const AtomicString& type, 124 const AtomicString& type,
125 bool canBubble, 125 bool canBubble,
126 bool cancelable, 126 bool cancelable,
127 AbstractView* view, 127 AbstractView* view,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 int KeyboardEvent::which() const { 186 int KeyboardEvent::which() const {
187 // Netscape's "which" returns a virtual key code for keydown and keyup, and a 187 // Netscape's "which" returns a virtual key code for keydown and keyup, and a
188 // character code for keypress. That's exactly what IE's "keyCode" returns. 188 // character code for keypress. That's exactly what IE's "keyCode" returns.
189 // So they are the same for keyboard events. 189 // So they are the same for keyboard events.
190 return keyCode(); 190 return keyCode();
191 } 191 }
192 192
193 void KeyboardEvent::initLocationModifiers(unsigned location) { 193 void KeyboardEvent::initLocationModifiers(unsigned location) {
194 switch (location) { 194 switch (location) {
195 case KeyboardEvent::kDomKeyLocationNumpad: 195 case KeyboardEvent::kDomKeyLocationNumpad:
196 m_modifiers |= PlatformEvent::IsKeyPad; 196 m_modifiers |= WebInputEvent::IsKeyPad;
197 break; 197 break;
198 case KeyboardEvent::kDomKeyLocationLeft: 198 case KeyboardEvent::kDomKeyLocationLeft:
199 m_modifiers |= PlatformEvent::IsLeft; 199 m_modifiers |= WebInputEvent::IsLeft;
200 break; 200 break;
201 case KeyboardEvent::kDomKeyLocationRight: 201 case KeyboardEvent::kDomKeyLocationRight:
202 m_modifiers |= PlatformEvent::IsRight; 202 m_modifiers |= WebInputEvent::IsRight;
203 break; 203 break;
204 } 204 }
205 } 205 }
206 206
207 DEFINE_TRACE(KeyboardEvent) { 207 DEFINE_TRACE(KeyboardEvent) {
208 UIEventWithKeyState::trace(visitor); 208 UIEventWithKeyState::trace(visitor);
209 } 209 }
210 210
211 } // namespace blink 211 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698