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

Side by Side Diff: lib/runtime/dart/html_common.js

Issue 1887233005: Fix all dart:html strong mode errors except for spurious FINAL_NOT_INITIALIZED_CONSTRUCTOR warnings. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 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
OLDNEW
1 dart_library.library('dart/html_common', null, /* Imports */[ 1 dart_library.library('dart/html_common', null, /* Imports */[
2 'dart/_runtime', 2 'dart/_runtime',
3 'dart/_metadata', 3 'dart/_metadata',
4 'dart/core', 4 'dart/core',
5 'dart/html', 5 'dart/html',
6 'dart/typed_data', 6 'dart/typed_data',
7 'dart/_js_helper', 7 'dart/_js_helper',
8 'dart/_native_typed_data', 8 'dart/_native_typed_data',
9 'dart/async', 9 'dart/async',
10 'dart/_internal',
11 'dart/collection' 10 'dart/collection'
12 ], /* Lazy imports */[ 11 ], /* Lazy imports */[
13 'dart/web_gl' 12 ], function(exports, dart, _metadata, core, html, typed_data, _js_helper, _nativ e_typed_data, async, collection) {
14 ], function(exports, dart, _metadata, core, html, typed_data, _js_helper, _nativ e_typed_data, async, _internal, collection, web_gl) {
15 'use strict'; 13 'use strict';
16 let dartx = dart.dartx; 14 let dartx = dart.dartx;
17 dart.export(exports, _metadata); 15 dart.export(exports, _metadata);
18 const _validateToken = Symbol('_validateToken'); 16 const _validateToken = Symbol('_validateToken');
19 class CssClassSetImpl extends core.Object { 17 class CssClassSetImpl extends core.Object {
20 [_validateToken](value) { 18 [_validateToken](value) {
21 if (dart.notNull(CssClassSetImpl._validTokenRE.hasMatch(value))) return va lue; 19 if (dart.notNull(CssClassSetImpl._validTokenRE.hasMatch(value))) return va lue;
22 dart.throw(new core.ArgumentError.value(value, 'value', 'Not a valid class token')); 20 dart.throw(new core.ArgumentError.value(value, 'value', 'Not a valid class token'));
23 } 21 }
24 toString() { 22 toString() {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 if (!(typeof value == 'string')) return false; 100 if (!(typeof value == 'string')) return false;
103 let s = this.readClasses(); 101 let s = this.readClasses();
104 let result = s.remove(value); 102 let result = s.remove(value);
105 this.writeClasses(s); 103 this.writeClasses(s);
106 return result; 104 return result;
107 } 105 }
108 addAll(iterable) { 106 addAll(iterable) {
109 this.modify(dart.fn(s => s.addAll(iterable[dartx.map](dart.bind(this, _val idateToken))), dart.void, [core.Set$(core.String)])); 107 this.modify(dart.fn(s => s.addAll(iterable[dartx.map](dart.bind(this, _val idateToken))), dart.void, [core.Set$(core.String)]));
110 } 108 }
111 removeAll(iterable) { 109 removeAll(iterable) {
112 this.modify(dart.fn(s => s.removeAll(iterable[dartx.map](dart.as(dart.bind (this, _validateToken), dart.functionType(core.String, [core.Object])))), dart.v oid, [core.Set$(core.String)])); 110 this.modify(dart.fn(s => s.removeAll(iterable), dart.void, [core.Set$(core .String)]));
113 } 111 }
114 toggleAll(iterable, shouldAdd) { 112 toggleAll(iterable, shouldAdd) {
115 if (shouldAdd === void 0) shouldAdd = null; 113 if (shouldAdd === void 0) shouldAdd = null;
116 iterable[dartx.forEach](dart.fn(e => this.toggle(e, shouldAdd), core.bool, [core.String])); 114 iterable[dartx.forEach](dart.fn(e => this.toggle(e, shouldAdd), core.bool, [core.String]));
117 } 115 }
118 retainAll(iterable) { 116 retainAll(iterable) {
119 this.modify(dart.fn(s => s.retainAll(iterable), dart.void, [core.Set$(core .String)])); 117 this.modify(dart.fn(s => s.retainAll(iterable), dart.void, [core.Set$(core .String)]));
120 } 118 }
121 removeWhere(test) { 119 removeWhere(test) {
122 this.modify(dart.fn(s => s.removeWhere(test), dart.void, [core.Set$(core.S tring)])); 120 this.modify(dart.fn(s => s.removeWhere(test), dart.void, [core.Set$(core.S tring)]));
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 remove: [core.bool, [core.Object]], 206 remove: [core.bool, [core.Object]],
209 addAll: [dart.void, [core.Iterable$(core.String)]], 207 addAll: [dart.void, [core.Iterable$(core.String)]],
210 removeAll: [dart.void, [core.Iterable$(core.Object)]], 208 removeAll: [dart.void, [core.Iterable$(core.Object)]],
211 toggleAll: [dart.void, [core.Iterable$(core.String)], [core.bool]], 209 toggleAll: [dart.void, [core.Iterable$(core.String)], [core.bool]],
212 retainAll: [dart.void, [core.Iterable$(core.Object)]], 210 retainAll: [dart.void, [core.Iterable$(core.Object)]],
213 removeWhere: [dart.void, [dart.functionType(core.bool, [core.String])]], 211 removeWhere: [dart.void, [dart.functionType(core.bool, [core.String])]],
214 retainWhere: [dart.void, [dart.functionType(core.bool, [core.String])]], 212 retainWhere: [dart.void, [dart.functionType(core.bool, [core.String])]],
215 containsAll: [core.bool, [core.Iterable$(core.Object)]], 213 containsAll: [core.bool, [core.Iterable$(core.Object)]],
216 intersection: [core.Set$(core.String), [core.Set$(core.Object)]], 214 intersection: [core.Set$(core.String), [core.Set$(core.Object)]],
217 union: [core.Set$(core.String), [core.Set$(core.String)]], 215 union: [core.Set$(core.String), [core.Set$(core.String)]],
218 difference: [core.Set$(core.String), [core.Set$(core.String)]], 216 difference: [core.Set$(core.String), [core.Set$(core.Object)]],
219 toList: [core.List$(core.String), [], {growable: core.bool}], 217 toList: [core.List$(core.String), [], {growable: core.bool}],
220 toSet: [core.Set$(core.String), []], 218 toSet: [core.Set$(core.String), []],
221 take: [core.Iterable$(core.String), [core.int]], 219 take: [core.Iterable$(core.String), [core.int]],
222 takeWhile: [core.Iterable$(core.String), [dart.functionType(core.bool, [co re.String])]], 220 takeWhile: [core.Iterable$(core.String), [dart.functionType(core.bool, [co re.String])]],
223 skip: [core.Iterable$(core.String), [core.int]], 221 skip: [core.Iterable$(core.String), [core.int]],
224 skipWhile: [core.Iterable$(core.String), [dart.functionType(core.bool, [co re.String])]], 222 skipWhile: [core.Iterable$(core.String), [dart.functionType(core.bool, [co re.String])]],
225 firstWhere: [core.String, [dart.functionType(core.bool, [core.String])], { orElse: dart.functionType(core.String, [])}], 223 firstWhere: [core.String, [dart.functionType(core.bool, [core.String])], { orElse: dart.functionType(core.String, [])}],
226 lastWhere: [core.String, [dart.functionType(core.bool, [core.String])], {o rElse: dart.functionType(core.String, [])}], 224 lastWhere: [core.String, [dart.functionType(core.bool, [core.String])], {o rElse: dart.functionType(core.String, [])}],
227 singleWhere: [core.String, [dart.functionType(core.bool, [core.String])]], 225 singleWhere: [core.String, [dart.functionType(core.bool, [core.String])]],
228 elementAt: [core.String, [core.int]], 226 elementAt: [core.String, [core.int]],
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 } 421 }
424 dart.setSignature(_AcceptStructuredClone, { 422 dart.setSignature(_AcceptStructuredClone, {
425 methods: () => ({ 423 methods: () => ({
426 findSlot: [core.int, [dart.dynamic]], 424 findSlot: [core.int, [dart.dynamic]],
427 readSlot: [dart.dynamic, [core.int]], 425 readSlot: [dart.dynamic, [core.int]],
428 writeSlot: [dart.dynamic, [core.int, dart.dynamic]], 426 writeSlot: [dart.dynamic, [core.int, dart.dynamic]],
429 walk: [dart.dynamic, [dart.dynamic]], 427 walk: [dart.dynamic, [dart.dynamic]],
430 convertNativeToDart_AcceptStructuredClone: [dart.dynamic, [dart.dynamic], {mustCopy: dart.dynamic}] 428 convertNativeToDart_AcceptStructuredClone: [dart.dynamic, [dart.dynamic], {mustCopy: dart.dynamic}]
431 }) 429 })
432 }); 430 });
433 class _TypedContextAttributes extends core.Object { 431 class ContextAttributes extends core.Object {
434 _TypedContextAttributes(alpha, antialias, depth, failIfMajorPerformanceCavea t, premultipliedAlpha, preserveDrawingBuffer, stencil) { 432 ContextAttributes(alpha, antialias, depth, failIfMajorPerformanceCaveat, pre multipliedAlpha, preserveDrawingBuffer, stencil) {
435 this.alpha = alpha; 433 this.alpha = alpha;
436 this.antialias = antialias; 434 this.antialias = antialias;
437 this.depth = depth; 435 this.depth = depth;
438 this.failIfMajorPerformanceCaveat = failIfMajorPerformanceCaveat; 436 this.failIfMajorPerformanceCaveat = failIfMajorPerformanceCaveat;
439 this.premultipliedAlpha = premultipliedAlpha; 437 this.premultipliedAlpha = premultipliedAlpha;
440 this.preserveDrawingBuffer = preserveDrawingBuffer; 438 this.preserveDrawingBuffer = preserveDrawingBuffer;
441 this.stencil = stencil; 439 this.stencil = stencil;
442 } 440 }
443 } 441 }
444 _TypedContextAttributes[dart.implements] = () => [web_gl.ContextAttributes]; 442 dart.setSignature(ContextAttributes, {
445 dart.setSignature(_TypedContextAttributes, { 443 constructors: () => ({ContextAttributes: [ContextAttributes, [core.bool, cor e.bool, core.bool, core.bool, core.bool, core.bool, core.bool]]})
446 constructors: () => ({_TypedContextAttributes: [_TypedContextAttributes, [co re.bool, core.bool, core.bool, core.bool, core.bool, core.bool, core.bool]]})
447 }); 444 });
448 dart.defineExtensionMembers(_TypedContextAttributes, [
449 'alpha',
450 'alpha',
451 'antialias',
452 'antialias',
453 'depth',
454 'depth',
455 'premultipliedAlpha',
456 'premultipliedAlpha',
457 'preserveDrawingBuffer',
458 'preserveDrawingBuffer',
459 'stencil',
460 'stencil',
461 'failIfMajorPerformanceCaveat',
462 'failIfMajorPerformanceCaveat'
463 ]);
464 function convertNativeToDart_ContextAttributes(nativeContextAttributes) { 445 function convertNativeToDart_ContextAttributes(nativeContextAttributes) {
465 if (dart.is(nativeContextAttributes, web_gl.ContextAttributes)) { 446 return new ContextAttributes(dart.as(nativeContextAttributes.alpha, core.boo l), dart.as(nativeContextAttributes.antialias, core.bool), dart.as(nativeContext Attributes.depth, core.bool), dart.as(nativeContextAttributes.failIfMajorPerform anceCaveat, core.bool), dart.as(nativeContextAttributes.premultipliedAlpha, core .bool), dart.as(nativeContextAttributes.preserveDrawingBuffer, core.bool), dart. as(nativeContextAttributes.stencil, core.bool));
466 return nativeContextAttributes;
467 }
468 return new _TypedContextAttributes(dart.as(nativeContextAttributes.alpha, co re.bool), dart.as(nativeContextAttributes.antialias, core.bool), dart.as(nativeC ontextAttributes.depth, core.bool), dart.as(nativeContextAttributes.failIfMajorP erformanceCaveat, core.bool), dart.as(nativeContextAttributes.premultipliedAlpha , core.bool), dart.as(nativeContextAttributes.preserveDrawingBuffer, core.bool), dart.as(nativeContextAttributes.stencil, core.bool));
469 } 447 }
470 dart.fn(convertNativeToDart_ContextAttributes, () => dart.definiteFunctionType (web_gl.ContextAttributes, [dart.dynamic])); 448 dart.fn(convertNativeToDart_ContextAttributes);
471 class _TypedImageData extends core.Object { 449 class _TypedImageData extends core.Object {
472 _TypedImageData(data, height, width) { 450 _TypedImageData(data, height, width) {
473 this.data = data; 451 this.data = data;
474 this.height = height; 452 this.height = height;
475 this.width = width; 453 this.width = width;
476 } 454 }
477 } 455 }
478 _TypedImageData[dart.implements] = () => [html.ImageData]; 456 _TypedImageData[dart.implements] = () => [html.ImageData];
479 dart.setSignature(_TypedImageData, { 457 dart.setSignature(_TypedImageData, {
480 constructors: () => ({_TypedImageData: [_TypedImageData, [typed_data.Uint8Cl ampedList, core.int, core.int]]}) 458 constructors: () => ({_TypedImageData: [_TypedImageData, [typed_data.Uint8Cl ampedList, core.int, core.int]]})
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 } 606 }
629 dart.fn(isJavaScriptPromise, core.bool, [dart.dynamic]); 607 dart.fn(isJavaScriptPromise, core.bool, [dart.dynamic]);
630 function convertNativePromiseToDartFuture(promise) { 608 function convertNativePromiseToDartFuture(promise) {
631 let completer = async.Completer.new(); 609 let completer = async.Completer.new();
632 let then = dart.dcall(/* Unimplemented unknown name */convertDartClosureToJS , dart.fn(result => completer.complete(result), dart.void, [dart.dynamic]), 1); 610 let then = dart.dcall(/* Unimplemented unknown name */convertDartClosureToJS , dart.fn(result => completer.complete(result), dart.void, [dart.dynamic]), 1);
633 let error = dart.dcall(/* Unimplemented unknown name */convertDartClosureToJ S, dart.fn(result => completer.completeError(result), dart.void, [dart.dynamic]) , 1); 611 let error = dart.dcall(/* Unimplemented unknown name */convertDartClosureToJ S, dart.fn(result => completer.completeError(result), dart.void, [dart.dynamic]) , 1);
634 let newPromise = promise.then(then).catch(error); 612 let newPromise = promise.then(then).catch(error);
635 return completer.future; 613 return completer.future;
636 } 614 }
637 dart.fn(convertNativePromiseToDartFuture, async.Future, [dart.dynamic]); 615 dart.fn(convertNativePromiseToDartFuture, async.Future, [dart.dynamic]);
638 function wrap_jso(jsObject) {
639 return jsObject;
640 }
641 dart.fn(wrap_jso);
642 function unwrap_jso(dartClass_instance) {
643 return dartClass_instance;
644 }
645 dart.fn(unwrap_jso);
646 class Device extends core.Object { 616 class Device extends core.Object {
647 static get userAgent() { 617 static get userAgent() {
648 return html.window[dartx.navigator][dartx.userAgent]; 618 return html.window[dartx.navigator][dartx.userAgent];
649 } 619 }
650 static get isOpera() { 620 static get isOpera() {
651 if (Device._isOpera == null) { 621 if (Device._isOpera == null) {
652 Device._isOpera = Device.userAgent[dartx.contains]("Opera", 0); 622 Device._isOpera = Device.userAgent[dartx.contains]("Opera", 0);
653 } 623 }
654 return Device._isOpera; 624 return Device._isOpera;
655 } 625 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 const _childNodes = Symbol('_childNodes'); 692 const _childNodes = Symbol('_childNodes');
723 const _node = Symbol('_node'); 693 const _node = Symbol('_node');
724 const _iterable = Symbol('_iterable'); 694 const _iterable = Symbol('_iterable');
725 const _filtered = Symbol('_filtered'); 695 const _filtered = Symbol('_filtered');
726 class FilteredElementList extends collection.ListBase$(html.Element) { 696 class FilteredElementList extends collection.ListBase$(html.Element) {
727 FilteredElementList(node) { 697 FilteredElementList(node) {
728 this[_childNodes] = node[dartx.nodes]; 698 this[_childNodes] = node[dartx.nodes];
729 this[_node] = node; 699 this[_node] = node;
730 } 700 }
731 get [_iterable]() { 701 get [_iterable]() {
732 return new (_internal.WhereIterable$(html.Element))(this[_childNodes], dar t.fn(n => dart.is(n, html.Element), core.bool, [html.Element])); 702 return this[_childNodes][dartx.where](dart.fn(n => dart.is(n, html.Element ), core.bool, [html.Node]))[dartx.map](dart.fn(n => dart.as(n, html.Element), ht ml.Element, [html.Node]));
733 } 703 }
734 get [_filtered]() { 704 get [_filtered]() {
735 return core.List$(html.Element).from(this[_iterable], {growable: false}); 705 return core.List$(html.Element).from(this[_iterable], {growable: false});
736 } 706 }
737 forEach(f) { 707 forEach(f) {
738 this[_filtered][dartx.forEach](f); 708 this[_filtered][dartx.forEach](f);
739 } 709 }
740 set(index, value) { 710 set(index, value) {
741 this.get(index)[dartx.replaceWith](value); 711 this.get(index)[dartx.replaceWith](value);
742 return value; 712 return value;
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
924 lastIndexOf: [core.int, [core.List, core.Object, core.int]], 894 lastIndexOf: [core.int, [core.List, core.Object, core.int]],
925 getRange: [core.List, [core.List, core.int, core.int, core.List]] 895 getRange: [core.List, [core.List, core.int, core.int, core.List]]
926 }), 896 }),
927 names: ['indexOf', 'lastIndexOf', 'getRange'] 897 names: ['indexOf', 'lastIndexOf', 'getRange']
928 }); 898 });
929 class NodeListWrapper extends core.Object {} 899 class NodeListWrapper extends core.Object {}
930 // Exports: 900 // Exports:
931 exports.CssClassSetImpl = CssClassSetImpl; 901 exports.CssClassSetImpl = CssClassSetImpl;
932 exports.convertDartToNative_SerializedScriptValue = convertDartToNative_Serial izedScriptValue; 902 exports.convertDartToNative_SerializedScriptValue = convertDartToNative_Serial izedScriptValue;
933 exports.convertNativeToDart_SerializedScriptValue = convertNativeToDart_Serial izedScriptValue; 903 exports.convertNativeToDart_SerializedScriptValue = convertNativeToDart_Serial izedScriptValue;
904 exports.ContextAttributes = ContextAttributes;
934 exports.convertNativeToDart_ContextAttributes = convertNativeToDart_ContextAtt ributes; 905 exports.convertNativeToDart_ContextAttributes = convertNativeToDart_ContextAtt ributes;
935 exports.convertNativeToDart_ImageData = convertNativeToDart_ImageData; 906 exports.convertNativeToDart_ImageData = convertNativeToDart_ImageData;
936 exports.convertDartToNative_ImageData = convertDartToNative_ImageData; 907 exports.convertDartToNative_ImageData = convertDartToNative_ImageData;
937 exports.annotation_Creates_SerializedScriptValue = annotation_Creates_Serializ edScriptValue; 908 exports.annotation_Creates_SerializedScriptValue = annotation_Creates_Serializ edScriptValue;
938 exports.annotation_Returns_SerializedScriptValue = annotation_Returns_Serializ edScriptValue; 909 exports.annotation_Returns_SerializedScriptValue = annotation_Returns_Serializ edScriptValue;
939 exports.convertNativeToDart_Dictionary = convertNativeToDart_Dictionary; 910 exports.convertNativeToDart_Dictionary = convertNativeToDart_Dictionary;
940 exports.convertDartToNative_Dictionary = convertDartToNative_Dictionary; 911 exports.convertDartToNative_Dictionary = convertDartToNative_Dictionary;
941 exports.convertDartToNative_StringArray = convertDartToNative_StringArray; 912 exports.convertDartToNative_StringArray = convertDartToNative_StringArray;
942 exports.convertNativeToDart_DateTime = convertNativeToDart_DateTime; 913 exports.convertNativeToDart_DateTime = convertNativeToDart_DateTime;
943 exports.convertDartToNative_DateTime = convertDartToNative_DateTime; 914 exports.convertDartToNative_DateTime = convertDartToNative_DateTime;
944 exports.convertDartToNative_PrepareForStructuredClone = convertDartToNative_Pr epareForStructuredClone; 915 exports.convertDartToNative_PrepareForStructuredClone = convertDartToNative_Pr epareForStructuredClone;
945 exports.convertNativeToDart_AcceptStructuredClone = convertNativeToDart_Accept StructuredClone; 916 exports.convertNativeToDart_AcceptStructuredClone = convertNativeToDart_Accept StructuredClone;
946 exports.isJavaScriptDate = isJavaScriptDate; 917 exports.isJavaScriptDate = isJavaScriptDate;
947 exports.isJavaScriptRegExp = isJavaScriptRegExp; 918 exports.isJavaScriptRegExp = isJavaScriptRegExp;
948 exports.isJavaScriptArray = isJavaScriptArray; 919 exports.isJavaScriptArray = isJavaScriptArray;
949 exports.isJavaScriptSimpleObject = isJavaScriptSimpleObject; 920 exports.isJavaScriptSimpleObject = isJavaScriptSimpleObject;
950 exports.isImmutableJavaScriptArray = isImmutableJavaScriptArray; 921 exports.isImmutableJavaScriptArray = isImmutableJavaScriptArray;
951 exports.isJavaScriptPromise = isJavaScriptPromise; 922 exports.isJavaScriptPromise = isJavaScriptPromise;
952 exports.convertNativePromiseToDartFuture = convertNativePromiseToDartFuture; 923 exports.convertNativePromiseToDartFuture = convertNativePromiseToDartFuture;
953 exports.wrap_jso = wrap_jso;
954 exports.unwrap_jso = unwrap_jso;
955 exports.Device = Device; 924 exports.Device = Device;
956 exports.FilteredElementList = FilteredElementList; 925 exports.FilteredElementList = FilteredElementList;
957 exports.Lists = Lists; 926 exports.Lists = Lists;
958 exports.NodeListWrapper = NodeListWrapper; 927 exports.NodeListWrapper = NodeListWrapper;
959 }); 928 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698