| OLD | NEW |
| 1 #library('htmlimpl'); | 1 #library('htmlimpl'); |
| 2 | 2 |
| 3 #import('dart:dom', prefix:'dom'); | 3 #import('dart:dom', prefix:'dom'); |
| 4 #import('dart:html'); | 4 #import('dart:html'); |
| 5 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 5 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 6 // for details. All rights reserved. Use of this source code is governed by a | 6 // for details. All rights reserved. Use of this source code is governed by a |
| 7 // BSD-style license that can be found in the LICENSE file. | 7 // BSD-style license that can be found in the LICENSE file. |
| 8 | 8 |
| 9 // DO NOT EDIT | 9 // DO NOT EDIT |
| 10 // Auto-generated Dart HTML library. | 10 // Auto-generated Dart HTML library. |
| (...skipping 10624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10635 data); | 10635 data); |
| 10636 return LevelDom.wrapCompositionEvent(e); | 10636 return LevelDom.wrapCompositionEvent(e); |
| 10637 } | 10637 } |
| 10638 | 10638 |
| 10639 String get data() => _ptr.data; | 10639 String get data() => _ptr.data; |
| 10640 } | 10640 } |
| 10641 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 10641 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 10642 // for details. All rights reserved. Use of this source code is governed by a | 10642 // for details. All rights reserved. Use of this source code is governed by a |
| 10643 // BSD-style license that can be found in the LICENSE file. | 10643 // BSD-style license that can be found in the LICENSE file. |
| 10644 | 10644 |
| 10645 // TODO - figure out whether classList exists, and if so use that |
| 10646 // rather than the className property that is being used here. |
| 10647 |
| 10648 class _CssClassSet implements Set<String> { |
| 10649 |
| 10650 final _element; |
| 10651 |
| 10652 _CssClassSet(this._element); |
| 10653 |
| 10654 String toString() { |
| 10655 return _formatSet(_read()); |
| 10656 } |
| 10657 |
| 10658 // interface Iterable - BEGIN |
| 10659 Iterator<String> iterator() { |
| 10660 return _read().iterator(); |
| 10661 } |
| 10662 // interface Iterable - END |
| 10663 |
| 10664 // interface Collection - BEGIN |
| 10665 void forEach(void f(String element)) { |
| 10666 _read().forEach(f); |
| 10667 } |
| 10668 |
| 10669 Collection<String> filter(bool f(String element)) { |
| 10670 return _read().filter(f); |
| 10671 } |
| 10672 |
| 10673 bool every(bool f(String element)) { |
| 10674 return _read().every(f); |
| 10675 } |
| 10676 |
| 10677 bool some(bool f(String element)) { |
| 10678 return _read().some(f); |
| 10679 } |
| 10680 |
| 10681 bool isEmpty() { |
| 10682 return _read().isEmpty(); |
| 10683 } |
| 10684 |
| 10685 int get length() { |
| 10686 return _read().length; |
| 10687 } |
| 10688 // interface Collection - END |
| 10689 |
| 10690 // interface Set - BEGIN |
| 10691 bool contains(String value) { |
| 10692 return _read().contains(value); |
| 10693 } |
| 10694 |
| 10695 void add(String value) { |
| 10696 // TODO - figure out if we need to do any validation here |
| 10697 // or if the browser natively does enough |
| 10698 _modify((s) => s.add(value)); |
| 10699 } |
| 10700 |
| 10701 bool remove(String value) { |
| 10702 Set<String> s = _read(); |
| 10703 bool result = s.remove(value); |
| 10704 _write(s); |
| 10705 return result; |
| 10706 } |
| 10707 |
| 10708 void addAll(Collection<String> collection) { |
| 10709 // TODO - see comment above about validation |
| 10710 _modify((s) => s.addAll(collection)); |
| 10711 } |
| 10712 |
| 10713 void removeAll(Collection<String> collection) { |
| 10714 _modify((s) => s.removeAll(collection)); |
| 10715 } |
| 10716 |
| 10717 bool isSubsetOf(Collection<String> collection) { |
| 10718 return _read().isSubsetOf(collection); |
| 10719 } |
| 10720 |
| 10721 bool containsAll(Collection<String> collection) { |
| 10722 return _read().containsAll(collection); |
| 10723 } |
| 10724 |
| 10725 Set<String> intersection(Collection<String> other) { |
| 10726 return _read().intersection(other); |
| 10727 } |
| 10728 |
| 10729 void clear() { |
| 10730 _modify((s) => s.clear()); |
| 10731 } |
| 10732 // interface Set - END |
| 10733 |
| 10734 /** |
| 10735 * Helper method used to modify the set of css classes on this element. |
| 10736 * |
| 10737 * f - callback with: |
| 10738 * s - a Set of all the css class name currently on this element. |
| 10739 * |
| 10740 * After f returns, the modified set is written to the |
| 10741 * className property of this element. |
| 10742 */ |
| 10743 void _modify( f(Set<String> s)) { |
| 10744 Set<String> s = _read(); |
| 10745 f(s); |
| 10746 _write(s); |
| 10747 } |
| 10748 |
| 10749 /** |
| 10750 * Read the class names from the HTMLElement class property, |
| 10751 * and put them into a set (duplicates are discarded). |
| 10752 */ |
| 10753 Set<String> _read() { |
| 10754 // TODO(mattsh) simplify this once split can take regex. |
| 10755 Set<String> s = new Set<String>(); |
| 10756 for (String name in _element.className.split(' ')) { |
| 10757 String trimmed = name.trim(); |
| 10758 if (!trimmed.isEmpty()) { |
| 10759 s.add(trimmed); |
| 10760 } |
| 10761 } |
| 10762 return s; |
| 10763 } |
| 10764 |
| 10765 /** |
| 10766 * Join all the elements of a set into one string and write |
| 10767 * back to the element. |
| 10768 */ |
| 10769 void _write(Set s) { |
| 10770 _element.className = _formatSet(s); |
| 10771 } |
| 10772 |
| 10773 String _formatSet(Set<String> s) { |
| 10774 // TODO(mattsh) should be able to pass Set to String.joins http:/b/5398605 |
| 10775 List list = new List.from(s); |
| 10776 return Strings.join(list, ' '); |
| 10777 } |
| 10778 |
| 10779 } |
| 10780 |
| 10781 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 10782 // for details. All rights reserved. Use of this source code is governed by a |
| 10783 // BSD-style license that can be found in the LICENSE file. |
| 10784 |
| 10645 // WARNING: Do not edit. | 10785 // WARNING: Do not edit. |
| 10646 // This file was generated by html/scripts/css_code_generator.py | 10786 // This file was generated by html/scripts/css_code_generator.py |
| 10647 | 10787 |
| 10648 // Source of CSS properties: | 10788 // Source of CSS properties: |
| 10649 // Source/WebCore/css/CSSPropertyNames.in | 10789 // Source/WebCore/css/CSSPropertyNames.in |
| 10650 | 10790 |
| 10651 // TODO(jacobr): add versions that take numeric values in px, miliseconds, etc. | 10791 // TODO(jacobr): add versions that take numeric values in px, miliseconds, etc. |
| 10652 | 10792 |
| 10653 class CSSStyleDeclarationWrappingImplementation extends DOMWrapperBase implement
s CSSStyleDeclaration { | 10793 class CSSStyleDeclarationWrappingImplementation extends DOMWrapperBase implement
s CSSStyleDeclaration { |
| 10654 static String _cachedBrowserPrefix; | 10794 static String _cachedBrowserPrefix; |
| (...skipping 4045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14700 | 14840 |
| 14701 List<ClientRect> get clientRects() { | 14841 List<ClientRect> get clientRects() { |
| 14702 final out = new List(_clientRects.length); | 14842 final out = new List(_clientRects.length); |
| 14703 for (num i = 0; i < _clientRects.length; i++) { | 14843 for (num i = 0; i < _clientRects.length; i++) { |
| 14704 out[i] = LevelDom.wrapClientRect(_clientRects.item(i)); | 14844 out[i] = LevelDom.wrapClientRect(_clientRects.item(i)); |
| 14705 } | 14845 } |
| 14706 return out; | 14846 return out; |
| 14707 } | 14847 } |
| 14708 } | 14848 } |
| 14709 | 14849 |
| 14710 // TODO - figure out whether classList exists, and if so use that | |
| 14711 // rather than the className property that is being used here. | |
| 14712 | |
| 14713 class _CssClassSet implements Set<String> { | |
| 14714 | |
| 14715 final _element; | |
| 14716 | |
| 14717 _CssClassSet(this._element); | |
| 14718 | |
| 14719 String toString() { | |
| 14720 return _formatSet(_read()); | |
| 14721 } | |
| 14722 | |
| 14723 // interface Iterable - BEGIN | |
| 14724 Iterator<String> iterator() { | |
| 14725 return _read().iterator(); | |
| 14726 } | |
| 14727 // interface Iterable - END | |
| 14728 | |
| 14729 // interface Collection - BEGIN | |
| 14730 void forEach(void f(String element)) { | |
| 14731 _read().forEach(f); | |
| 14732 } | |
| 14733 | |
| 14734 Collection<String> filter(bool f(String element)) { | |
| 14735 return _read().filter(f); | |
| 14736 } | |
| 14737 | |
| 14738 bool every(bool f(String element)) { | |
| 14739 return _read().every(f); | |
| 14740 } | |
| 14741 | |
| 14742 bool some(bool f(String element)) { | |
| 14743 return _read().some(f); | |
| 14744 } | |
| 14745 | |
| 14746 bool isEmpty() { | |
| 14747 return _read().isEmpty(); | |
| 14748 } | |
| 14749 | |
| 14750 int get length() { | |
| 14751 return _read().length; | |
| 14752 } | |
| 14753 // interface Collection - END | |
| 14754 | |
| 14755 // interface Set - BEGIN | |
| 14756 bool contains(String value) { | |
| 14757 return _read().contains(value); | |
| 14758 } | |
| 14759 | |
| 14760 void add(String value) { | |
| 14761 // TODO - figure out if we need to do any validation here | |
| 14762 // or if the browser natively does enough | |
| 14763 _modify((s) => s.add(value)); | |
| 14764 } | |
| 14765 | |
| 14766 bool remove(String value) { | |
| 14767 Set<String> s = _read(); | |
| 14768 bool result = s.remove(value); | |
| 14769 _write(s); | |
| 14770 return result; | |
| 14771 } | |
| 14772 | |
| 14773 void addAll(Collection<String> collection) { | |
| 14774 // TODO - see comment above about validation | |
| 14775 _modify((s) => s.addAll(collection)); | |
| 14776 } | |
| 14777 | |
| 14778 void removeAll(Collection<String> collection) { | |
| 14779 _modify((s) => s.removeAll(collection)); | |
| 14780 } | |
| 14781 | |
| 14782 bool isSubsetOf(Collection<String> collection) { | |
| 14783 return _read().isSubsetOf(collection); | |
| 14784 } | |
| 14785 | |
| 14786 bool containsAll(Collection<String> collection) { | |
| 14787 return _read().containsAll(collection); | |
| 14788 } | |
| 14789 | |
| 14790 Set<String> intersection(Collection<String> other) { | |
| 14791 return _read().intersection(other); | |
| 14792 } | |
| 14793 | |
| 14794 void clear() { | |
| 14795 _modify((s) => s.clear()); | |
| 14796 } | |
| 14797 // interface Set - END | |
| 14798 | |
| 14799 /** | |
| 14800 * Helper method used to modify the set of css classes on this element. | |
| 14801 * | |
| 14802 * f - callback with: | |
| 14803 * s - a Set of all the css class name currently on this element. | |
| 14804 * | |
| 14805 * After f returns, the modified set is written to the | |
| 14806 * className property of this element. | |
| 14807 */ | |
| 14808 void _modify( f(Set<String> s)) { | |
| 14809 Set<String> s = _read(); | |
| 14810 f(s); | |
| 14811 _write(s); | |
| 14812 } | |
| 14813 | |
| 14814 /** | |
| 14815 * Read the class names from the HTMLElement class property, | |
| 14816 * and put them into a set (duplicates are discarded). | |
| 14817 */ | |
| 14818 Set<String> _read() { | |
| 14819 // TODO(mattsh) simplify this once split can take regex. | |
| 14820 Set<String> s = new Set<String>(); | |
| 14821 for (String name in _element.className.split(' ')) { | |
| 14822 String trimmed = name.trim(); | |
| 14823 if (!trimmed.isEmpty()) { | |
| 14824 s.add(trimmed); | |
| 14825 } | |
| 14826 } | |
| 14827 return s; | |
| 14828 } | |
| 14829 | |
| 14830 /** | |
| 14831 * Join all the elements of a set into one string and write | |
| 14832 * back to the element. | |
| 14833 */ | |
| 14834 void _write(Set s) { | |
| 14835 _element.className = _formatSet(s); | |
| 14836 } | |
| 14837 | |
| 14838 String _formatSet(Set<String> s) { | |
| 14839 // TODO(mattsh) should be able to pass Set to String.joins http:/b/5398605 | |
| 14840 List list = new List.from(s); | |
| 14841 return Strings.join(list, ' '); | |
| 14842 } | |
| 14843 | |
| 14844 } | |
| 14845 | |
| 14846 | |
| 14847 class ElementWrappingImplementation extends NodeWrappingImplementation implement
s Element { | 14850 class ElementWrappingImplementation extends NodeWrappingImplementation implement
s Element { |
| 14848 | 14851 |
| 14849 static final _START_TAG_REGEXP = const RegExp('<(\\w+)'); | 14852 static final _START_TAG_REGEXP = const RegExp('<(\\w+)'); |
| 14850 static final _CUSTOM_PARENT_TAG_MAP = const { | 14853 static final _CUSTOM_PARENT_TAG_MAP = const { |
| 14851 'body' : 'html', | 14854 'body' : 'html', |
| 14852 'head' : 'html', | 14855 'head' : 'html', |
| 14853 'caption' : 'table', | 14856 'caption' : 'table', |
| 14854 'td': 'tr', | 14857 'td': 'tr', |
| 14855 'tbody': 'table', | 14858 'tbody': 'table', |
| 14856 'colgroup': 'table', | 14859 'colgroup': 'table', |
| (...skipping 2436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17293 _ptr.setRequestHeader(header, value); | 17296 _ptr.setRequestHeader(header, value); |
| 17294 } | 17297 } |
| 17295 | 17298 |
| 17296 XMLHttpRequestEvents get on() { | 17299 XMLHttpRequestEvents get on() { |
| 17297 if (_on === null) { | 17300 if (_on === null) { |
| 17298 _on = new XMLHttpRequestEventsImplementation._wrap(_ptr); | 17301 _on = new XMLHttpRequestEventsImplementation._wrap(_ptr); |
| 17299 } | 17302 } |
| 17300 return _on; | 17303 return _on; |
| 17301 } | 17304 } |
| 17302 } | 17305 } |
| OLD | NEW |