OLD | NEW |
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 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 /** *Deprecated*: override [detached] instead. */ | 789 /** *Deprecated*: override [detached] instead. */ |
790 @Experimental() | 790 @Experimental() |
791 @deprecated | 791 @deprecated |
792 void leftView() {} | 792 void leftView() {} |
793 | 793 |
794 /** | 794 /** |
795 * Creates a new AnimationEffect object whose target element is the object | 795 * Creates a new AnimationEffect object whose target element is the object |
796 * on which the method is called, and calls the play() method of the | 796 * on which the method is called, and calls the play() method of the |
797 * AnimationTimeline object of the document timeline of the node document | 797 * AnimationTimeline object of the document timeline of the node document |
798 * of the element, passing the newly created AnimationEffect as the argument | 798 * of the element, passing the newly created AnimationEffect as the argument |
799 * to the method. Returns an AnimationPlayer for the effect. | 799 * to the method. Returns an Animation for the effect. |
800 * | 800 * |
801 * Examples | 801 * Examples |
802 * | 802 * |
803 * var animation = elem.animate([{"opacity": 75}, {"opacity": 0}], 200); | 803 * var animation = elem.animate([{"opacity": 75}, {"opacity": 0}], 200); |
804 * | 804 * |
805 * var animation = elem.animate([ | 805 * var animation = elem.animate([ |
806 * {"transform": "translate(100px, -100%)"}, | 806 * {"transform": "translate(100px, -100%)"}, |
807 * {"transform" : "translate(400px, 500px)"} | 807 * {"transform" : "translate(400px, 500px)"} |
808 * ], 1500); | 808 * ], 1500); |
809 * | 809 * |
810 * The [frames] parameter is an Iterable<Map>, where the | 810 * The [frames] parameter is an Iterable<Map>, where the |
811 * map entries specify CSS animation effects. The | 811 * map entries specify CSS animation effects. The |
812 * [timing] paramter can be a double, representing the number of milliseconds | 812 * [timing] paramter can be a double, representing the number of milliseconds |
813 * for the transition, or a Map with fields corresponding to those | 813 * for the transition, or a Map with fields corresponding to those |
814 * of the [Timing] object. | 814 * of the [Timing] object. |
815 **/ | 815 **/ |
816 @Experimental() | 816 @Experimental() |
817 @SupportedBrowser(SupportedBrowser.CHROME, '36') | 817 @SupportedBrowser(SupportedBrowser.CHROME, '36') |
818 AnimationPlayer animate(Iterable<Map<String, dynamic>> frames, [timing]) { | 818 Animation animate(Iterable<Map<String, dynamic>> frames, [timing]) { |
819 if (frames is! Iterable || !(frames.every((x) => x is Map))) { | 819 if (frames is! Iterable || !(frames.every((x) => x is Map))) { |
820 throw new ArgumentError("The frames parameter should be a List of Maps " | 820 throw new ArgumentError("The frames parameter should be a List of Maps " |
821 "with frame information"); | 821 "with frame information"); |
822 } | 822 } |
823 var convertedFrames = frames; | 823 var convertedFrames = frames; |
824 if (convertedFrames is Iterable) { | 824 if (convertedFrames is Iterable) { |
825 $if DART2JS | 825 $if DART2JS |
826 convertedFrames = frames.map(convertDartToNative_Dictionary).toList(); | 826 convertedFrames = frames.map(convertDartToNative_Dictionary).toList(); |
827 $else | 827 $else |
828 convertedFrames = convertDartToNative_List( | 828 convertedFrames = convertDartToNative_List( |
829 frames.map(convertDartToNative_Dictionary).toList()); | 829 frames.map(convertDartToNative_Dictionary).toList()); |
830 $endif | 830 $endif |
831 } | 831 } |
832 var convertedTiming = timing; | 832 var convertedTiming = timing; |
833 if (convertedTiming is Map) { | 833 if (convertedTiming is Map) { |
834 convertedTiming = convertDartToNative_Dictionary(convertedTiming); | 834 convertedTiming = convertDartToNative_Dictionary(convertedTiming); |
835 } | 835 } |
836 return convertedTiming == null | 836 return convertedTiming == null |
837 ? _animate(convertedFrames) | 837 ? _animate(convertedFrames) |
838 : _animate(convertedFrames, convertedTiming); | 838 : _animate(convertedFrames, convertedTiming); |
839 } | 839 } |
840 | 840 |
841 $if DART2JS | 841 $if DART2JS |
842 @DomName('Element.animate') | 842 @DomName('Element.animate') |
843 @JSName('animate') | 843 @JSName('animate') |
844 @Experimental() // untriaged | 844 @Experimental() // untriaged |
845 AnimationPlayer _animate(Object effect, [timing]) native; | 845 Animation _animate(Object effect, [timing]) native; |
846 $endif | 846 $endif |
847 /** | 847 /** |
848 * Called by the DOM whenever an attribute on this has been changed. | 848 * Called by the DOM whenever an attribute on this has been changed. |
849 */ | 849 */ |
850 void attributeChanged(String name, String oldValue, String newValue) {} | 850 void attributeChanged(String name, String oldValue, String newValue) {} |
851 | 851 |
852 // Hooks to support custom WebComponents. | 852 // Hooks to support custom WebComponents. |
853 | 853 |
854 $if DART2JS | 854 $if DART2JS |
855 @Creates('Null') // Set from Dart code; does not instantiate a native type. | 855 @Creates('Null') // Set from Dart code; does not instantiate a native type. |
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1513 String result = 'element tag unavailable'; | 1513 String result = 'element tag unavailable'; |
1514 try { | 1514 try { |
1515 if (element.tagName is String) { | 1515 if (element.tagName is String) { |
1516 result = element.tagName; | 1516 result = element.tagName; |
1517 } | 1517 } |
1518 } catch (e) {} | 1518 } catch (e) {} |
1519 return result; | 1519 return result; |
1520 } | 1520 } |
1521 | 1521 |
1522 $if DART2JS | 1522 $if DART2JS |
| 1523 @DomName('Element.offsetParent') |
| 1524 @DocsEditable() |
| 1525 final Element offsetParent; |
| 1526 |
1523 @DomName('Element.offsetHeight') | 1527 @DomName('Element.offsetHeight') |
1524 @DocsEditable() | 1528 @DocsEditable() |
1525 int get offsetHeight => JS('num', '#.offsetHeight', this).round(); | 1529 int get offsetHeight => JS('num', '#.offsetHeight', this).round(); |
1526 | 1530 |
1527 @DomName('Element.offsetLeft') | 1531 @DomName('Element.offsetLeft') |
1528 @DocsEditable() | 1532 @DocsEditable() |
1529 int get offsetLeft => JS('num', '#.offsetLeft', this).round(); | 1533 int get offsetLeft => JS('num', '#.offsetLeft', this).round(); |
1530 | 1534 |
1531 @DomName('Element.offsetTop') | 1535 @DomName('Element.offsetTop') |
1532 @DocsEditable() | 1536 @DocsEditable() |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1574 @DocsEditable() | 1578 @DocsEditable() |
1575 set scrollTop(int value) { | 1579 set scrollTop(int value) { |
1576 JS("void", "#.scrollTop = #", this, value.round()); | 1580 JS("void", "#.scrollTop = #", this, value.round()); |
1577 } | 1581 } |
1578 | 1582 |
1579 @DomName('Element.scrollWidth') | 1583 @DomName('Element.scrollWidth') |
1580 @DocsEditable() | 1584 @DocsEditable() |
1581 int get scrollWidth => JS('num', '#.scrollWidth', this).round(); | 1585 int get scrollWidth => JS('num', '#.scrollWidth', this).round(); |
1582 | 1586 |
1583 $else | 1587 $else |
1584 $if JSINTEROP | |
1585 // Need to explicitly delegate because Element is no longer abstract for Darti
um. | 1588 // Need to explicitly delegate because Element is no longer abstract for Darti
um. |
1586 bool get isContentEditable => _blink.BlinkHTMLElement.instance.isContentEditab
le_Getter_(unwrap_jso(this)); | 1589 bool get isContentEditable => _blink.BlinkHTMLElement.instance.isContentEditab
le_Getter_(unwrap_jso(this)); |
1587 void click() => _blink.BlinkHTMLElement.instance.click_Callback_0_(unwrap_jso(
this)); | 1590 void click() => _blink.BlinkHTMLElement.instance.click_Callback_0_(unwrap_jso(
this)); |
1588 | 1591 |
| 1592 @DomName('Element.offsetParent') |
| 1593 @DocsEditable() |
| 1594 Element get offsetParent => wrap_jso(_blink.BlinkElement.instance.offsetParent
_Getter_(unwrap_jso(this))); |
| 1595 |
1589 @DomName('Element.offsetHeight') | 1596 @DomName('Element.offsetHeight') |
1590 @DocsEditable() | 1597 @DocsEditable() |
1591 int get offsetHeight => _blink.BlinkElement.instance.offsetHeight_Getter_(unwr
ap_jso(this)).round(); | 1598 int get offsetHeight => _blink.BlinkElement.instance.offsetHeight_Getter_(unwr
ap_jso(this)); |
1592 | 1599 |
1593 @DomName('Element.offsetLeft') | 1600 @DomName('Element.offsetLeft') |
1594 @DocsEditable() | 1601 @DocsEditable() |
1595 int get offsetLeft => _blink.BlinkElement.instance.offsetLeft_Getter_(unwrap_j
so(this)).round(); | 1602 int get offsetLeft => _blink.BlinkElement.instance.offsetLeft_Getter_(unwrap_j
so(this)); |
1596 | 1603 |
1597 @DomName('Element.offsetTop') | 1604 @DomName('Element.offsetTop') |
1598 @DocsEditable() | 1605 @DocsEditable() |
1599 int get offsetTop => _blink.BlinkElement.instance.offsetTop_Getter_(unwrap_jso
(this)).round(); | 1606 int get offsetTop => _blink.BlinkElement.instance.offsetTop_Getter_(unwrap_jso
(this)); |
1600 | 1607 |
1601 @DomName('Element.offsetWidth') | 1608 @DomName('Element.offsetWidth') |
1602 @DocsEditable() | 1609 @DocsEditable() |
1603 int get offsetWidth => _blink.BlinkElement.instance.offsetWidth_Getter_(unwrap
_jso(this)).round(); | 1610 int get offsetWidth => _blink.BlinkElement.instance.offsetWidth_Getter_(unwrap
_jso(this)); |
1604 | |
1605 @DomName('Element.clientHeight') | |
1606 @DocsEditable() | |
1607 int get clientHeight => _blink.BlinkElement.instance.clientHeight_Getter_(unwr
ap_jso(this)).round(); | |
1608 | |
1609 @DomName('Element.clientLeft') | |
1610 @DocsEditable() | |
1611 int get clientLeft => _blink.BlinkElement.instance.clientLeft_Getter_(unwrap_j
so(this)).round(); | |
1612 | |
1613 @DomName('Element.clientTop') | |
1614 @DocsEditable() | |
1615 int get clientTop => _blink.BlinkElement.instance.clientTop_Getter_(unwrap_jso
(this)).round(); | |
1616 | |
1617 @DomName('Element.clientWidth') | |
1618 @DocsEditable() | |
1619 int get clientWidth => _blink.BlinkElement.instance.clientWidth_Getter_(unwrap
_jso(this)).round(); | |
1620 | 1611 |
1621 @DomName('Element.scrollHeight') | 1612 @DomName('Element.scrollHeight') |
1622 @DocsEditable() | 1613 @DocsEditable() |
1623 int get scrollHeight => _blink.BlinkElement.instance.scrollHeight_Getter_(unwr
ap_jso(this)).round(); | 1614 int get scrollHeight => _blink.BlinkElement.instance.scrollHeight_Getter_(unwr
ap_jso(this)).round(); |
1624 | 1615 |
1625 @DomName('Element.scrollLeft') | 1616 @DomName('Element.scrollLeft') |
1626 @DocsEditable() | 1617 @DocsEditable() |
1627 int get scrollLeft => _blink.BlinkElement.instance.scrollLeft_Getter_(unwrap_j
so(this)).round(); | 1618 int get scrollLeft => _blink.BlinkElement.instance.scrollLeft_Getter_(unwrap_j
so(this)).round(); |
1628 | 1619 |
1629 @DomName('Element.scrollLeft') | 1620 @DomName('Element.scrollLeft') |
1630 @DocsEditable() | 1621 @DocsEditable() |
1631 set scrollLeft(int value) => _blink.BlinkElement.instance.scrollLeft_Setter_(u
nwrap_jso(this), value.round()); | 1622 set scrollLeft(int value) => _blink.BlinkElement.instance.scrollLeft_Setter_(u
nwrap_jso(this), value.round()); |
1632 | 1623 |
1633 @DomName('Element.scrollTop') | 1624 @DomName('Element.scrollTop') |
1634 @DocsEditable() | 1625 @DocsEditable() |
1635 int get scrollTop => _blink.BlinkElement.instance.scrollTop_Getter_(unwrap_jso
(this)).round(); | 1626 int get scrollTop => _blink.BlinkElement.instance.scrollTop_Getter_(unwrap_jso
(this)).round(); |
1636 | 1627 |
1637 @DomName('Element.scrollTop') | 1628 @DomName('Element.scrollTop') |
1638 @DocsEditable() | 1629 @DocsEditable() |
1639 set scrollTop(int value) => _blink.BlinkElement.instance.scrollTop_Setter_(unw
rap_jso(this), value.round()); | 1630 set scrollTop(int value) => _blink.BlinkElement.instance.scrollTop_Setter_(unw
rap_jso(this), value.round()); |
1640 | 1631 |
1641 @DomName('Element.scrollWidth') | 1632 @DomName('Element.scrollWidth') |
1642 @DocsEditable() | 1633 @DocsEditable() |
1643 int get scrollWidth => _blink.BlinkElement.instance.scrollWidth_Getter_(unwrap
_jso(this)).round(); | 1634 int get scrollWidth => _blink.BlinkElement.instance.scrollWidth_Getter_(unwrap
_jso(this)).round(); |
1644 $else | |
1645 @DomName('Element.offsetHeight') | |
1646 @DocsEditable() | |
1647 int get offsetHeight => _blink.BlinkElement.offsetHeight_Getter(this).round(); | |
1648 | |
1649 @DomName('Element.offsetLeft') | |
1650 @DocsEditable() | |
1651 int get offsetLeft => _blink.BlinkElement.offsetLeft_Getter(this).round(); | |
1652 | |
1653 @DomName('Element.offsetTop') | |
1654 @DocsEditable() | |
1655 int get offsetTop => _blink.BlinkElement.offsetTop_Getter(this).round(); | |
1656 | |
1657 @DomName('Element.offsetWidth') | |
1658 @DocsEditable() | |
1659 int get offsetWidth => _blink.BlinkElement.offsetWidth_Getter(this).round(); | |
1660 | |
1661 @DomName('Element.clientHeight') | |
1662 @DocsEditable() | |
1663 int get clientHeight => _blink.BlinkElement.clientHeight_Getter(this).round(); | |
1664 | |
1665 @DomName('Element.clientLeft') | |
1666 @DocsEditable() | |
1667 int get clientLeft => _blink.BlinkElement.clientLeft_Getter(this).round(); | |
1668 | |
1669 @DomName('Element.clientTop') | |
1670 @DocsEditable() | |
1671 int get clientTop => _blink.BlinkElement.clientTop_Getter(this).round(); | |
1672 | |
1673 @DomName('Element.clientWidth') | |
1674 @DocsEditable() | |
1675 int get clientWidth => _blink.BlinkElement.clientWidth_Getter(this).round(); | |
1676 | |
1677 @DomName('Element.scrollHeight') | |
1678 @DocsEditable() | |
1679 int get scrollHeight => _blink.BlinkElement.scrollHeight_Getter(this).round(); | |
1680 | |
1681 @DomName('Element.scrollLeft') | |
1682 @DocsEditable() | |
1683 int get scrollLeft => _blink.BlinkElement.scrollLeft_Getter(this).round(); | |
1684 | |
1685 @DomName('Element.scrollLeft') | |
1686 @DocsEditable() | |
1687 set scrollLeft(int value) => _blink.BlinkElement.scrollLeft_Setter(this, value
.round()); | |
1688 | |
1689 @DomName('Element.scrollTop') | |
1690 @DocsEditable() | |
1691 int get scrollTop => _blink.BlinkElement.scrollTop_Getter(this).round(); | |
1692 | |
1693 @DomName('Element.scrollTop') | |
1694 @DocsEditable() | |
1695 set scrollTop(int value) => _blink.BlinkElement.scrollTop_Setter(this, value.r
ound()); | |
1696 | |
1697 @DomName('Element.scrollWidth') | |
1698 @DocsEditable() | |
1699 int get scrollWidth => _blink.BlinkElement.scrollWidth_Getter(this).round(); | |
1700 $endif | |
1701 $endif | 1635 $endif |
1702 | 1636 |
1703 $!MEMBERS | 1637 $!MEMBERS |
1704 } | 1638 } |
1705 | 1639 |
1706 | 1640 |
1707 class _ElementFactoryProvider { | 1641 class _ElementFactoryProvider { |
1708 | 1642 |
1709 @DomName('Document.createElement') | 1643 @DomName('Document.createElement') |
1710 $if DART2JS | 1644 $if DART2JS |
(...skipping 27 matching lines...) Expand all Loading... |
1738 const ScrollAlignment._internal(this._value); | 1672 const ScrollAlignment._internal(this._value); |
1739 toString() => 'ScrollAlignment.$_value'; | 1673 toString() => 'ScrollAlignment.$_value'; |
1740 | 1674 |
1741 /// Attempt to align the element to the top of the scrollable area. | 1675 /// Attempt to align the element to the top of the scrollable area. |
1742 static const TOP = const ScrollAlignment._internal('TOP'); | 1676 static const TOP = const ScrollAlignment._internal('TOP'); |
1743 /// Attempt to center the element in the scrollable area. | 1677 /// Attempt to center the element in the scrollable area. |
1744 static const CENTER = const ScrollAlignment._internal('CENTER'); | 1678 static const CENTER = const ScrollAlignment._internal('CENTER'); |
1745 /// Attempt to align the element to the bottom of the scrollable area. | 1679 /// Attempt to align the element to the bottom of the scrollable area. |
1746 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); | 1680 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); |
1747 } | 1681 } |
OLD | NEW |