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

Side by Side Diff: tools/dom/src/KeyCode.dart

Issue 2827793002: Format all files under tools and utils directory. (Closed)
Patch Set: Format all files under tools and utils directory. Created 3 years, 8 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
« no previous file with comments | « tools/dom/src/Html5NodeValidator.dart ('k') | tools/dom/src/KeyLocation.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of html; 5 part of html;
6 6
7 /** 7 /**
8 * Defines the keycode values for keys that are returned by 8 * Defines the keycode values for keys that are returned by
9 * KeyboardEvent.keyCode. 9 * KeyboardEvent.keyCode.
10 * 10 *
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 (keyCode >= NUM_ZERO && keyCode <= NUM_MULTIPLY) || 209 (keyCode >= NUM_ZERO && keyCode <= NUM_MULTIPLY) ||
210 (keyCode >= A && keyCode <= Z)) { 210 (keyCode >= A && keyCode <= Z)) {
211 return true; 211 return true;
212 } 212 }
213 213
214 // Safari sends zero key code for non-latin characters. 214 // Safari sends zero key code for non-latin characters.
215 if (Device.isWebKit && keyCode == 0) { 215 if (Device.isWebKit && keyCode == 0) {
216 return true; 216 return true;
217 } 217 }
218 218
219 return (keyCode == SPACE || keyCode == QUESTION_MARK || keyCode == NUM_PLUS 219 return (keyCode == SPACE ||
220 || keyCode == NUM_MINUS || keyCode == NUM_PERIOD || 220 keyCode == QUESTION_MARK ||
221 keyCode == NUM_DIVISION || keyCode == SEMICOLON || 221 keyCode == NUM_PLUS ||
222 keyCode == FF_SEMICOLON || keyCode == DASH || keyCode == EQUALS || 222 keyCode == NUM_MINUS ||
223 keyCode == FF_EQUALS || keyCode == COMMA || keyCode == PERIOD || 223 keyCode == NUM_PERIOD ||
224 keyCode == SLASH || keyCode == APOSTROPHE || keyCode == SINGLE_QUOTE || 224 keyCode == NUM_DIVISION ||
225 keyCode == OPEN_SQUARE_BRACKET || keyCode == BACKSLASH || 225 keyCode == SEMICOLON ||
226 keyCode == FF_SEMICOLON ||
227 keyCode == DASH ||
228 keyCode == EQUALS ||
229 keyCode == FF_EQUALS ||
230 keyCode == COMMA ||
231 keyCode == PERIOD ||
232 keyCode == SLASH ||
233 keyCode == APOSTROPHE ||
234 keyCode == SINGLE_QUOTE ||
235 keyCode == OPEN_SQUARE_BRACKET ||
236 keyCode == BACKSLASH ||
226 keyCode == CLOSE_SQUARE_BRACKET); 237 keyCode == CLOSE_SQUARE_BRACKET);
227 } 238 }
228 239
229 /** 240 /**
230 * Experimental helper function for converting keyCodes to keyNames for the 241 * Experimental helper function for converting keyCodes to keyNames for the
231 * keyIdentifier attribute still used in browsers not updated with current 242 * keyIdentifier attribute still used in browsers not updated with current
232 * spec. This is an imperfect conversion! It will need to be refined, but 243 * spec. This is an imperfect conversion! It will need to be refined, but
233 * hopefully it can just completely go away once all the browsers update to 244 * hopefully it can just completely go away once all the browsers update to
234 * follow the DOM3 spec. 245 * follow the DOM3 spec.
235 */ 246 */
236 static String _convertKeyCodeToKeyName(int keyCode) { 247 static String _convertKeyCodeToKeyName(int keyCode) {
237 switch(keyCode) { 248 switch (keyCode) {
238 case KeyCode.ALT: return _KeyName.ALT; 249 case KeyCode.ALT:
239 case KeyCode.BACKSPACE: return _KeyName.BACKSPACE; 250 return _KeyName.ALT;
240 case KeyCode.CAPS_LOCK: return _KeyName.CAPS_LOCK; 251 case KeyCode.BACKSPACE:
241 case KeyCode.CTRL: return _KeyName.CONTROL; 252 return _KeyName.BACKSPACE;
242 case KeyCode.DELETE: return _KeyName.DEL; 253 case KeyCode.CAPS_LOCK:
243 case KeyCode.DOWN: return _KeyName.DOWN; 254 return _KeyName.CAPS_LOCK;
244 case KeyCode.END: return _KeyName.END; 255 case KeyCode.CTRL:
245 case KeyCode.ENTER: return _KeyName.ENTER; 256 return _KeyName.CONTROL;
246 case KeyCode.ESC: return _KeyName.ESC; 257 case KeyCode.DELETE:
247 case KeyCode.F1: return _KeyName.F1; 258 return _KeyName.DEL;
248 case KeyCode.F2: return _KeyName.F2; 259 case KeyCode.DOWN:
249 case KeyCode.F3: return _KeyName.F3; 260 return _KeyName.DOWN;
250 case KeyCode.F4: return _KeyName.F4; 261 case KeyCode.END:
251 case KeyCode.F5: return _KeyName.F5; 262 return _KeyName.END;
252 case KeyCode.F6: return _KeyName.F6; 263 case KeyCode.ENTER:
253 case KeyCode.F7: return _KeyName.F7; 264 return _KeyName.ENTER;
254 case KeyCode.F8: return _KeyName.F8; 265 case KeyCode.ESC:
255 case KeyCode.F9: return _KeyName.F9; 266 return _KeyName.ESC;
256 case KeyCode.F10: return _KeyName.F10; 267 case KeyCode.F1:
257 case KeyCode.F11: return _KeyName.F11; 268 return _KeyName.F1;
258 case KeyCode.F12: return _KeyName.F12; 269 case KeyCode.F2:
259 case KeyCode.HOME: return _KeyName.HOME; 270 return _KeyName.F2;
260 case KeyCode.INSERT: return _KeyName.INSERT; 271 case KeyCode.F3:
261 case KeyCode.LEFT: return _KeyName.LEFT; 272 return _KeyName.F3;
262 case KeyCode.META: return _KeyName.META; 273 case KeyCode.F4:
263 case KeyCode.NUMLOCK: return _KeyName.NUM_LOCK; 274 return _KeyName.F4;
264 case KeyCode.PAGE_DOWN: return _KeyName.PAGE_DOWN; 275 case KeyCode.F5:
265 case KeyCode.PAGE_UP: return _KeyName.PAGE_UP; 276 return _KeyName.F5;
266 case KeyCode.PAUSE: return _KeyName.PAUSE; 277 case KeyCode.F6:
267 case KeyCode.PRINT_SCREEN: return _KeyName.PRINT_SCREEN; 278 return _KeyName.F6;
268 case KeyCode.RIGHT: return _KeyName.RIGHT; 279 case KeyCode.F7:
269 case KeyCode.SCROLL_LOCK: return _KeyName.SCROLL; 280 return _KeyName.F7;
270 case KeyCode.SHIFT: return _KeyName.SHIFT; 281 case KeyCode.F8:
271 case KeyCode.SPACE: return _KeyName.SPACEBAR; 282 return _KeyName.F8;
272 case KeyCode.TAB: return _KeyName.TAB; 283 case KeyCode.F9:
273 case KeyCode.UP: return _KeyName.UP; 284 return _KeyName.F9;
285 case KeyCode.F10:
286 return _KeyName.F10;
287 case KeyCode.F11:
288 return _KeyName.F11;
289 case KeyCode.F12:
290 return _KeyName.F12;
291 case KeyCode.HOME:
292 return _KeyName.HOME;
293 case KeyCode.INSERT:
294 return _KeyName.INSERT;
295 case KeyCode.LEFT:
296 return _KeyName.LEFT;
297 case KeyCode.META:
298 return _KeyName.META;
299 case KeyCode.NUMLOCK:
300 return _KeyName.NUM_LOCK;
301 case KeyCode.PAGE_DOWN:
302 return _KeyName.PAGE_DOWN;
303 case KeyCode.PAGE_UP:
304 return _KeyName.PAGE_UP;
305 case KeyCode.PAUSE:
306 return _KeyName.PAUSE;
307 case KeyCode.PRINT_SCREEN:
308 return _KeyName.PRINT_SCREEN;
309 case KeyCode.RIGHT:
310 return _KeyName.RIGHT;
311 case KeyCode.SCROLL_LOCK:
312 return _KeyName.SCROLL;
313 case KeyCode.SHIFT:
314 return _KeyName.SHIFT;
315 case KeyCode.SPACE:
316 return _KeyName.SPACEBAR;
317 case KeyCode.TAB:
318 return _KeyName.TAB;
319 case KeyCode.UP:
320 return _KeyName.UP;
274 case KeyCode.WIN_IME: 321 case KeyCode.WIN_IME:
275 case KeyCode.WIN_KEY: 322 case KeyCode.WIN_KEY:
276 case KeyCode.WIN_KEY_LEFT: 323 case KeyCode.WIN_KEY_LEFT:
277 case KeyCode.WIN_KEY_RIGHT: 324 case KeyCode.WIN_KEY_RIGHT:
278 return _KeyName.WIN; 325 return _KeyName.WIN;
279 default: return _KeyName.UNIDENTIFIED; 326 default:
327 return _KeyName.UNIDENTIFIED;
280 } 328 }
281 return _KeyName.UNIDENTIFIED; 329 return _KeyName.UNIDENTIFIED;
282 } 330 }
283 } 331 }
OLDNEW
« no previous file with comments | « tools/dom/src/Html5NodeValidator.dart ('k') | tools/dom/src/KeyLocation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698