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

Unified Diff: sdk/lib/html/dart2js/html_dart2js.dart

Issue 11299267: Fixed up signature for initKeyEvent vs initKeyboardEvent. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: refactor Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/html/dart2js/html_dart2js.dart
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
index 09f9f04a2c80669806c812e68ce538697551ddf3..3105b0c0a55d5fef0c8b187b89b051aba66a28b1 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -10890,13 +10890,20 @@ class KeyboardEvent extends UIEvent native "*KeyboardEvent" {
void $dom_initKeyboardEvent(String type, bool canBubble, bool cancelable,
LocalWindow view, String keyIdentifier, int keyLocation, bool ctrlKey,
bool altKey, bool shiftKey, bool metaKey, bool altGraphKey) {
- // initKeyEvent is the call in Firefox, initKeyboardEvent for all other
- // browsers.
- var function = JS('dynamic', '#.initKeyboardEvent || #.initKeyEvent', this,
- this);
- JS('void', '#(#, #, #, #, #, #, #, #, #, #, #)', function, type,
- canBubble, cancelable, view, keyIdentifier, keyLocation, ctrlKey,
- altKey, shiftKey, metaKey, altGraphKey);
+ if (JS('bool', 'typeof(#.initKeyEvent) == "function"', this)) {
+ // initKeyEvent is only in Firefox (instead of initKeyboardEvent). It has
+ // a slightly different signature, and allows you to specify keyCode and
+ // charCode as the last two arguments, but we just set them as the default
+ // since they can't be specified in other browsers.
+ JS('void', '#.initKeyEvent(#, #, #, #, #, #, #, #, 0, 0)', this,
+ type, canBubble, cancelable, view,
+ ctrlKey, altKey, shiftKey, metaKey);
+ } else {
+ // initKeyboardEvent is for all other browsers.
+ JS('void', '#.initKeyboardEvent(#, #, #, #, #, #, #, #, #, #, #)', this,
+ type, canBubble, cancelable, view, keyIdentifier, keyLocation,
+ ctrlKey, altKey, shiftKey, metaKey, altGraphKey);
+ }
}
/** @domName KeyboardEvent.keyCode */
@@ -21950,7 +21957,7 @@ class KeyboardEventController {
EventTarget _target;
// The distance to shift from upper case alphabet Roman letters to lower case.
- int _ROMAN_ALPHABET_OFFSET = "a".charCodes[0] - "A".charCodes[0];
+ final int _ROMAN_ALPHABET_OFFSET = "a".charCodes[0] - "A".charCodes[0];
// Instance members referring to the internal event handlers because closures
// are not hashable.
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698