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

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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 KeyboardEvent::KeyboardEvent() : m_location(kDomKeyLocationStandard) {} 88 KeyboardEvent::KeyboardEvent() : m_location(kDomKeyLocationStandard) {}
89 89
90 KeyboardEvent::KeyboardEvent(const WebKeyboardEvent& key, 90 KeyboardEvent::KeyboardEvent(const WebKeyboardEvent& key,
91 LocalDOMWindow* domWindow) 91 LocalDOMWindow* domWindow)
92 : UIEventWithKeyState( 92 : UIEventWithKeyState(
93 eventTypeForKeyboardEventType(key.type()), 93 eventTypeForKeyboardEventType(key.type()),
94 true, 94 true,
95 true, 95 true,
96 domWindow, 96 domWindow,
97 0, 97 0,
98 static_cast<PlatformEvent::Modifiers>(key.modifiers()), 98 static_cast<WebInputEvent::Modifiers>(key.modifiers()),
99 TimeTicks::FromSeconds(key.timeStampSeconds()), 99 TimeTicks::FromSeconds(key.timeStampSeconds()),
100 domWindow 100 domWindow
101 ? domWindow->getInputDeviceCapabilities()->firesTouchEvents(false) 101 ? domWindow->getInputDeviceCapabilities()->firesTouchEvents(false)
102 : nullptr), 102 : nullptr),
103 m_keyEvent(WTF::makeUnique<WebKeyboardEvent>(key)), 103 m_keyEvent(WTF::makeUnique<WebKeyboardEvent>(key)),
104 // TODO(crbug.com/482880): Fix this initialization to lazy initialization. 104 // TODO(crbug.com/482880): Fix this initialization to lazy initialization.
105 m_code(Platform::current()->domCodeStringFromEnum(key.domCode)), 105 m_code(Platform::current()->domCodeStringFromEnum(key.domCode)),
106 m_key(Platform::current()->domKeyStringFromEnum(key.domKey)), 106 m_key(Platform::current()->domKeyStringFromEnum(key.domKey)),
107 m_location(keyLocationCode(key)), 107 m_location(keyLocationCode(key)),
108 m_isComposing(hasCurrentComposition(domWindow)) { 108 m_isComposing(hasCurrentComposition(domWindow)) {
109 initLocationModifiers(m_location); 109 initLocationModifiers(m_location);
110 } 110 }
111 111
112 KeyboardEvent::KeyboardEvent(const AtomicString& eventType, 112 KeyboardEvent::KeyboardEvent(const AtomicString& eventType,
113 const KeyboardEventInit& initializer) 113 const KeyboardEventInit& initializer)
114 : UIEventWithKeyState(eventType, initializer), 114 : UIEventWithKeyState(eventType, initializer),
115 m_code(initializer.code()), 115 m_code(initializer.code()),
116 m_key(initializer.key()), 116 m_key(initializer.key()),
117 m_location(initializer.location()), 117 m_location(initializer.location()),
118 m_isComposing(initializer.isComposing()) { 118 m_isComposing(initializer.isComposing()) {
119 if (initializer.repeat()) 119 if (initializer.repeat())
120 m_modifiers |= PlatformEvent::IsAutoRepeat; 120 m_modifiers |= WebInputEvent::IsAutoRepeat;
121 initLocationModifiers(initializer.location()); 121 initLocationModifiers(initializer.location());
122 } 122 }
123 123
124 KeyboardEvent::~KeyboardEvent() {} 124 KeyboardEvent::~KeyboardEvent() {}
125 125
126 void KeyboardEvent::initKeyboardEvent(ScriptState* scriptState, 126 void KeyboardEvent::initKeyboardEvent(ScriptState* scriptState,
127 const AtomicString& type, 127 const AtomicString& type,
128 bool canBubble, 128 bool canBubble,
129 bool cancelable, 129 bool cancelable,
130 AbstractView* view, 130 AbstractView* view,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 int KeyboardEvent::which() const { 189 int KeyboardEvent::which() const {
190 // Netscape's "which" returns a virtual key code for keydown and keyup, and a 190 // Netscape's "which" returns a virtual key code for keydown and keyup, and a
191 // character code for keypress. That's exactly what IE's "keyCode" returns. 191 // character code for keypress. That's exactly what IE's "keyCode" returns.
192 // So they are the same for keyboard events. 192 // So they are the same for keyboard events.
193 return keyCode(); 193 return keyCode();
194 } 194 }
195 195
196 void KeyboardEvent::initLocationModifiers(unsigned location) { 196 void KeyboardEvent::initLocationModifiers(unsigned location) {
197 switch (location) { 197 switch (location) {
198 case KeyboardEvent::kDomKeyLocationNumpad: 198 case KeyboardEvent::kDomKeyLocationNumpad:
199 m_modifiers |= PlatformEvent::IsKeyPad; 199 m_modifiers |= WebInputEvent::IsKeyPad;
200 break; 200 break;
201 case KeyboardEvent::kDomKeyLocationLeft: 201 case KeyboardEvent::kDomKeyLocationLeft:
202 m_modifiers |= PlatformEvent::IsLeft; 202 m_modifiers |= WebInputEvent::IsLeft;
203 break; 203 break;
204 case KeyboardEvent::kDomKeyLocationRight: 204 case KeyboardEvent::kDomKeyLocationRight:
205 m_modifiers |= PlatformEvent::IsRight; 205 m_modifiers |= WebInputEvent::IsRight;
206 break; 206 break;
207 } 207 }
208 } 208 }
209 209
210 DEFINE_TRACE(KeyboardEvent) { 210 DEFINE_TRACE(KeyboardEvent) {
211 UIEventWithKeyState::trace(visitor); 211 UIEventWithKeyState::trace(visitor);
212 } 212 }
213 213
214 } // namespace blink 214 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/events/KeyboardEvent.h ('k') | third_party/WebKit/Source/core/events/MouseEvent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698