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

Side by Side Diff: sdk/lib/html/src/KeyCode.dart

Issue 11416249: Make KeyboardEvent cross-browser consistent. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: moved instance variables to constructor Created 8 years 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 | Annotate | Revision Log
« no previous file with comments | « sdk/lib/html/scripts/htmlrenamer.py ('k') | sdk/lib/html/src/KeyboardEventController.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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 */ 188 */
189 static const int BACKSLASH = 220; 189 static const int BACKSLASH = 220;
190 /** 190 /**
191 * CAUTION: This constant requires localization for other locales and keyboard 191 * CAUTION: This constant requires localization for other locales and keyboard
192 * layouts. 192 * layouts.
193 */ 193 */
194 static const int CLOSE_SQUARE_BRACKET = 221; 194 static const int CLOSE_SQUARE_BRACKET = 221;
195 static const int WIN_KEY = 224; 195 static const int WIN_KEY = 224;
196 static const int MAC_FF_META = 224; 196 static const int MAC_FF_META = 224;
197 static const int WIN_IME = 229; 197 static const int WIN_IME = 229;
198
199 /** A sentinel value if the keycode could not be determined. */
200 static const int UNKNOWN = -1;
201
202 /**
203 * Returns true if the keyCode produces a (US keyboard) character.
204 * Note: This does not (yet) cover characters on non-US keyboards (Russian,
205 * Hebrew, etc.).
206 */
207 static bool isCharacterKey(int keyCode) {
208 if ((keyCode >= ZERO && keyCode <= NINE) ||
209 (keyCode >= NUM_ZERO && keyCode <= NUM_MULTIPLY) ||
210 (keyCode >= A && keyCode <= Z)) {
211 return true;
212 }
213
214 // Safari sends zero key code for non-latin characters.
215 if (_Device.isWebKit && keyCode == 0) {
216 return true;
217 }
218
219 return (keyCode == SPACE || keyCode == QUESTION_MARK || keyCode == NUM_PLUS
220 || keyCode == NUM_MINUS || keyCode == NUM_PERIOD ||
221 keyCode == NUM_DIVISION || keyCode == SEMICOLON ||
222 keyCode == FF_SEMICOLON || keyCode == DASH || keyCode == EQUALS ||
223 keyCode == FF_EQUALS || keyCode == COMMA || keyCode == PERIOD ||
224 keyCode == SLASH || keyCode == APOSTROPHE || keyCode == SINGLE_QUOTE ||
225 keyCode == OPEN_SQUARE_BRACKET || keyCode == BACKSLASH ||
226 keyCode == CLOSE_SQUARE_BRACKET);
227 }
198 } 228 }
OLDNEW
« no previous file with comments | « sdk/lib/html/scripts/htmlrenamer.py ('k') | sdk/lib/html/src/KeyboardEventController.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698