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

Side by Side Diff: third_party/WebKit/Source/core/editing/EditingBehavior.cpp

Issue 2573073003: Collapse the API surface on WebInputEvent via accessor functions. (Closed)
Patch Set: Fix nits Created 3 years, 11 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) 2006, 2007 Apple, Inc. All rights reserved. 2 * Copyright (C) 2006, 2007 Apple, Inc. All rights reserved.
3 * Copyright (C) 2012 Google, Inc. All rights reserved. 3 * Copyright (C) 2012 Google, Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 entry.name); 220 entry.name);
221 } 221 }
222 222
223 for (const auto& entry : kKeyboardCodeKeyPressEntries) { 223 for (const auto& entry : kKeyboardCodeKeyPressEntries) {
224 keyPressCommandsMap->set(entry.modifiers << 16 | entry.charCode, 224 keyPressCommandsMap->set(entry.modifiers << 16 | entry.charCode,
225 entry.name); 225 entry.name);
226 } 226 }
227 } 227 }
228 228
229 unsigned modifiers = 229 unsigned modifiers =
230 keyEvent->modifiers & (ShiftKey | AltKey | CtrlKey | MetaKey); 230 keyEvent->modifiers() & (ShiftKey | AltKey | CtrlKey | MetaKey);
231 231
232 if (keyEvent->type == WebInputEvent::RawKeyDown) { 232 if (keyEvent->type() == WebInputEvent::RawKeyDown) {
233 int mapKey = modifiers << 16 | event.keyCode(); 233 int mapKey = modifiers << 16 | event.keyCode();
234 const char* name = mapKey ? keyDownCommandsMap->get(mapKey) : nullptr; 234 const char* name = mapKey ? keyDownCommandsMap->get(mapKey) : nullptr;
235 if (!name) 235 if (!name)
236 name = lookupCommandNameFromDomKeyKeyDown(event.key(), modifiers); 236 name = lookupCommandNameFromDomKeyKeyDown(event.key(), modifiers);
237 return name; 237 return name;
238 } 238 }
239 239
240 int mapKey = modifiers << 16 | event.charCode(); 240 int mapKey = modifiers << 16 | event.charCode();
241 return mapKey ? keyPressCommandsMap->get(mapKey) : 0; 241 return mapKey ? keyPressCommandsMap->get(mapKey) : 0;
242 } 242 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 #if OS(MACOSX) 282 #if OS(MACOSX)
283 if (event.metaKey()) 283 if (event.metaKey())
284 return false; 284 return false;
285 #endif 285 #endif
286 } 286 }
287 #endif 287 #endif
288 288
289 return true; 289 return true;
290 } 290 }
291 } // namespace blink 291 } // namespace blink
OLDNEW
« no previous file with comments | « extensions/browser/guest_view/web_view/web_view_guest.cc ('k') | third_party/WebKit/Source/core/editing/EditorKeyBindings.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698