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

Side by Side Diff: tools/dom/templates/html/impl/impl_Element.darttemplate

Issue 1014843004: Make Element.animate work in dart2js Chrome (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix line length Created 5 years, 9 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 | « tools/dom/scripts/systemhtml.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of $LIBRARYNAME; 5 part of $LIBRARYNAME;
6 6
7 class _ChildrenElementList extends ListBase<Element> 7 class _ChildrenElementList extends ListBase<Element>
8 implements NodeListWrapper { 8 implements NodeListWrapper {
9 // Raw Element. 9 // Raw Element.
10 final Element _element; 10 final Element _element;
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 /** *Deprecated*: override [attached] instead. */ 772 /** *Deprecated*: override [attached] instead. */
773 @Experimental() 773 @Experimental()
774 @deprecated 774 @deprecated
775 void enteredView() {} 775 void enteredView() {}
776 776
777 /** *Deprecated*: override [detached] instead. */ 777 /** *Deprecated*: override [detached] instead. */
778 @Experimental() 778 @Experimental()
779 @deprecated 779 @deprecated
780 void leftView() {} 780 void leftView() {}
781 781
782 $if DART2JS
783 /**
784 * Creates a new AnimationEffect object whose target element is the object
785 * on which the method is called, and calls the play() method of the
786 * AnimationTimeline object of the document timeline of the node document
787 * of the element, passing the newly created AnimationEffect as the argument
788 * to the method. Returns an AnimationPlayer for the effect.
789 *
790 * Examples
791 *
792 * var animation = elem.animate([{"opacity": 75}, {"opacity": 0 }, 200);
793 *
sra1 2015/03/18 00:20:47 1. Indent +4 2. Missing ] 3. Inconsistent space on
Alan Knight 2015/03/18 20:09:20 1. dartfmt says only +2 2. Done 3. Done
sra1 2015/03/19 02:20:46 Markdown in this doc comment starts recognizing a
Alan Knight 2015/03/23 18:57:52 Ah, I misunderstood. Done.
794 * var animation = elem.animate([
795 * {"transform": "translate(100px, -100%)"},
796 * {"transform" : "translate(400px, 500px)"}
797 * ], 1500);
798 *
799 * The [frames] parameter is a List<Map>, where the
800 * map entries specify CSS animation effects. The
801 * [timing] paramter can be a double, representing the number of milliseconds
802 * for the transition, or a Map with fields corresponding to those
803 * of the [Timing] object.
804 *
805 * This is not yet supported in Dartium.
806 **/
807 // TODO(alanknight): Correct above comment once it works in Dartium.
808 @Experimental
809 @SupportedBrowser(SupportedBrowser.CHROME, '36')
810 AnimationPlayer animate(List<Map<String, dynamic>> frames, [timing]) {
811 // If frames is an AnimationEffect, leave it alone?
sra1 2015/03/18 00:20:47 Be more defensive. Fail if not a list or Animation
Alan Knight 2015/03/18 20:09:20 Oops. It must de facto be a List, that comment was
812 var convertedFrames = frames;
813 if (convertedFrames is List) {
814 convertedFrames = frames.map(
815 (x) => convertDartToNative_Dictionary(x)).toList();
sra1 2015/03/18 00:20:47 frames.map(convertDartToNative_Dictionary).toList(
Alan Knight 2015/03/18 20:09:20 Oh yeah. Nice. Done.
816 }
817 var convertedTiming = timing;
818 if (convertedTiming is Map) {
819 convertedTiming = convertDartToNative_Dictionary(convertedTiming);
820 }
821 return _animate(convertedFrames, convertedTiming);
sra1 2015/03/18 00:20:47 What if timing is null, does it work for both is n
Alan Knight 2015/03/18 20:09:20 It seems to make no difference between 0, null, an
822 }
823
824 @DomName('Element.animate')
825 @JSName('animate')
826 @Experimental() // untriaged
827 AnimationPlayer _animate(Object effect, [timing]) native;
828 $endif
782 /** 829 /**
783 * Called by the DOM whenever an attribute on this has been changed. 830 * Called by the DOM whenever an attribute on this has been changed.
784 */ 831 */
785 void attributeChanged(String name, String oldValue, String newValue) {} 832 void attributeChanged(String name, String oldValue, String newValue) {}
786 833
787 // Hooks to support custom WebComponents. 834 // Hooks to support custom WebComponents.
788 835
789 $if DART2JS 836 $if DART2JS
790 @Creates('Null') // Set from Dart code; does not instantiate a native type. 837 @Creates('Null') // Set from Dart code; does not instantiate a native type.
791 $endif 838 $endif
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
1494 const ScrollAlignment._internal(this._value); 1541 const ScrollAlignment._internal(this._value);
1495 toString() => 'ScrollAlignment.$_value'; 1542 toString() => 'ScrollAlignment.$_value';
1496 1543
1497 /// Attempt to align the element to the top of the scrollable area. 1544 /// Attempt to align the element to the top of the scrollable area.
1498 static const TOP = const ScrollAlignment._internal('TOP'); 1545 static const TOP = const ScrollAlignment._internal('TOP');
1499 /// Attempt to center the element in the scrollable area. 1546 /// Attempt to center the element in the scrollable area.
1500 static const CENTER = const ScrollAlignment._internal('CENTER'); 1547 static const CENTER = const ScrollAlignment._internal('CENTER');
1501 /// Attempt to align the element to the bottom of the scrollable area. 1548 /// Attempt to align the element to the bottom of the scrollable area.
1502 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); 1549 static const BOTTOM = const ScrollAlignment._internal('BOTTOM');
1503 } 1550 }
OLDNEW
« no previous file with comments | « tools/dom/scripts/systemhtml.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698