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

Unified Diff: sdk/lib/html/dartium/html_dartium.dart

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 | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | tools/dom/scripts/generator.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/html/dartium/html_dartium.dart
diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart
index f7c3b61b34766aff837a2645d4ce724b6123d000..246297fe0de035492311553c45b737dd0e1662b8 100644
--- a/sdk/lib/html/dartium/html_dartium.dart
+++ b/sdk/lib/html/dartium/html_dartium.dart
@@ -2127,7 +2127,9 @@ class AudioTrack extends DartHtmlDomObject {
@DocsEditable()
@DomName('AudioTrackList')
@Experimental() // untriaged
-class AudioTrackList extends EventTarget {
+class AudioTrackList extends EventTarget
+ with ListMixin<AudioTrack>, ImmutableListMixin<AudioTrack>
+ implements List<AudioTrack> {
// To suppress missing implicit constructor warnings.
factory AudioTrackList._() {
throw new UnsupportedError("Not supported");
@@ -2150,6 +2152,51 @@ class AudioTrackList extends EventTarget {
@Experimental() // untriaged
int get length => _blink.BlinkAudioTrackList.instance.length_Getter_(this);
+ AudioTrack operator [](int index) {
+ if (index < 0 || index >= length) throw new RangeError.index(index, this);
+ return _nativeIndexedGetter(index);
+ }
+
+ AudioTrack _nativeIndexedGetter(int index) =>
+ (_blink.BlinkAudioTrackList.instance.item_Callback_1_(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 _nativeIndexedGetter(0);
+ }
+ throw new StateError("No elements");
+ }
+
+ AudioTrack get last {
+ int len = this.length;
+ if (len > 0) {
+ return _nativeIndexedGetter(len - 1);
+ }
+ throw new StateError("No elements");
+ }
+
+ AudioTrack get single {
+ int len = this.length;
+ if (len == 1) {
+ return _nativeIndexedGetter(0);
+ }
+ 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()
@Experimental() // untriaged
@@ -26178,8 +26225,8 @@ class MediaElement extends HtmlElement {
@DomName('HTMLMediaElement.audioTracks')
@DocsEditable()
@Experimental() // untriaged
- AudioTrackList get audioTracks =>
- _blink.BlinkHTMLMediaElement.instance.audioTracks_Getter_(this);
+ List<AudioTrack> get audioTracks =>
+ (_blink.BlinkHTMLMediaElement.instance.audioTracks_Getter_(this));
@DomName('HTMLMediaElement.autoplay')
@DocsEditable()
« no previous file with comments | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | tools/dom/scripts/generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698