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

Side by Side Diff: sdk/lib/svg/dart2js/svg_dart2js.dart

Issue 14036014: Updating DOM code to use list mixins (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | sdk/lib/svg/dartium/svg_dartium.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 library dart.dom.svg; 1 library dart.dom.svg;
2 2
3 import 'dart:async'; 3 import 'dart:async';
4 import 'dart:collection'; 4 import 'dart:collection';
5 import 'dart:_collection-dev'; 5 import 'dart:_collection-dev';
6 import 'dart:html'; 6 import 'dart:html';
7 import 'dart:html_common'; 7 import 'dart:html_common';
8 import 'dart:_js_helper' show Creates, Returns, JavaScriptIndexingBehavior, JSNa me; 8 import 'dart:_js_helper' show Creates, Returns, JavaScriptIndexingBehavior, JSNa me;
9 import 'dart:_foreign_helper' show JS; 9 import 'dart:_foreign_helper' show JS;
10 // DO NOT EDIT - unless you are editing documentation as per: 10 // DO NOT EDIT - unless you are editing documentation as per:
(...skipping 2988 matching lines...) Expand 10 before | Expand all | Expand 10 after
2999 @DocsEditable 2999 @DocsEditable
3000 void newValueSpecifiedUnits(int unitType, num valueInSpecifiedUnits) native; 3000 void newValueSpecifiedUnits(int unitType, num valueInSpecifiedUnits) native;
3001 } 3001 }
3002 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 3002 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
3003 // for details. All rights reserved. Use of this source code is governed by a 3003 // for details. All rights reserved. Use of this source code is governed by a
3004 // BSD-style license that can be found in the LICENSE file. 3004 // BSD-style license that can be found in the LICENSE file.
3005 3005
3006 3006
3007 @DocsEditable 3007 @DocsEditable
3008 @DomName('SVGLengthList') 3008 @DomName('SVGLengthList')
3009 class LengthList implements JavaScriptIndexingBehavior, List<Length> native "SVG LengthList" { 3009 class LengthList extends Object with ListMixin<Length>, ImmutableListMixin<Lengt h> implements JavaScriptIndexingBehavior, List<Length> native "SVGLengthList" {
3010 3010
3011 @DomName('SVGLengthList.numberOfItems') 3011 @DomName('SVGLengthList.numberOfItems')
3012 @DocsEditable 3012 @DocsEditable
3013 final int numberOfItems; 3013 final int numberOfItems;
3014 3014
3015 Length operator[](int index) => this.getItem(index); 3015 Length operator[](int index) => this.getItem(index);
3016 3016
3017 void operator[]=(int index, Length value) { 3017 void operator[]=(int index, Length value) {
3018 throw new UnsupportedError("Cannot assign element of immutable List."); 3018 throw new UnsupportedError("Cannot assign element of immutable List.");
3019 } 3019 }
3020 // -- start List<Length> mixins. 3020 // -- start List<Length> mixins.
3021 // Length is the element type. 3021 // Length is the element type.
3022 3022
3023 // From Iterable<Length>:
3024
3025 Iterator<Length> get iterator {
3026 // Note: NodeLists are not fixed size. And most probably length shouldn't
3027 // be cached in both iterator _and_ forEach method. For now caching it
3028 // for consistency.
3029 return new FixedSizeListIterator<Length>(this);
3030 }
3031
3032 // SVG Collections expose numberOfItems rather than length. 3023 // SVG Collections expose numberOfItems rather than length.
3033 int get length => numberOfItems; 3024 int get length => numberOfItems;
3034 Length reduce(Length combine(Length value, Length element)) {
3035 return IterableMixinWorkaround.reduce(this, combine);
3036 }
3037 3025
3038 dynamic fold(dynamic initialValue,
3039 dynamic combine(dynamic previousValue, Length element)) {
3040 return IterableMixinWorkaround.fold(this, initialValue, combine);
3041 }
3042
3043 bool contains(Length element) => IterableMixinWorkaround.contains(this, elemen t);
3044
3045 void forEach(void f(Length element)) => IterableMixinWorkaround.forEach(this, f);
3046
3047 String join([String separator = ""]) =>
3048 IterableMixinWorkaround.joinList(this, separator);
3049
3050 Iterable map(f(Length element)) =>
3051 IterableMixinWorkaround.mapList(this, f);
3052
3053 Iterable<Length> where(bool f(Length element)) =>
3054 IterableMixinWorkaround.where(this, f);
3055
3056 Iterable expand(Iterable f(Length element)) =>
3057 IterableMixinWorkaround.expand(this, f);
3058
3059 bool every(bool f(Length element)) => IterableMixinWorkaround.every(this, f);
3060
3061 bool any(bool f(Length element)) => IterableMixinWorkaround.any(this, f);
3062
3063 List<Length> toList({ bool growable: true }) =>
3064 new List<Length>.from(this, growable: growable);
3065
3066 Set<Length> toSet() => new Set<Length>.from(this);
3067
3068 bool get isEmpty => this.length == 0;
3069
3070 Iterable<Length> take(int n) => IterableMixinWorkaround.takeList(this, n);
3071
3072 Iterable<Length> takeWhile(bool test(Length value)) {
3073 return IterableMixinWorkaround.takeWhile(this, test);
3074 }
3075
3076 Iterable<Length> skip(int n) => IterableMixinWorkaround.skipList(this, n);
3077
3078 Iterable<Length> skipWhile(bool test(Length value)) {
3079 return IterableMixinWorkaround.skipWhile(this, test);
3080 }
3081
3082 Length firstWhere(bool test(Length value), { Length orElse() }) {
3083 return IterableMixinWorkaround.firstWhere(this, test, orElse);
3084 }
3085
3086 Length lastWhere(bool test(Length value), {Length orElse()}) {
3087 return IterableMixinWorkaround.lastWhereList(this, test, orElse);
3088 }
3089
3090 Length singleWhere(bool test(Length value)) {
3091 return IterableMixinWorkaround.singleWhere(this, test);
3092 }
3093
3094 Length elementAt(int index) {
3095 return this[index];
3096 }
3097
3098 // From Collection<Length>:
3099
3100 void add(Length value) {
3101 throw new UnsupportedError("Cannot add to immutable List.");
3102 }
3103
3104 void addAll(Iterable<Length> iterable) {
3105 throw new UnsupportedError("Cannot add to immutable List.");
3106 }
3107
3108 // From List<Length>:
3109 void set length(int value) { 3026 void set length(int value) {
3110 throw new UnsupportedError("Cannot resize immutable List."); 3027 throw new UnsupportedError("Cannot resize immutable List.");
3111 } 3028 }
3112 3029
3113 // clear() defined by IDL.
3114
3115 Iterable<Length> get reversed {
3116 return IterableMixinWorkaround.reversedList(this);
3117 }
3118
3119 void sort([int compare(Length a, Length b)]) {
3120 throw new UnsupportedError("Cannot sort immutable List.");
3121 }
3122
3123 int indexOf(Length element, [int start = 0]) =>
3124 Lists.indexOf(this, element, start, this.length);
3125
3126 int lastIndexOf(Length element, [int start]) {
3127 if (start == null) start = length - 1;
3128 return Lists.lastIndexOf(this, element, start);
3129 }
3130
3131 Length get first {
3132 if (this.length > 0) return this[0];
3133 throw new StateError("No elements");
3134 }
3135
3136 Length get last {
3137 if (this.length > 0) return this[this.length - 1];
3138 throw new StateError("No elements");
3139 }
3140
3141 Length get single {
3142 if (length == 1) return this[0];
3143 if (length == 0) throw new StateError("No elements");
3144 throw new StateError("More than one element");
3145 }
3146
3147 void insert(int index, Length element) {
3148 throw new UnsupportedError("Cannot add to immutable List.");
3149 }
3150
3151 void insertAll(int index, Iterable<Length> iterable) {
3152 throw new UnsupportedError("Cannot add to immutable List.");
3153 }
3154
3155 void setAll(int index, Iterable<Length> iterable) {
3156 throw new UnsupportedError("Cannot modify an immutable List.");
3157 }
3158
3159 Length removeAt(int pos) {
3160 throw new UnsupportedError("Cannot remove from immutable List.");
3161 }
3162
3163 Length removeLast() {
3164 throw new UnsupportedError("Cannot remove from immutable List.");
3165 }
3166
3167 bool remove(Object object) {
3168 throw new UnsupportedError("Cannot remove from immutable List.");
3169 }
3170
3171 void removeWhere(bool test(Length element)) {
3172 throw new UnsupportedError("Cannot remove from immutable List.");
3173 }
3174
3175 void retainWhere(bool test(Length element)) {
3176 throw new UnsupportedError("Cannot remove from immutable List.");
3177 }
3178
3179 void setRange(int start, int end, Iterable<Length> iterable, [int skipCount=0] ) {
3180 throw new UnsupportedError("Cannot setRange on immutable List.");
3181 }
3182
3183 void removeRange(int start, int end) {
3184 throw new UnsupportedError("Cannot removeRange on immutable List.");
3185 }
3186
3187 void replaceRange(int start, int end, Iterable<Length> iterable) {
3188 throw new UnsupportedError("Cannot modify an immutable List.");
3189 }
3190
3191 void fillRange(int start, int end, [Length fillValue]) {
3192 throw new UnsupportedError("Cannot modify an immutable List.");
3193 }
3194
3195 Iterable<Length> getRange(int start, int end) =>
3196 IterableMixinWorkaround.getRangeList(this, start, end);
3197
3198 List<Length> sublist(int start, [int end]) {
3199 if (end == null) end = length;
3200 return Lists.getRange(this, start, end, <Length>[]);
3201 }
3202
3203 Map<int, Length> asMap() =>
3204 IterableMixinWorkaround.asMapList(this);
3205
3206 String toString() {
3207 StringBuffer buffer = new StringBuffer('[');
3208 buffer.writeAll(this, ', ');
3209 buffer.write(']');
3210 return buffer.toString();
3211 }
3212
3213 // -- end List<Length> mixins. 3030 // -- end List<Length> mixins.
3214 3031
3215 @DomName('SVGLengthList.appendItem') 3032 @DomName('SVGLengthList.appendItem')
3216 @DocsEditable 3033 @DocsEditable
3217 Length appendItem(Length item) native; 3034 Length appendItem(Length item) native;
3218 3035
3219 @DomName('SVGLengthList.clear') 3036 @DomName('SVGLengthList.clear')
3220 @DocsEditable 3037 @DocsEditable
3221 void clear() native; 3038 void clear() native;
3222 3039
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
3643 @DocsEditable 3460 @DocsEditable
3644 num value; 3461 num value;
3645 } 3462 }
3646 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 3463 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
3647 // for details. All rights reserved. Use of this source code is governed by a 3464 // for details. All rights reserved. Use of this source code is governed by a
3648 // BSD-style license that can be found in the LICENSE file. 3465 // BSD-style license that can be found in the LICENSE file.
3649 3466
3650 3467
3651 @DocsEditable 3468 @DocsEditable
3652 @DomName('SVGNumberList') 3469 @DomName('SVGNumberList')
3653 class NumberList implements JavaScriptIndexingBehavior, List<Number> native "SVG NumberList" { 3470 class NumberList extends Object with ListMixin<Number>, ImmutableListMixin<Numbe r> implements JavaScriptIndexingBehavior, List<Number> native "SVGNumberList" {
3654 3471
3655 @DomName('SVGNumberList.numberOfItems') 3472 @DomName('SVGNumberList.numberOfItems')
3656 @DocsEditable 3473 @DocsEditable
3657 final int numberOfItems; 3474 final int numberOfItems;
3658 3475
3659 Number operator[](int index) => this.getItem(index); 3476 Number operator[](int index) => this.getItem(index);
3660 3477
3661 void operator[]=(int index, Number value) { 3478 void operator[]=(int index, Number value) {
3662 throw new UnsupportedError("Cannot assign element of immutable List."); 3479 throw new UnsupportedError("Cannot assign element of immutable List.");
3663 } 3480 }
3664 // -- start List<Number> mixins. 3481 // -- start List<Number> mixins.
3665 // Number is the element type. 3482 // Number is the element type.
3666 3483
3667 // From Iterable<Number>:
3668
3669 Iterator<Number> get iterator {
3670 // Note: NodeLists are not fixed size. And most probably length shouldn't
3671 // be cached in both iterator _and_ forEach method. For now caching it
3672 // for consistency.
3673 return new FixedSizeListIterator<Number>(this);
3674 }
3675
3676 // SVG Collections expose numberOfItems rather than length. 3484 // SVG Collections expose numberOfItems rather than length.
3677 int get length => numberOfItems; 3485 int get length => numberOfItems;
3678 Number reduce(Number combine(Number value, Number element)) {
3679 return IterableMixinWorkaround.reduce(this, combine);
3680 }
3681 3486
3682 dynamic fold(dynamic initialValue,
3683 dynamic combine(dynamic previousValue, Number element)) {
3684 return IterableMixinWorkaround.fold(this, initialValue, combine);
3685 }
3686
3687 bool contains(Number element) => IterableMixinWorkaround.contains(this, elemen t);
3688
3689 void forEach(void f(Number element)) => IterableMixinWorkaround.forEach(this, f);
3690
3691 String join([String separator = ""]) =>
3692 IterableMixinWorkaround.joinList(this, separator);
3693
3694 Iterable map(f(Number element)) =>
3695 IterableMixinWorkaround.mapList(this, f);
3696
3697 Iterable<Number> where(bool f(Number element)) =>
3698 IterableMixinWorkaround.where(this, f);
3699
3700 Iterable expand(Iterable f(Number element)) =>
3701 IterableMixinWorkaround.expand(this, f);
3702
3703 bool every(bool f(Number element)) => IterableMixinWorkaround.every(this, f);
3704
3705 bool any(bool f(Number element)) => IterableMixinWorkaround.any(this, f);
3706
3707 List<Number> toList({ bool growable: true }) =>
3708 new List<Number>.from(this, growable: growable);
3709
3710 Set<Number> toSet() => new Set<Number>.from(this);
3711
3712 bool get isEmpty => this.length == 0;
3713
3714 Iterable<Number> take(int n) => IterableMixinWorkaround.takeList(this, n);
3715
3716 Iterable<Number> takeWhile(bool test(Number value)) {
3717 return IterableMixinWorkaround.takeWhile(this, test);
3718 }
3719
3720 Iterable<Number> skip(int n) => IterableMixinWorkaround.skipList(this, n);
3721
3722 Iterable<Number> skipWhile(bool test(Number value)) {
3723 return IterableMixinWorkaround.skipWhile(this, test);
3724 }
3725
3726 Number firstWhere(bool test(Number value), { Number orElse() }) {
3727 return IterableMixinWorkaround.firstWhere(this, test, orElse);
3728 }
3729
3730 Number lastWhere(bool test(Number value), {Number orElse()}) {
3731 return IterableMixinWorkaround.lastWhereList(this, test, orElse);
3732 }
3733
3734 Number singleWhere(bool test(Number value)) {
3735 return IterableMixinWorkaround.singleWhere(this, test);
3736 }
3737
3738 Number elementAt(int index) {
3739 return this[index];
3740 }
3741
3742 // From Collection<Number>:
3743
3744 void add(Number value) {
3745 throw new UnsupportedError("Cannot add to immutable List.");
3746 }
3747
3748 void addAll(Iterable<Number> iterable) {
3749 throw new UnsupportedError("Cannot add to immutable List.");
3750 }
3751
3752 // From List<Number>:
3753 void set length(int value) { 3487 void set length(int value) {
3754 throw new UnsupportedError("Cannot resize immutable List."); 3488 throw new UnsupportedError("Cannot resize immutable List.");
3755 } 3489 }
3756 3490
3757 // clear() defined by IDL.
3758
3759 Iterable<Number> get reversed {
3760 return IterableMixinWorkaround.reversedList(this);
3761 }
3762
3763 void sort([int compare(Number a, Number b)]) {
3764 throw new UnsupportedError("Cannot sort immutable List.");
3765 }
3766
3767 int indexOf(Number element, [int start = 0]) =>
3768 Lists.indexOf(this, element, start, this.length);
3769
3770 int lastIndexOf(Number element, [int start]) {
3771 if (start == null) start = length - 1;
3772 return Lists.lastIndexOf(this, element, start);
3773 }
3774
3775 Number get first {
3776 if (this.length > 0) return this[0];
3777 throw new StateError("No elements");
3778 }
3779
3780 Number get last {
3781 if (this.length > 0) return this[this.length - 1];
3782 throw new StateError("No elements");
3783 }
3784
3785 Number get single {
3786 if (length == 1) return this[0];
3787 if (length == 0) throw new StateError("No elements");
3788 throw new StateError("More than one element");
3789 }
3790
3791 void insert(int index, Number element) {
3792 throw new UnsupportedError("Cannot add to immutable List.");
3793 }
3794
3795 void insertAll(int index, Iterable<Number> iterable) {
3796 throw new UnsupportedError("Cannot add to immutable List.");
3797 }
3798
3799 void setAll(int index, Iterable<Number> iterable) {
3800 throw new UnsupportedError("Cannot modify an immutable List.");
3801 }
3802
3803 Number removeAt(int pos) {
3804 throw new UnsupportedError("Cannot remove from immutable List.");
3805 }
3806
3807 Number removeLast() {
3808 throw new UnsupportedError("Cannot remove from immutable List.");
3809 }
3810
3811 bool remove(Object object) {
3812 throw new UnsupportedError("Cannot remove from immutable List.");
3813 }
3814
3815 void removeWhere(bool test(Number element)) {
3816 throw new UnsupportedError("Cannot remove from immutable List.");
3817 }
3818
3819 void retainWhere(bool test(Number element)) {
3820 throw new UnsupportedError("Cannot remove from immutable List.");
3821 }
3822
3823 void setRange(int start, int end, Iterable<Number> iterable, [int skipCount=0] ) {
3824 throw new UnsupportedError("Cannot setRange on immutable List.");
3825 }
3826
3827 void removeRange(int start, int end) {
3828 throw new UnsupportedError("Cannot removeRange on immutable List.");
3829 }
3830
3831 void replaceRange(int start, int end, Iterable<Number> iterable) {
3832 throw new UnsupportedError("Cannot modify an immutable List.");
3833 }
3834
3835 void fillRange(int start, int end, [Number fillValue]) {
3836 throw new UnsupportedError("Cannot modify an immutable List.");
3837 }
3838
3839 Iterable<Number> getRange(int start, int end) =>
3840 IterableMixinWorkaround.getRangeList(this, start, end);
3841
3842 List<Number> sublist(int start, [int end]) {
3843 if (end == null) end = length;
3844 return Lists.getRange(this, start, end, <Number>[]);
3845 }
3846
3847 Map<int, Number> asMap() =>
3848 IterableMixinWorkaround.asMapList(this);
3849
3850 String toString() {
3851 StringBuffer buffer = new StringBuffer('[');
3852 buffer.writeAll(this, ', ');
3853 buffer.write(']');
3854 return buffer.toString();
3855 }
3856
3857 // -- end List<Number> mixins. 3491 // -- end List<Number> mixins.
3858 3492
3859 @DomName('SVGNumberList.appendItem') 3493 @DomName('SVGNumberList.appendItem')
3860 @DocsEditable 3494 @DocsEditable
3861 Number appendItem(Number item) native; 3495 Number appendItem(Number item) native;
3862 3496
3863 @DomName('SVGNumberList.clear') 3497 @DomName('SVGNumberList.clear')
3864 @DocsEditable 3498 @DocsEditable
3865 void clear() native; 3499 void clear() native;
3866 3500
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
4518 @DocsEditable 4152 @DocsEditable
4519 num y; 4153 num y;
4520 } 4154 }
4521 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 4155 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
4522 // for details. All rights reserved. Use of this source code is governed by a 4156 // for details. All rights reserved. Use of this source code is governed by a
4523 // BSD-style license that can be found in the LICENSE file. 4157 // BSD-style license that can be found in the LICENSE file.
4524 4158
4525 4159
4526 @DocsEditable 4160 @DocsEditable
4527 @DomName('SVGPathSegList') 4161 @DomName('SVGPathSegList')
4528 class PathSegList implements JavaScriptIndexingBehavior, List<PathSeg> native "S VGPathSegList" { 4162 class PathSegList extends Object with ListMixin<PathSeg>, ImmutableListMixin<Pat hSeg> implements JavaScriptIndexingBehavior, List<PathSeg> native "SVGPathSegLis t" {
4529 4163
4530 @DomName('SVGPathSegList.numberOfItems') 4164 @DomName('SVGPathSegList.numberOfItems')
4531 @DocsEditable 4165 @DocsEditable
4532 final int numberOfItems; 4166 final int numberOfItems;
4533 4167
4534 PathSeg operator[](int index) => this.getItem(index); 4168 PathSeg operator[](int index) => this.getItem(index);
4535 4169
4536 void operator[]=(int index, PathSeg value) { 4170 void operator[]=(int index, PathSeg value) {
4537 throw new UnsupportedError("Cannot assign element of immutable List."); 4171 throw new UnsupportedError("Cannot assign element of immutable List.");
4538 } 4172 }
4539 // -- start List<PathSeg> mixins. 4173 // -- start List<PathSeg> mixins.
4540 // PathSeg is the element type. 4174 // PathSeg is the element type.
4541 4175
4542 // From Iterable<PathSeg>:
4543
4544 Iterator<PathSeg> get iterator {
4545 // Note: NodeLists are not fixed size. And most probably length shouldn't
4546 // be cached in both iterator _and_ forEach method. For now caching it
4547 // for consistency.
4548 return new FixedSizeListIterator<PathSeg>(this);
4549 }
4550
4551 // SVG Collections expose numberOfItems rather than length. 4176 // SVG Collections expose numberOfItems rather than length.
4552 int get length => numberOfItems; 4177 int get length => numberOfItems;
4553 PathSeg reduce(PathSeg combine(PathSeg value, PathSeg element)) {
4554 return IterableMixinWorkaround.reduce(this, combine);
4555 }
4556 4178
4557 dynamic fold(dynamic initialValue,
4558 dynamic combine(dynamic previousValue, PathSeg element)) {
4559 return IterableMixinWorkaround.fold(this, initialValue, combine);
4560 }
4561
4562 bool contains(PathSeg element) => IterableMixinWorkaround.contains(this, eleme nt);
4563
4564 void forEach(void f(PathSeg element)) => IterableMixinWorkaround.forEach(this, f);
4565
4566 String join([String separator = ""]) =>
4567 IterableMixinWorkaround.joinList(this, separator);
4568
4569 Iterable map(f(PathSeg element)) =>
4570 IterableMixinWorkaround.mapList(this, f);
4571
4572 Iterable<PathSeg> where(bool f(PathSeg element)) =>
4573 IterableMixinWorkaround.where(this, f);
4574
4575 Iterable expand(Iterable f(PathSeg element)) =>
4576 IterableMixinWorkaround.expand(this, f);
4577
4578 bool every(bool f(PathSeg element)) => IterableMixinWorkaround.every(this, f);
4579
4580 bool any(bool f(PathSeg element)) => IterableMixinWorkaround.any(this, f);
4581
4582 List<PathSeg> toList({ bool growable: true }) =>
4583 new List<PathSeg>.from(this, growable: growable);
4584
4585 Set<PathSeg> toSet() => new Set<PathSeg>.from(this);
4586
4587 bool get isEmpty => this.length == 0;
4588
4589 Iterable<PathSeg> take(int n) => IterableMixinWorkaround.takeList(this, n);
4590
4591 Iterable<PathSeg> takeWhile(bool test(PathSeg value)) {
4592 return IterableMixinWorkaround.takeWhile(this, test);
4593 }
4594
4595 Iterable<PathSeg> skip(int n) => IterableMixinWorkaround.skipList(this, n);
4596
4597 Iterable<PathSeg> skipWhile(bool test(PathSeg value)) {
4598 return IterableMixinWorkaround.skipWhile(this, test);
4599 }
4600
4601 PathSeg firstWhere(bool test(PathSeg value), { PathSeg orElse() }) {
4602 return IterableMixinWorkaround.firstWhere(this, test, orElse);
4603 }
4604
4605 PathSeg lastWhere(bool test(PathSeg value), {PathSeg orElse()}) {
4606 return IterableMixinWorkaround.lastWhereList(this, test, orElse);
4607 }
4608
4609 PathSeg singleWhere(bool test(PathSeg value)) {
4610 return IterableMixinWorkaround.singleWhere(this, test);
4611 }
4612
4613 PathSeg elementAt(int index) {
4614 return this[index];
4615 }
4616
4617 // From Collection<PathSeg>:
4618
4619 void add(PathSeg value) {
4620 throw new UnsupportedError("Cannot add to immutable List.");
4621 }
4622
4623 void addAll(Iterable<PathSeg> iterable) {
4624 throw new UnsupportedError("Cannot add to immutable List.");
4625 }
4626
4627 // From List<PathSeg>:
4628 void set length(int value) { 4179 void set length(int value) {
4629 throw new UnsupportedError("Cannot resize immutable List."); 4180 throw new UnsupportedError("Cannot resize immutable List.");
4630 } 4181 }
4631 4182
4632 // clear() defined by IDL.
4633
4634 Iterable<PathSeg> get reversed {
4635 return IterableMixinWorkaround.reversedList(this);
4636 }
4637
4638 void sort([int compare(PathSeg a, PathSeg b)]) {
4639 throw new UnsupportedError("Cannot sort immutable List.");
4640 }
4641
4642 int indexOf(PathSeg element, [int start = 0]) =>
4643 Lists.indexOf(this, element, start, this.length);
4644
4645 int lastIndexOf(PathSeg element, [int start]) {
4646 if (start == null) start = length - 1;
4647 return Lists.lastIndexOf(this, element, start);
4648 }
4649
4650 PathSeg get first {
4651 if (this.length > 0) return this[0];
4652 throw new StateError("No elements");
4653 }
4654
4655 PathSeg get last {
4656 if (this.length > 0) return this[this.length - 1];
4657 throw new StateError("No elements");
4658 }
4659
4660 PathSeg get single {
4661 if (length == 1) return this[0];
4662 if (length == 0) throw new StateError("No elements");
4663 throw new StateError("More than one element");
4664 }
4665
4666 void insert(int index, PathSeg element) {
4667 throw new UnsupportedError("Cannot add to immutable List.");
4668 }
4669
4670 void insertAll(int index, Iterable<PathSeg> iterable) {
4671 throw new UnsupportedError("Cannot add to immutable List.");
4672 }
4673
4674 void setAll(int index, Iterable<PathSeg> iterable) {
4675 throw new UnsupportedError("Cannot modify an immutable List.");
4676 }
4677
4678 PathSeg removeAt(int pos) {
4679 throw new UnsupportedError("Cannot remove from immutable List.");
4680 }
4681
4682 PathSeg removeLast() {
4683 throw new UnsupportedError("Cannot remove from immutable List.");
4684 }
4685
4686 bool remove(Object object) {
4687 throw new UnsupportedError("Cannot remove from immutable List.");
4688 }
4689
4690 void removeWhere(bool test(PathSeg element)) {
4691 throw new UnsupportedError("Cannot remove from immutable List.");
4692 }
4693
4694 void retainWhere(bool test(PathSeg element)) {
4695 throw new UnsupportedError("Cannot remove from immutable List.");
4696 }
4697
4698 void setRange(int start, int end, Iterable<PathSeg> iterable, [int skipCount=0 ]) {
4699 throw new UnsupportedError("Cannot setRange on immutable List.");
4700 }
4701
4702 void removeRange(int start, int end) {
4703 throw new UnsupportedError("Cannot removeRange on immutable List.");
4704 }
4705
4706 void replaceRange(int start, int end, Iterable<PathSeg> iterable) {
4707 throw new UnsupportedError("Cannot modify an immutable List.");
4708 }
4709
4710 void fillRange(int start, int end, [PathSeg fillValue]) {
4711 throw new UnsupportedError("Cannot modify an immutable List.");
4712 }
4713
4714 Iterable<PathSeg> getRange(int start, int end) =>
4715 IterableMixinWorkaround.getRangeList(this, start, end);
4716
4717 List<PathSeg> sublist(int start, [int end]) {
4718 if (end == null) end = length;
4719 return Lists.getRange(this, start, end, <PathSeg>[]);
4720 }
4721
4722 Map<int, PathSeg> asMap() =>
4723 IterableMixinWorkaround.asMapList(this);
4724
4725 String toString() {
4726 StringBuffer buffer = new StringBuffer('[');
4727 buffer.writeAll(this, ', ');
4728 buffer.write(']');
4729 return buffer.toString();
4730 }
4731
4732 // -- end List<PathSeg> mixins. 4183 // -- end List<PathSeg> mixins.
4733 4184
4734 @DomName('SVGPathSegList.appendItem') 4185 @DomName('SVGPathSegList.appendItem')
4735 @DocsEditable 4186 @DocsEditable
4736 PathSeg appendItem(PathSeg newItem) native; 4187 PathSeg appendItem(PathSeg newItem) native;
4737 4188
4738 @DomName('SVGPathSegList.clear') 4189 @DomName('SVGPathSegList.clear')
4739 @DocsEditable 4190 @DocsEditable
4740 void clear() native; 4191 void clear() native;
4741 4192
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
5423 @DocsEditable 4874 @DocsEditable
5424 final AnimatedNumber gradientOffset; 4875 final AnimatedNumber gradientOffset;
5425 } 4876 }
5426 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 4877 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
5427 // for details. All rights reserved. Use of this source code is governed by a 4878 // for details. All rights reserved. Use of this source code is governed by a
5428 // BSD-style license that can be found in the LICENSE file. 4879 // BSD-style license that can be found in the LICENSE file.
5429 4880
5430 4881
5431 @DocsEditable 4882 @DocsEditable
5432 @DomName('SVGStringList') 4883 @DomName('SVGStringList')
5433 class StringList implements JavaScriptIndexingBehavior, List<String> native "SVG StringList" { 4884 class StringList extends Object with ListMixin<String>, ImmutableListMixin<Strin g> implements JavaScriptIndexingBehavior, List<String> native "SVGStringList" {
5434 4885
5435 @DomName('SVGStringList.numberOfItems') 4886 @DomName('SVGStringList.numberOfItems')
5436 @DocsEditable 4887 @DocsEditable
5437 final int numberOfItems; 4888 final int numberOfItems;
5438 4889
5439 String operator[](int index) => this.getItem(index); 4890 String operator[](int index) => this.getItem(index);
5440 4891
5441 void operator[]=(int index, String value) { 4892 void operator[]=(int index, String value) {
5442 throw new UnsupportedError("Cannot assign element of immutable List."); 4893 throw new UnsupportedError("Cannot assign element of immutable List.");
5443 } 4894 }
5444 // -- start List<String> mixins. 4895 // -- start List<String> mixins.
5445 // String is the element type. 4896 // String is the element type.
5446 4897
5447 // From Iterable<String>:
5448
5449 Iterator<String> get iterator {
5450 // Note: NodeLists are not fixed size. And most probably length shouldn't
5451 // be cached in both iterator _and_ forEach method. For now caching it
5452 // for consistency.
5453 return new FixedSizeListIterator<String>(this);
5454 }
5455
5456 // SVG Collections expose numberOfItems rather than length. 4898 // SVG Collections expose numberOfItems rather than length.
5457 int get length => numberOfItems; 4899 int get length => numberOfItems;
5458 String reduce(String combine(String value, String element)) {
5459 return IterableMixinWorkaround.reduce(this, combine);
5460 }
5461 4900
5462 dynamic fold(dynamic initialValue,
5463 dynamic combine(dynamic previousValue, String element)) {
5464 return IterableMixinWorkaround.fold(this, initialValue, combine);
5465 }
5466
5467 bool contains(String element) => IterableMixinWorkaround.contains(this, elemen t);
5468
5469 void forEach(void f(String element)) => IterableMixinWorkaround.forEach(this, f);
5470
5471 String join([String separator = ""]) =>
5472 IterableMixinWorkaround.joinList(this, separator);
5473
5474 Iterable map(f(String element)) =>
5475 IterableMixinWorkaround.mapList(this, f);
5476
5477 Iterable<String> where(bool f(String element)) =>
5478 IterableMixinWorkaround.where(this, f);
5479
5480 Iterable expand(Iterable f(String element)) =>
5481 IterableMixinWorkaround.expand(this, f);
5482
5483 bool every(bool f(String element)) => IterableMixinWorkaround.every(this, f);
5484
5485 bool any(bool f(String element)) => IterableMixinWorkaround.any(this, f);
5486
5487 List<String> toList({ bool growable: true }) =>
5488 new List<String>.from(this, growable: growable);
5489
5490 Set<String> toSet() => new Set<String>.from(this);
5491
5492 bool get isEmpty => this.length == 0;
5493
5494 Iterable<String> take(int n) => IterableMixinWorkaround.takeList(this, n);
5495
5496 Iterable<String> takeWhile(bool test(String value)) {
5497 return IterableMixinWorkaround.takeWhile(this, test);
5498 }
5499
5500 Iterable<String> skip(int n) => IterableMixinWorkaround.skipList(this, n);
5501
5502 Iterable<String> skipWhile(bool test(String value)) {
5503 return IterableMixinWorkaround.skipWhile(this, test);
5504 }
5505
5506 String firstWhere(bool test(String value), { String orElse() }) {
5507 return IterableMixinWorkaround.firstWhere(this, test, orElse);
5508 }
5509
5510 String lastWhere(bool test(String value), {String orElse()}) {
5511 return IterableMixinWorkaround.lastWhereList(this, test, orElse);
5512 }
5513
5514 String singleWhere(bool test(String value)) {
5515 return IterableMixinWorkaround.singleWhere(this, test);
5516 }
5517
5518 String elementAt(int index) {
5519 return this[index];
5520 }
5521
5522 // From Collection<String>:
5523
5524 void add(String value) {
5525 throw new UnsupportedError("Cannot add to immutable List.");
5526 }
5527
5528 void addAll(Iterable<String> iterable) {
5529 throw new UnsupportedError("Cannot add to immutable List.");
5530 }
5531
5532 // From List<String>:
5533 void set length(int value) { 4901 void set length(int value) {
5534 throw new UnsupportedError("Cannot resize immutable List."); 4902 throw new UnsupportedError("Cannot resize immutable List.");
5535 } 4903 }
5536 4904
5537 // clear() defined by IDL.
5538
5539 Iterable<String> get reversed {
5540 return IterableMixinWorkaround.reversedList(this);
5541 }
5542
5543 void sort([int compare(String a, String b)]) {
5544 throw new UnsupportedError("Cannot sort immutable List.");
5545 }
5546
5547 int indexOf(String element, [int start = 0]) =>
5548 Lists.indexOf(this, element, start, this.length);
5549
5550 int lastIndexOf(String element, [int start]) {
5551 if (start == null) start = length - 1;
5552 return Lists.lastIndexOf(this, element, start);
5553 }
5554
5555 String get first {
5556 if (this.length > 0) return this[0];
5557 throw new StateError("No elements");
5558 }
5559
5560 String get last {
5561 if (this.length > 0) return this[this.length - 1];
5562 throw new StateError("No elements");
5563 }
5564
5565 String get single {
5566 if (length == 1) return this[0];
5567 if (length == 0) throw new StateError("No elements");
5568 throw new StateError("More than one element");
5569 }
5570
5571 void insert(int index, String element) {
5572 throw new UnsupportedError("Cannot add to immutable List.");
5573 }
5574
5575 void insertAll(int index, Iterable<String> iterable) {
5576 throw new UnsupportedError("Cannot add to immutable List.");
5577 }
5578
5579 void setAll(int index, Iterable<String> iterable) {
5580 throw new UnsupportedError("Cannot modify an immutable List.");
5581 }
5582
5583 String removeAt(int pos) {
5584 throw new UnsupportedError("Cannot remove from immutable List.");
5585 }
5586
5587 String removeLast() {
5588 throw new UnsupportedError("Cannot remove from immutable List.");
5589 }
5590
5591 bool remove(Object object) {
5592 throw new UnsupportedError("Cannot remove from immutable List.");
5593 }
5594
5595 void removeWhere(bool test(String element)) {
5596 throw new UnsupportedError("Cannot remove from immutable List.");
5597 }
5598
5599 void retainWhere(bool test(String element)) {
5600 throw new UnsupportedError("Cannot remove from immutable List.");
5601 }
5602
5603 void setRange(int start, int end, Iterable<String> iterable, [int skipCount=0] ) {
5604 throw new UnsupportedError("Cannot setRange on immutable List.");
5605 }
5606
5607 void removeRange(int start, int end) {
5608 throw new UnsupportedError("Cannot removeRange on immutable List.");
5609 }
5610
5611 void replaceRange(int start, int end, Iterable<String> iterable) {
5612 throw new UnsupportedError("Cannot modify an immutable List.");
5613 }
5614
5615 void fillRange(int start, int end, [String fillValue]) {
5616 throw new UnsupportedError("Cannot modify an immutable List.");
5617 }
5618
5619 Iterable<String> getRange(int start, int end) =>
5620 IterableMixinWorkaround.getRangeList(this, start, end);
5621
5622 List<String> sublist(int start, [int end]) {
5623 if (end == null) end = length;
5624 return Lists.getRange(this, start, end, <String>[]);
5625 }
5626
5627 Map<int, String> asMap() =>
5628 IterableMixinWorkaround.asMapList(this);
5629
5630 String toString() {
5631 StringBuffer buffer = new StringBuffer('[');
5632 buffer.writeAll(this, ', ');
5633 buffer.write(']');
5634 return buffer.toString();
5635 }
5636
5637 // -- end List<String> mixins. 4905 // -- end List<String> mixins.
5638 4906
5639 @DomName('SVGStringList.appendItem') 4907 @DomName('SVGStringList.appendItem')
5640 @DocsEditable 4908 @DocsEditable
5641 String appendItem(String item) native; 4909 String appendItem(String item) native;
5642 4910
5643 @DomName('SVGStringList.clear') 4911 @DomName('SVGStringList.clear')
5644 @DocsEditable 4912 @DocsEditable
5645 void clear() native; 4913 void clear() native;
5646 4914
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after
6601 @DocsEditable 5869 @DocsEditable
6602 void setTranslate(num tx, num ty) native; 5870 void setTranslate(num tx, num ty) native;
6603 } 5871 }
6604 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 5872 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
6605 // for details. All rights reserved. Use of this source code is governed by a 5873 // for details. All rights reserved. Use of this source code is governed by a
6606 // BSD-style license that can be found in the LICENSE file. 5874 // BSD-style license that can be found in the LICENSE file.
6607 5875
6608 5876
6609 @DocsEditable 5877 @DocsEditable
6610 @DomName('SVGTransformList') 5878 @DomName('SVGTransformList')
6611 class TransformList implements List<Transform>, JavaScriptIndexingBehavior nativ e "SVGTransformList" { 5879 class TransformList extends Object with ListMixin<Transform>, ImmutableListMixin <Transform> implements List<Transform>, JavaScriptIndexingBehavior native "SVGTr ansformList" {
6612 5880
6613 @DomName('SVGTransformList.numberOfItems') 5881 @DomName('SVGTransformList.numberOfItems')
6614 @DocsEditable 5882 @DocsEditable
6615 final int numberOfItems; 5883 final int numberOfItems;
6616 5884
6617 Transform operator[](int index) => this.getItem(index); 5885 Transform operator[](int index) => this.getItem(index);
6618 5886
6619 void operator[]=(int index, Transform value) { 5887 void operator[]=(int index, Transform value) {
6620 throw new UnsupportedError("Cannot assign element of immutable List."); 5888 throw new UnsupportedError("Cannot assign element of immutable List.");
6621 } 5889 }
6622 // -- start List<Transform> mixins. 5890 // -- start List<Transform> mixins.
6623 // Transform is the element type. 5891 // Transform is the element type.
6624 5892
6625 // From Iterable<Transform>:
6626
6627 Iterator<Transform> get iterator {
6628 // Note: NodeLists are not fixed size. And most probably length shouldn't
6629 // be cached in both iterator _and_ forEach method. For now caching it
6630 // for consistency.
6631 return new FixedSizeListIterator<Transform>(this);
6632 }
6633
6634 // SVG Collections expose numberOfItems rather than length. 5893 // SVG Collections expose numberOfItems rather than length.
6635 int get length => numberOfItems; 5894 int get length => numberOfItems;
6636 Transform reduce(Transform combine(Transform value, Transform element)) {
6637 return IterableMixinWorkaround.reduce(this, combine);
6638 }
6639 5895
6640 dynamic fold(dynamic initialValue,
6641 dynamic combine(dynamic previousValue, Transform element)) {
6642 return IterableMixinWorkaround.fold(this, initialValue, combine);
6643 }
6644
6645 bool contains(Transform element) => IterableMixinWorkaround.contains(this, ele ment);
6646
6647 void forEach(void f(Transform element)) => IterableMixinWorkaround.forEach(thi s, f);
6648
6649 String join([String separator = ""]) =>
6650 IterableMixinWorkaround.joinList(this, separator);
6651
6652 Iterable map(f(Transform element)) =>
6653 IterableMixinWorkaround.mapList(this, f);
6654
6655 Iterable<Transform> where(bool f(Transform element)) =>
6656 IterableMixinWorkaround.where(this, f);
6657
6658 Iterable expand(Iterable f(Transform element)) =>
6659 IterableMixinWorkaround.expand(this, f);
6660
6661 bool every(bool f(Transform element)) => IterableMixinWorkaround.every(this, f );
6662
6663 bool any(bool f(Transform element)) => IterableMixinWorkaround.any(this, f);
6664
6665 List<Transform> toList({ bool growable: true }) =>
6666 new List<Transform>.from(this, growable: growable);
6667
6668 Set<Transform> toSet() => new Set<Transform>.from(this);
6669
6670 bool get isEmpty => this.length == 0;
6671
6672 Iterable<Transform> take(int n) => IterableMixinWorkaround.takeList(this, n);
6673
6674 Iterable<Transform> takeWhile(bool test(Transform value)) {
6675 return IterableMixinWorkaround.takeWhile(this, test);
6676 }
6677
6678 Iterable<Transform> skip(int n) => IterableMixinWorkaround.skipList(this, n);
6679
6680 Iterable<Transform> skipWhile(bool test(Transform value)) {
6681 return IterableMixinWorkaround.skipWhile(this, test);
6682 }
6683
6684 Transform firstWhere(bool test(Transform value), { Transform orElse() }) {
6685 return IterableMixinWorkaround.firstWhere(this, test, orElse);
6686 }
6687
6688 Transform lastWhere(bool test(Transform value), {Transform orElse()}) {
6689 return IterableMixinWorkaround.lastWhereList(this, test, orElse);
6690 }
6691
6692 Transform singleWhere(bool test(Transform value)) {
6693 return IterableMixinWorkaround.singleWhere(this, test);
6694 }
6695
6696 Transform elementAt(int index) {
6697 return this[index];
6698 }
6699
6700 // From Collection<Transform>:
6701
6702 void add(Transform value) {
6703 throw new UnsupportedError("Cannot add to immutable List.");
6704 }
6705
6706 void addAll(Iterable<Transform> iterable) {
6707 throw new UnsupportedError("Cannot add to immutable List.");
6708 }
6709
6710 // From List<Transform>:
6711 void set length(int value) { 5896 void set length(int value) {
6712 throw new UnsupportedError("Cannot resize immutable List."); 5897 throw new UnsupportedError("Cannot resize immutable List.");
6713 } 5898 }
6714 5899
6715 // clear() defined by IDL.
6716
6717 Iterable<Transform> get reversed {
6718 return IterableMixinWorkaround.reversedList(this);
6719 }
6720
6721 void sort([int compare(Transform a, Transform b)]) {
6722 throw new UnsupportedError("Cannot sort immutable List.");
6723 }
6724
6725 int indexOf(Transform element, [int start = 0]) =>
6726 Lists.indexOf(this, element, start, this.length);
6727
6728 int lastIndexOf(Transform element, [int start]) {
6729 if (start == null) start = length - 1;
6730 return Lists.lastIndexOf(this, element, start);
6731 }
6732
6733 Transform get first {
6734 if (this.length > 0) return this[0];
6735 throw new StateError("No elements");
6736 }
6737
6738 Transform get last {
6739 if (this.length > 0) return this[this.length - 1];
6740 throw new StateError("No elements");
6741 }
6742
6743 Transform get single {
6744 if (length == 1) return this[0];
6745 if (length == 0) throw new StateError("No elements");
6746 throw new StateError("More than one element");
6747 }
6748
6749 void insert(int index, Transform element) {
6750 throw new UnsupportedError("Cannot add to immutable List.");
6751 }
6752
6753 void insertAll(int index, Iterable<Transform> iterable) {
6754 throw new UnsupportedError("Cannot add to immutable List.");
6755 }
6756
6757 void setAll(int index, Iterable<Transform> iterable) {
6758 throw new UnsupportedError("Cannot modify an immutable List.");
6759 }
6760
6761 Transform removeAt(int pos) {
6762 throw new UnsupportedError("Cannot remove from immutable List.");
6763 }
6764
6765 Transform removeLast() {
6766 throw new UnsupportedError("Cannot remove from immutable List.");
6767 }
6768
6769 bool remove(Object object) {
6770 throw new UnsupportedError("Cannot remove from immutable List.");
6771 }
6772
6773 void removeWhere(bool test(Transform element)) {
6774 throw new UnsupportedError("Cannot remove from immutable List.");
6775 }
6776
6777 void retainWhere(bool test(Transform element)) {
6778 throw new UnsupportedError("Cannot remove from immutable List.");
6779 }
6780
6781 void setRange(int start, int end, Iterable<Transform> iterable, [int skipCount =0]) {
6782 throw new UnsupportedError("Cannot setRange on immutable List.");
6783 }
6784
6785 void removeRange(int start, int end) {
6786 throw new UnsupportedError("Cannot removeRange on immutable List.");
6787 }
6788
6789 void replaceRange(int start, int end, Iterable<Transform> iterable) {
6790 throw new UnsupportedError("Cannot modify an immutable List.");
6791 }
6792
6793 void fillRange(int start, int end, [Transform fillValue]) {
6794 throw new UnsupportedError("Cannot modify an immutable List.");
6795 }
6796
6797 Iterable<Transform> getRange(int start, int end) =>
6798 IterableMixinWorkaround.getRangeList(this, start, end);
6799
6800 List<Transform> sublist(int start, [int end]) {
6801 if (end == null) end = length;
6802 return Lists.getRange(this, start, end, <Transform>[]);
6803 }
6804
6805 Map<int, Transform> asMap() =>
6806 IterableMixinWorkaround.asMapList(this);
6807
6808 String toString() {
6809 StringBuffer buffer = new StringBuffer('[');
6810 buffer.writeAll(this, ', ');
6811 buffer.write(']');
6812 return buffer.toString();
6813 }
6814
6815 // -- end List<Transform> mixins. 5900 // -- end List<Transform> mixins.
6816 5901
6817 @DomName('SVGTransformList.appendItem') 5902 @DomName('SVGTransformList.appendItem')
6818 @DocsEditable 5903 @DocsEditable
6819 Transform appendItem(Transform item) native; 5904 Transform appendItem(Transform item) native;
6820 5905
6821 @DomName('SVGTransformList.clear') 5906 @DomName('SVGTransformList.clear')
6822 @DocsEditable 5907 @DocsEditable
6823 void clear() native; 5908 void clear() native;
6824 5909
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
7140 @DocsEditable 6225 @DocsEditable
7141 final Rect zoomRectScreen; 6226 final Rect zoomRectScreen;
7142 } 6227 }
7143 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 6228 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
7144 // for details. All rights reserved. Use of this source code is governed by a 6229 // for details. All rights reserved. Use of this source code is governed by a
7145 // BSD-style license that can be found in the LICENSE file. 6230 // BSD-style license that can be found in the LICENSE file.
7146 6231
7147 6232
7148 @DocsEditable 6233 @DocsEditable
7149 @DomName('SVGElementInstanceList') 6234 @DomName('SVGElementInstanceList')
7150 class _ElementInstanceList implements JavaScriptIndexingBehavior, List<ElementIn stance> native "SVGElementInstanceList" { 6235 class _ElementInstanceList extends Object with ListMixin<ElementInstance>, Immut ableListMixin<ElementInstance> implements JavaScriptIndexingBehavior, List<Eleme ntInstance> native "SVGElementInstanceList" {
7151 6236
7152 @DomName('SVGElementInstanceList.length') 6237 @DomName('SVGElementInstanceList.length')
7153 @DocsEditable 6238 @DocsEditable
7154 int get length => JS("int", "#.length", this); 6239 int get length => JS("int", "#.length", this);
7155 6240
7156 ElementInstance operator[](int index) => this.item(index); 6241 ElementInstance operator[](int index) => this.item(index);
7157 6242
7158 void operator[]=(int index, ElementInstance value) { 6243 void operator[]=(int index, ElementInstance value) {
7159 throw new UnsupportedError("Cannot assign element of immutable List."); 6244 throw new UnsupportedError("Cannot assign element of immutable List.");
7160 } 6245 }
7161 // -- start List<ElementInstance> mixins. 6246 // -- start List<ElementInstance> mixins.
7162 // ElementInstance is the element type. 6247 // ElementInstance is the element type.
7163 6248
7164 // From Iterable<ElementInstance>:
7165 6249
7166 Iterator<ElementInstance> get iterator {
7167 // Note: NodeLists are not fixed size. And most probably length shouldn't
7168 // be cached in both iterator _and_ forEach method. For now caching it
7169 // for consistency.
7170 return new FixedSizeListIterator<ElementInstance>(this);
7171 }
7172
7173 ElementInstance reduce(ElementInstance combine(ElementInstance value, ElementI nstance element)) {
7174 return IterableMixinWorkaround.reduce(this, combine);
7175 }
7176
7177 dynamic fold(dynamic initialValue,
7178 dynamic combine(dynamic previousValue, ElementInstance element)) {
7179 return IterableMixinWorkaround.fold(this, initialValue, combine);
7180 }
7181
7182 bool contains(ElementInstance element) => IterableMixinWorkaround.contains(thi s, element);
7183
7184 void forEach(void f(ElementInstance element)) => IterableMixinWorkaround.forEa ch(this, f);
7185
7186 String join([String separator = ""]) =>
7187 IterableMixinWorkaround.joinList(this, separator);
7188
7189 Iterable map(f(ElementInstance element)) =>
7190 IterableMixinWorkaround.mapList(this, f);
7191
7192 Iterable<ElementInstance> where(bool f(ElementInstance element)) =>
7193 IterableMixinWorkaround.where(this, f);
7194
7195 Iterable expand(Iterable f(ElementInstance element)) =>
7196 IterableMixinWorkaround.expand(this, f);
7197
7198 bool every(bool f(ElementInstance element)) => IterableMixinWorkaround.every(t his, f);
7199
7200 bool any(bool f(ElementInstance element)) => IterableMixinWorkaround.any(this, f);
7201
7202 List<ElementInstance> toList({ bool growable: true }) =>
7203 new List<ElementInstance>.from(this, growable: growable);
7204
7205 Set<ElementInstance> toSet() => new Set<ElementInstance>.from(this);
7206
7207 bool get isEmpty => this.length == 0;
7208
7209 Iterable<ElementInstance> take(int n) => IterableMixinWorkaround.takeList(this , n);
7210
7211 Iterable<ElementInstance> takeWhile(bool test(ElementInstance value)) {
7212 return IterableMixinWorkaround.takeWhile(this, test);
7213 }
7214
7215 Iterable<ElementInstance> skip(int n) => IterableMixinWorkaround.skipList(this , n);
7216
7217 Iterable<ElementInstance> skipWhile(bool test(ElementInstance value)) {
7218 return IterableMixinWorkaround.skipWhile(this, test);
7219 }
7220
7221 ElementInstance firstWhere(bool test(ElementInstance value), { ElementInstance orElse() }) {
7222 return IterableMixinWorkaround.firstWhere(this, test, orElse);
7223 }
7224
7225 ElementInstance lastWhere(bool test(ElementInstance value), {ElementInstance o rElse()}) {
7226 return IterableMixinWorkaround.lastWhereList(this, test, orElse);
7227 }
7228
7229 ElementInstance singleWhere(bool test(ElementInstance value)) {
7230 return IterableMixinWorkaround.singleWhere(this, test);
7231 }
7232
7233 ElementInstance elementAt(int index) {
7234 return this[index];
7235 }
7236
7237 // From Collection<ElementInstance>:
7238
7239 void add(ElementInstance value) {
7240 throw new UnsupportedError("Cannot add to immutable List.");
7241 }
7242
7243 void addAll(Iterable<ElementInstance> iterable) {
7244 throw new UnsupportedError("Cannot add to immutable List.");
7245 }
7246
7247 // From List<ElementInstance>:
7248 void set length(int value) { 6250 void set length(int value) {
7249 throw new UnsupportedError("Cannot resize immutable List."); 6251 throw new UnsupportedError("Cannot resize immutable List.");
7250 } 6252 }
7251 6253
7252 void clear() {
7253 throw new UnsupportedError("Cannot clear immutable List.");
7254 }
7255
7256 Iterable<ElementInstance> get reversed {
7257 return IterableMixinWorkaround.reversedList(this);
7258 }
7259
7260 void sort([int compare(ElementInstance a, ElementInstance b)]) {
7261 throw new UnsupportedError("Cannot sort immutable List.");
7262 }
7263
7264 int indexOf(ElementInstance element, [int start = 0]) =>
7265 Lists.indexOf(this, element, start, this.length);
7266
7267 int lastIndexOf(ElementInstance element, [int start]) {
7268 if (start == null) start = length - 1;
7269 return Lists.lastIndexOf(this, element, start);
7270 }
7271
7272 ElementInstance get first {
7273 if (this.length > 0) return this[0];
7274 throw new StateError("No elements");
7275 }
7276
7277 ElementInstance get last {
7278 if (this.length > 0) return this[this.length - 1];
7279 throw new StateError("No elements");
7280 }
7281
7282 ElementInstance get single {
7283 if (length == 1) return this[0];
7284 if (length == 0) throw new StateError("No elements");
7285 throw new StateError("More than one element");
7286 }
7287
7288 void insert(int index, ElementInstance element) {
7289 throw new UnsupportedError("Cannot add to immutable List.");
7290 }
7291
7292 void insertAll(int index, Iterable<ElementInstance> iterable) {
7293 throw new UnsupportedError("Cannot add to immutable List.");
7294 }
7295
7296 void setAll(int index, Iterable<ElementInstance> iterable) {
7297 throw new UnsupportedError("Cannot modify an immutable List.");
7298 }
7299
7300 ElementInstance removeAt(int pos) {
7301 throw new UnsupportedError("Cannot remove from immutable List.");
7302 }
7303
7304 ElementInstance removeLast() {
7305 throw new UnsupportedError("Cannot remove from immutable List.");
7306 }
7307
7308 bool remove(Object object) {
7309 throw new UnsupportedError("Cannot remove from immutable List.");
7310 }
7311
7312 void removeWhere(bool test(ElementInstance element)) {
7313 throw new UnsupportedError("Cannot remove from immutable List.");
7314 }
7315
7316 void retainWhere(bool test(ElementInstance element)) {
7317 throw new UnsupportedError("Cannot remove from immutable List.");
7318 }
7319
7320 void setRange(int start, int end, Iterable<ElementInstance> iterable, [int ski pCount=0]) {
7321 throw new UnsupportedError("Cannot setRange on immutable List.");
7322 }
7323
7324 void removeRange(int start, int end) {
7325 throw new UnsupportedError("Cannot removeRange on immutable List.");
7326 }
7327
7328 void replaceRange(int start, int end, Iterable<ElementInstance> iterable) {
7329 throw new UnsupportedError("Cannot modify an immutable List.");
7330 }
7331
7332 void fillRange(int start, int end, [ElementInstance fillValue]) {
7333 throw new UnsupportedError("Cannot modify an immutable List.");
7334 }
7335
7336 Iterable<ElementInstance> getRange(int start, int end) =>
7337 IterableMixinWorkaround.getRangeList(this, start, end);
7338
7339 List<ElementInstance> sublist(int start, [int end]) {
7340 if (end == null) end = length;
7341 return Lists.getRange(this, start, end, <ElementInstance>[]);
7342 }
7343
7344 Map<int, ElementInstance> asMap() =>
7345 IterableMixinWorkaround.asMapList(this);
7346
7347 String toString() {
7348 StringBuffer buffer = new StringBuffer('[');
7349 buffer.writeAll(this, ', ');
7350 buffer.write(']');
7351 return buffer.toString();
7352 }
7353
7354 // -- end List<ElementInstance> mixins. 6254 // -- end List<ElementInstance> mixins.
7355 6255
7356 @DomName('SVGElementInstanceList.item') 6256 @DomName('SVGElementInstanceList.item')
7357 @DocsEditable 6257 @DocsEditable
7358 ElementInstance item(int index) native; 6258 ElementInstance item(int index) native;
7359 } 6259 }
7360 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 6260 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
7361 // for details. All rights reserved. Use of this source code is governed by a 6261 // for details. All rights reserved. Use of this source code is governed by a
7362 // BSD-style license that can be found in the LICENSE file. 6262 // BSD-style license that can be found in the LICENSE file.
7363 6263
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
7626 6526
7627 6527
7628 @DocsEditable 6528 @DocsEditable
7629 @DomName('SVGVKernElement') 6529 @DomName('SVGVKernElement')
7630 abstract class _SVGVKernElement extends SvgElement native "SVGVKernElement" { 6530 abstract class _SVGVKernElement extends SvgElement native "SVGVKernElement" {
7631 6531
7632 @DomName('SVGVKernElement.SVGVKernElement') 6532 @DomName('SVGVKernElement.SVGVKernElement')
7633 @DocsEditable 6533 @DocsEditable
7634 factory _SVGVKernElement() => _SvgElementFactoryProvider.createSvgElement_tag( "vkern"); 6534 factory _SVGVKernElement() => _SvgElementFactoryProvider.createSvgElement_tag( "vkern");
7635 } 6535 }
OLDNEW
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | sdk/lib/svg/dartium/svg_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698