OLD | NEW |
1 library html; | 1 library html; |
2 | 2 |
3 import 'dart:isolate'; | 3 import 'dart:isolate'; |
4 import 'dart:json'; | 4 import 'dart:json'; |
5 import 'dart:svg' as svg; | 5 import 'dart:svg' as svg; |
6 import 'dart:web_audio' as web_audio; | 6 import 'dart:web_audio' as web_audio; |
7 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 7 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
8 // for details. All rights reserved. Use of this source code is governed by a | 8 // for details. All rights reserved. Use of this source code is governed by a |
9 // BSD-style license that can be found in the LICENSE file. | 9 // BSD-style license that can be found in the LICENSE file. |
10 | 10 |
(...skipping 10872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10883 final e = document.$dom_createEvent("KeyboardEvent"); | 10883 final e = document.$dom_createEvent("KeyboardEvent"); |
10884 e.$dom_initKeyboardEvent(type, canBubble, cancelable, view, keyIdentifier, | 10884 e.$dom_initKeyboardEvent(type, canBubble, cancelable, view, keyIdentifier, |
10885 keyLocation, ctrlKey, altKey, shiftKey, metaKey, altGraphKey); | 10885 keyLocation, ctrlKey, altKey, shiftKey, metaKey, altGraphKey); |
10886 return e; | 10886 return e; |
10887 } | 10887 } |
10888 | 10888 |
10889 /** @domName KeyboardEvent.initKeyboardEvent */ | 10889 /** @domName KeyboardEvent.initKeyboardEvent */ |
10890 void $dom_initKeyboardEvent(String type, bool canBubble, bool cancelable, | 10890 void $dom_initKeyboardEvent(String type, bool canBubble, bool cancelable, |
10891 LocalWindow view, String keyIdentifier, int keyLocation, bool ctrlKey, | 10891 LocalWindow view, String keyIdentifier, int keyLocation, bool ctrlKey, |
10892 bool altKey, bool shiftKey, bool metaKey, bool altGraphKey) { | 10892 bool altKey, bool shiftKey, bool metaKey, bool altGraphKey) { |
10893 // initKeyEvent is the call in Firefox, initKeyboardEvent for all other | 10893 if (JS('bool', 'typeof(#.initKeyEvent) == "function"', this)) { |
10894 // browsers. | 10894 // initKeyEvent is only in Firefox (instead of initKeyboardEvent). It has |
10895 var function = JS('dynamic', '#.initKeyboardEvent || #.initKeyEvent', this, | 10895 // a slightly different signature, and allows you to specify keyCode and |
10896 this); | 10896 // charCode as the last two arguments, but we just set them as the default |
10897 JS('void', '#(#, #, #, #, #, #, #, #, #, #, #)', function, type, | 10897 // since they can't be specified in other browsers. |
10898 canBubble, cancelable, view, keyIdentifier, keyLocation, ctrlKey, | 10898 JS('void', '#.initKeyEvent(#, #, #, #, #, #, #, #, 0, 0)', this, |
10899 altKey, shiftKey, metaKey, altGraphKey); | 10899 type, canBubble, cancelable, view, |
| 10900 ctrlKey, altKey, shiftKey, metaKey); |
| 10901 } else { |
| 10902 // initKeyboardEvent is for all other browsers. |
| 10903 JS('void', '#.initKeyboardEvent(#, #, #, #, #, #, #, #, #, #, #)', this, |
| 10904 type, canBubble, cancelable, view, keyIdentifier, keyLocation, |
| 10905 ctrlKey, altKey, shiftKey, metaKey, altGraphKey); |
| 10906 } |
10900 } | 10907 } |
10901 | 10908 |
10902 /** @domName KeyboardEvent.keyCode */ | 10909 /** @domName KeyboardEvent.keyCode */ |
10903 int get keyCode => $dom_keyCode; | 10910 int get keyCode => $dom_keyCode; |
10904 | 10911 |
10905 /** @domName KeyboardEvent.charCode */ | 10912 /** @domName KeyboardEvent.charCode */ |
10906 int get charCode => $dom_charCode; | 10913 int get charCode => $dom_charCode; |
10907 | 10914 |
10908 /// @domName KeyboardEvent.altGraphKey; @docsEditable true | 10915 /// @domName KeyboardEvent.altGraphKey; @docsEditable true |
10909 final bool altGraphKey; | 10916 final bool altGraphKey; |
(...skipping 11033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21943 /** The set of functions that wish to be notified when a KeyEvent happens. */ | 21950 /** The set of functions that wish to be notified when a KeyEvent happens. */ |
21944 List<Function> _callbacks; | 21951 List<Function> _callbacks; |
21945 | 21952 |
21946 /** The type of KeyEvent we are tracking (keyup, keydown, keypress). */ | 21953 /** The type of KeyEvent we are tracking (keyup, keydown, keypress). */ |
21947 String _type; | 21954 String _type; |
21948 | 21955 |
21949 /** The element we are watching for events to happen on. */ | 21956 /** The element we are watching for events to happen on. */ |
21950 EventTarget _target; | 21957 EventTarget _target; |
21951 | 21958 |
21952 // The distance to shift from upper case alphabet Roman letters to lower case. | 21959 // The distance to shift from upper case alphabet Roman letters to lower case. |
21953 int _ROMAN_ALPHABET_OFFSET = "a".charCodes[0] - "A".charCodes[0]; | 21960 final int _ROMAN_ALPHABET_OFFSET = "a".charCodes[0] - "A".charCodes[0]; |
21954 | 21961 |
21955 // Instance members referring to the internal event handlers because closures | 21962 // Instance members referring to the internal event handlers because closures |
21956 // are not hashable. | 21963 // are not hashable. |
21957 var _keyUp, _keyDown, _keyPress; | 21964 var _keyUp, _keyDown, _keyPress; |
21958 | 21965 |
21959 /** | 21966 /** |
21960 * An enumeration of key identifiers currently part of the W3C draft for DOM3 | 21967 * An enumeration of key identifiers currently part of the W3C draft for DOM3 |
21961 * and their mappings to keyCodes. | 21968 * and their mappings to keyCodes. |
21962 * http://www.w3.org/TR/DOM-Level-3-Events/keyset.html#KeySet-Set | 21969 * http://www.w3.org/TR/DOM-Level-3-Events/keyset.html#KeySet-Set |
21963 */ | 21970 */ |
(...skipping 3044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
25008 if (length < 0) throw new ArgumentError('length'); | 25015 if (length < 0) throw new ArgumentError('length'); |
25009 if (start < 0) throw new RangeError.value(start); | 25016 if (start < 0) throw new RangeError.value(start); |
25010 int end = start + length; | 25017 int end = start + length; |
25011 if (end > a.length) throw new RangeError.value(end); | 25018 if (end > a.length) throw new RangeError.value(end); |
25012 for (int i = start; i < end; i++) { | 25019 for (int i = start; i < end; i++) { |
25013 accumulator.add(a[i]); | 25020 accumulator.add(a[i]); |
25014 } | 25021 } |
25015 return accumulator; | 25022 return accumulator; |
25016 } | 25023 } |
25017 } | 25024 } |
OLD | NEW |