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

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

Issue 2068053002: Rename Blink constants generated from IDL files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 4 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 default: 45 default:
46 break; 46 break;
47 } 47 }
48 ASSERT_NOT_REACHED(); 48 ASSERT_NOT_REACHED();
49 return EventTypeNames::keydown; 49 return EventTypeNames::keydown;
50 } 50 }
51 51
52 static inline KeyboardEvent::KeyLocationCode keyLocationCode(const PlatformKeybo ardEvent& key) 52 static inline KeyboardEvent::KeyLocationCode keyLocationCode(const PlatformKeybo ardEvent& key)
53 { 53 {
54 if (key.isKeypad()) 54 if (key.isKeypad())
55 return KeyboardEvent::DOM_KEY_LOCATION_NUMPAD; 55 return KeyboardEvent::kDomKeyLocationNumpad;
56 if (key.getModifiers() & PlatformEvent::IsLeft) 56 if (key.getModifiers() & PlatformEvent::IsLeft)
57 return KeyboardEvent::DOM_KEY_LOCATION_LEFT; 57 return KeyboardEvent::kDomKeyLocationLeft;
58 if (key.getModifiers() & PlatformEvent::IsRight) 58 if (key.getModifiers() & PlatformEvent::IsRight)
59 return KeyboardEvent::DOM_KEY_LOCATION_RIGHT; 59 return KeyboardEvent::kDomKeyLocationRight;
60 return KeyboardEvent::DOM_KEY_LOCATION_STANDARD; 60 return KeyboardEvent::kDomKeyLocationStandard;
61 } 61 }
62 62
63 KeyboardEvent* KeyboardEvent::create(ScriptState* scriptState, const AtomicStrin g& type, const KeyboardEventInit& initializer) 63 KeyboardEvent* KeyboardEvent::create(ScriptState* scriptState, const AtomicStrin g& type, const KeyboardEventInit& initializer)
64 { 64 {
65 if (scriptState->world().isIsolatedWorld()) 65 if (scriptState->world().isIsolatedWorld())
66 UIEventWithKeyState::didCreateEventInIsolatedWorld(initializer.ctrlKey() , initializer.altKey(), initializer.shiftKey(), initializer.metaKey()); 66 UIEventWithKeyState::didCreateEventInIsolatedWorld(initializer.ctrlKey() , initializer.altKey(), initializer.shiftKey(), initializer.metaKey());
67 return new KeyboardEvent(type, initializer); 67 return new KeyboardEvent(type, initializer);
68 } 68 }
69 69
70 KeyboardEvent::KeyboardEvent() 70 KeyboardEvent::KeyboardEvent()
71 : m_location(DOM_KEY_LOCATION_STANDARD) 71 : m_location(kDomKeyLocationStandard)
72 { 72 {
73 } 73 }
74 74
75 KeyboardEvent::KeyboardEvent(const PlatformKeyboardEvent& key, AbstractView* vie w) 75 KeyboardEvent::KeyboardEvent(const PlatformKeyboardEvent& key, AbstractView* vie w)
76 : UIEventWithKeyState(eventTypeForKeyboardEventType(key.type()), true, true, view, 0, key.getModifiers(), key.timestamp(), InputDeviceCapabilities::doesntFi reTouchEventsSourceCapabilities()) 76 : UIEventWithKeyState(eventTypeForKeyboardEventType(key.type()), true, true, view, 0, key.getModifiers(), key.timestamp(), InputDeviceCapabilities::doesntFi reTouchEventsSourceCapabilities())
77 , m_keyEvent(wrapUnique(new PlatformKeyboardEvent(key))) 77 , m_keyEvent(wrapUnique(new PlatformKeyboardEvent(key)))
78 , m_code(key.code()) 78 , m_code(key.code())
79 , m_key(key.key()) 79 , m_key(key.key())
80 , m_location(keyLocationCode(key)) 80 , m_location(keyLocationCode(key))
81 { 81 {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 int KeyboardEvent::which() const 170 int KeyboardEvent::which() const
171 { 171 {
172 // Netscape's "which" returns a virtual key code for keydown and keyup, and a character code for keypress. 172 // Netscape's "which" returns a virtual key code for keydown and keyup, and a character code for keypress.
173 // That's exactly what IE's "keyCode" returns. So they are the same for keyb oard events. 173 // That's exactly what IE's "keyCode" returns. So they are the same for keyb oard events.
174 return keyCode(); 174 return keyCode();
175 } 175 }
176 176
177 void KeyboardEvent::initLocationModifiers(unsigned location) 177 void KeyboardEvent::initLocationModifiers(unsigned location)
178 { 178 {
179 switch (location) { 179 switch (location) {
180 case KeyboardEvent::DOM_KEY_LOCATION_NUMPAD: 180 case KeyboardEvent::kDomKeyLocationNumpad:
181 m_modifiers |= PlatformEvent::IsKeyPad; 181 m_modifiers |= PlatformEvent::IsKeyPad;
182 break; 182 break;
183 case KeyboardEvent::DOM_KEY_LOCATION_LEFT: 183 case KeyboardEvent::kDomKeyLocationLeft:
184 m_modifiers |= PlatformEvent::IsLeft; 184 m_modifiers |= PlatformEvent::IsLeft;
185 break; 185 break;
186 case KeyboardEvent::DOM_KEY_LOCATION_RIGHT: 186 case KeyboardEvent::kDomKeyLocationRight:
187 m_modifiers |= PlatformEvent::IsRight; 187 m_modifiers |= PlatformEvent::IsRight;
188 break; 188 break;
189 } 189 }
190 } 190 }
191 191
192 DEFINE_TRACE(KeyboardEvent) 192 DEFINE_TRACE(KeyboardEvent)
193 { 193 {
194 UIEventWithKeyState::trace(visitor); 194 UIEventWithKeyState::trace(visitor);
195 } 195 }
196 196
197 } // namespace blink 197 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/events/KeyboardEvent.h ('k') | third_party/WebKit/Source/core/events/MutationEvent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698