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

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

Side-by-side diff isn't available for this file because of its large size.
Issue 2884813002: html: AudoTrackList is a List (Closed)
Patch Set: Created 3 years, 7 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:
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 8d240427c81fa2b847d98bb74ed4034c512f9e00..2fe2dceb5e8dd214bd94e696b4ea0257a6e4cf93 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -1010,7 +1010,9 @@ class AudioTrack extends Interceptor {
@DomName('AudioTrackList')
@Experimental() // untriaged
@Native("AudioTrackList")
-class AudioTrackList extends EventTarget {
+class AudioTrackList extends EventTarget
+ with ListMixin<AudioTrack>, ImmutableListMixin<AudioTrack>
+ implements JavaScriptIndexingBehavior<AudioTrack>, List<AudioTrack> {
// To suppress missing implicit constructor warnings.
factory AudioTrackList._() {
throw new UnsupportedError("Not supported");
@@ -1025,7 +1027,50 @@ class AudioTrackList extends EventTarget {
@DomName('AudioTrackList.length')
@DocsEditable()
@Experimental() // untriaged
- final int length;
+ int get length => JS("int", "#.length", this);
+
+ AudioTrack operator [](int index) {
+ if (JS("bool", "# >>> 0 !== # || # >= #", index, index, index, length))
+ throw new RangeError.index(index, this);
+ return JS("AudioTrack", "#[#]", this, index);
+ }
+
+ void operator []=(int index, AudioTrack value) {
+ throw new UnsupportedError("Cannot assign element of immutable List.");
+ }
+ // -- start List<AudioTrack> mixins.
+ // AudioTrack is the element type.
+
+ set length(int value) {
+ throw new UnsupportedError("Cannot resize immutable List.");
+ }
+
+ AudioTrack get first {
+ if (this.length > 0) {
+ return JS('AudioTrack', '#[0]', this);
+ }
+ throw new StateError("No elements");
+ }
+
+ AudioTrack get last {
+ int len = this.length;
+ if (len > 0) {
+ return JS('AudioTrack', '#[#]', this, len - 1);
+ }
+ throw new StateError("No elements");
+ }
+
+ AudioTrack get single {
+ int len = this.length;
+ if (len == 1) {
+ return JS('AudioTrack', '#[0]', this);
+ }
+ if (len == 0) throw new StateError("No elements");
+ throw new StateError("More than one element");
+ }
+
+ AudioTrack elementAt(int index) => this[index];
+ // -- end List<AudioTrack> mixins.
@DomName('AudioTrackList.__getter__')
@DocsEditable()
@@ -23080,7 +23125,9 @@ class MediaElement extends HtmlElement {
@DomName('HTMLMediaElement.audioTracks')
@DocsEditable()
@Experimental() // untriaged
- final AudioTrackList audioTracks;
+ @Returns('AudioTrackList|Null')
+ @Creates('AudioTrackList')
+ final List<AudioTrack> audioTracks;
@DomName('HTMLMediaElement.autoplay')
@DocsEditable()
« 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