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

Side by Side Diff: sdk/lib/html/dart2js/html_dart2js.dart

Issue 11887015: Add dart2js unittest to analyze the API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
1 library html; 1 library html;
2 2
3 import 'dart:async'; 3 import 'dart:async';
4 import 'dart:collection'; 4 import 'dart:collection';
5 import 'dart:html_common'; 5 import 'dart:html_common';
6 import 'dart:indexed_db'; 6 import 'dart:indexed_db';
7 import 'dart:isolate'; 7 import 'dart:isolate';
8 import 'dart:json' as json; 8 import 'dart:json' as json;
9 import 'dart:math'; 9 import 'dart:math';
10 import 'dart:svg' as svg; 10 import 'dart:svg' as svg;
11 import 'dart:web_audio' as web_audio; 11 import 'dart:web_audio' as web_audio;
12 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 12 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
13 // for details. All rights reserved. Use of this source code is governed by a 13 // for details. All rights reserved. Use of this source code is governed by a
14 // BSD-style license that can be found in the LICENSE file. 14 // BSD-style license that can be found in the LICENSE file.
15 15
16 // DO NOT EDIT 16 // DO NOT EDIT
kasperl 2013/01/15 07:25:20 This file is generated. Editing this isn't a good
Johnni Winther 2013/01/15 07:55:41 Didn't see that. Do you know what the inputs are?
kasperl 2013/01/15 08:43:48 I think in this case it is something derived from
17 // Auto-generated dart:html library. 17 // Auto-generated dart:html library.
18 18
19 19
20 // Not actually used, but imported since dart:html can generate these objects. 20 // Not actually used, but imported since dart:html can generate these objects.
21 21
22 22
23 23
24 24
25 25
26 Window get window => JS('Window', 'window'); 26 Window get window => JS('Window', 'window');
(...skipping 7364 matching lines...) Expand 10 before | Expand all | Expand 10 after
7391 return true; 7391 return true;
7392 } 7392 }
7393 }; 7393 };
7394 return false; 7394 return false;
7395 } 7395 }
7396 7396
7397 List<Element> take(int n) { 7397 List<Element> take(int n) {
7398 return new ListView<Element>(this, 0, n); 7398 return new ListView<Element>(this, 0, n);
7399 } 7399 }
7400 7400
7401 Iterable<Element> takeWhile(bool test(T value)) { 7401 Iterable<Element> takeWhile(bool test(value)) {
7402 return new TakeWhileIterable<Element>(this, test); 7402 return new TakeWhileIterable<Element>(this, test);
7403 } 7403 }
7404 7404
7405 List<Element> skip(int n) { 7405 List<Element> skip(int n) {
7406 return new ListView<Element>(this, n, null); 7406 return new ListView<Element>(this, n, null);
7407 } 7407 }
7408 7408
7409 Iterable<Element> skipWhile(bool test(T value)) { 7409 Iterable<Element> skipWhile(bool test(value)) {
7410 return new SkipWhileIterable<Element>(this, test); 7410 return new SkipWhileIterable<Element>(this, test);
7411 } 7411 }
7412 7412
7413 Element firstMatching(bool test(Element value), {Element orElse()}) { 7413 Element firstMatching(bool test(Element value), {Element orElse()}) {
7414 return Collections.firstMatching(this, test, orElse); 7414 return Collections.firstMatching(this, test, orElse);
7415 } 7415 }
7416 7416
7417 Element lastMatching(bool test(Element value), {Element orElse()}) { 7417 Element lastMatching(bool test(Element value), {Element orElse()}) {
7418 return Collections.lastMatchingInList(this, test, orElse); 7418 return Collections.lastMatchingInList(this, test, orElse);
7419 } 7419 }
(...skipping 17407 matching lines...) Expand 10 before | Expand all | Expand 10 after
24827 } 24827 }
24828 _dispatch(e); 24828 _dispatch(e);
24829 } 24829 }
24830 } 24830 }
24831 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 24831 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
24832 // for details. All rights reserved. Use of this source code is governed by a 24832 // for details. All rights reserved. Use of this source code is governed by a
24833 // BSD-style license that can be found in the LICENSE file. 24833 // BSD-style license that can be found in the LICENSE file.
24834 24834
24835 24835
24836 /** 24836 /**
24837 * Defines the keycode values for keys that are returned by 24837 * Defines the keycode values for keys that are returned by
24838 * KeyboardEvent.keyCode. 24838 * KeyboardEvent.keyCode.
24839 * 24839 *
24840 * Important note: There is substantial divergence in how different browsers 24840 * Important note: There is substantial divergence in how different browsers
24841 * handle keycodes and their variants in different locales/keyboard layouts. We 24841 * handle keycodes and their variants in different locales/keyboard layouts. We
24842 * provide these constants to help make code processing keys more readable. 24842 * provide these constants to help make code processing keys more readable.
24843 */ 24843 */
24844 abstract class KeyCode { 24844 abstract class KeyCode {
24845 // These constant names were borrowed from Closure's Keycode enumeration 24845 // These constant names were borrowed from Closure's Keycode enumeration
24846 // class. 24846 // class.
24847 // http://closure-library.googlecode.com/svn/docs/closure_goog_events_keycodes .js.source.html 24847 // http://closure-library.googlecode.com/svn/docs/closure_goog_events_keycodes .js.source.html
24848 static const int WIN_KEY_FF_LINUX = 0; 24848 static const int WIN_KEY_FF_LINUX = 0;
24849 static const int MAC_ENTER = 3; 24849 static const int MAC_ENTER = 3;
24850 static const int BACKSPACE = 8; 24850 static const int BACKSPACE = 8;
24851 static const int TAB = 9; 24851 static const int TAB = 9;
24852 /** NUM_CENTER is also NUMLOCK for FF and Safari on Mac. */ 24852 /** NUM_CENTER is also NUMLOCK for FF and Safari on Mac. */
24853 static const int NUM_CENTER = 12; 24853 static const int NUM_CENTER = 12;
24854 static const int ENTER = 13; 24854 static const int ENTER = 13;
24855 static const int SHIFT = 16; 24855 static const int SHIFT = 16;
24856 static const int CTRL = 17; 24856 static const int CTRL = 17;
24857 static const int ALT = 18; 24857 static const int ALT = 18;
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
25032 * Returns true if the keyCode produces a (US keyboard) character. 25032 * Returns true if the keyCode produces a (US keyboard) character.
25033 * Note: This does not (yet) cover characters on non-US keyboards (Russian, 25033 * Note: This does not (yet) cover characters on non-US keyboards (Russian,
25034 * Hebrew, etc.). 25034 * Hebrew, etc.).
25035 */ 25035 */
25036 static bool isCharacterKey(int keyCode) { 25036 static bool isCharacterKey(int keyCode) {
25037 if ((keyCode >= ZERO && keyCode <= NINE) || 25037 if ((keyCode >= ZERO && keyCode <= NINE) ||
25038 (keyCode >= NUM_ZERO && keyCode <= NUM_MULTIPLY) || 25038 (keyCode >= NUM_ZERO && keyCode <= NUM_MULTIPLY) ||
25039 (keyCode >= A && keyCode <= Z)) { 25039 (keyCode >= A && keyCode <= Z)) {
25040 return true; 25040 return true;
25041 } 25041 }
25042 25042
25043 // Safari sends zero key code for non-latin characters. 25043 // Safari sends zero key code for non-latin characters.
25044 if (_Device.isWebKit && keyCode == 0) { 25044 if (_Device.isWebKit && keyCode == 0) {
25045 return true; 25045 return true;
25046 } 25046 }
25047 25047
25048 return (keyCode == SPACE || keyCode == QUESTION_MARK || keyCode == NUM_PLUS 25048 return (keyCode == SPACE || keyCode == QUESTION_MARK || keyCode == NUM_PLUS
25049 || keyCode == NUM_MINUS || keyCode == NUM_PERIOD || 25049 || keyCode == NUM_MINUS || keyCode == NUM_PERIOD ||
25050 keyCode == NUM_DIVISION || keyCode == SEMICOLON || 25050 keyCode == NUM_DIVISION || keyCode == SEMICOLON ||
25051 keyCode == FF_SEMICOLON || keyCode == DASH || keyCode == EQUALS || 25051 keyCode == FF_SEMICOLON || keyCode == DASH || keyCode == EQUALS ||
25052 keyCode == FF_EQUALS || keyCode == COMMA || keyCode == PERIOD || 25052 keyCode == FF_EQUALS || keyCode == COMMA || keyCode == PERIOD ||
25053 keyCode == SLASH || keyCode == APOSTROPHE || keyCode == SINGLE_QUOTE || 25053 keyCode == SLASH || keyCode == APOSTROPHE || keyCode == SINGLE_QUOTE ||
25054 keyCode == OPEN_SQUARE_BRACKET || keyCode == BACKSLASH || 25054 keyCode == OPEN_SQUARE_BRACKET || keyCode == BACKSLASH ||
25055 keyCode == CLOSE_SQUARE_BRACKET); 25055 keyCode == CLOSE_SQUARE_BRACKET);
25056 } 25056 }
25057 } 25057 }
(...skipping 1865 matching lines...) Expand 10 before | Expand all | Expand 10 after
26923 // for details. All rights reserved. Use of this source code is governed by a 26923 // for details. All rights reserved. Use of this source code is governed by a
26924 // BSD-style license that can be found in the LICENSE file. 26924 // BSD-style license that can be found in the LICENSE file.
26925 26925
26926 26926
26927 // Iterator for arrays with fixed size. 26927 // Iterator for arrays with fixed size.
26928 class FixedSizeListIterator<T> implements Iterator<T> { 26928 class FixedSizeListIterator<T> implements Iterator<T> {
26929 final List<T> _array; 26929 final List<T> _array;
26930 final int _length; // Cache array length for faster access. 26930 final int _length; // Cache array length for faster access.
26931 int _position; 26931 int _position;
26932 T _current; 26932 T _current;
26933 26933
26934 FixedSizeListIterator(List<T> array) 26934 FixedSizeListIterator(List<T> array)
26935 : _array = array, 26935 : _array = array,
26936 _position = -1, 26936 _position = -1,
26937 _length = array.length; 26937 _length = array.length;
26938 26938
26939 bool moveNext() { 26939 bool moveNext() {
26940 int nextPosition = _position + 1; 26940 int nextPosition = _position + 1;
26941 if (nextPosition < _length) { 26941 if (nextPosition < _length) {
26942 _current = _array[nextPosition]; 26942 _current = _array[nextPosition];
26943 _position = nextPosition; 26943 _position = nextPosition;
(...skipping 24 matching lines...) Expand all
26968 _position = nextPosition; 26968 _position = nextPosition;
26969 return true; 26969 return true;
26970 } 26970 }
26971 _current = null; 26971 _current = null;
26972 _position = _array.length; 26972 _position = _array.length;
26973 return false; 26973 return false;
26974 } 26974 }
26975 26975
26976 T get current => _current; 26976 T get current => _current;
26977 } 26977 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698