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

Side by Side Diff: client/html/release/htmlimpl.dart

Issue 8659020: Temporary build fix in generated code (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years 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 | « client/html/release/html.dart ('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 #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 10375 matching lines...) Expand 10 before | Expand all | Expand 10 after
10386 } 10386 }
10387 } 10387 }
10388 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 10388 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
10389 // for details. All rights reserved. Use of this source code is governed by a 10389 // for details. All rights reserved. Use of this source code is governed by a
10390 // BSD-style license that can be found in the LICENSE file. 10390 // BSD-style license that can be found in the LICENSE file.
10391 10391
10392 10392
10393 // These factory methods could all live in one factory provider class but dartc 10393 // These factory methods could all live in one factory provider class but dartc
10394 // has a bug (5399939) preventing that. 10394 // has a bug (5399939) preventing that.
10395 10395
10396 class _FileReaderFactoryProvider { 10396 class FileReaderFactoryProvider {
10397 10397
10398 factory FileReader() { 10398 factory FileReader() {
10399 return new dom.FileReader(); 10399 return new dom.FileReader();
10400 } 10400 }
10401 } 10401 }
10402 10402
10403 class _CSSMatrixFactoryProvider { 10403 class CSSMatrixFactoryProvider {
10404 10404
10405 factory CSSMatrix([String spec = '']) { 10405 factory CSSMatrix([String spec = '']) {
10406 return new CSSMatrixWrappingImplementation._wrap( 10406 return new CSSMatrixWrappingImplementation._wrap(
10407 new dom.WebKitCSSMatrix(spec)); 10407 new dom.WebKitCSSMatrix(spec));
10408 } 10408 }
10409 } 10409 }
10410 10410
10411 class _PointFactoryProvider { 10411 class PointFactoryProvider {
10412 10412
10413 /** @domName Window.createWebKitPoint */ 10413 /** @domName Window.createWebKitPoint */
10414 factory Point(num x, num y) { 10414 factory Point(num x, num y) {
10415 return new PointWrappingImplementation._wrap(new dom.WebKitPoint(x, y)); 10415 return new PointWrappingImplementation._wrap(new dom.WebKitPoint(x, y));
10416 } 10416 }
10417 } 10417 }
10418 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 10418 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
10419 // for details. All rights reserved. Use of this source code is governed by a 10419 // for details. All rights reserved. Use of this source code is governed by a
10420 // BSD-style license that can be found in the LICENSE file. 10420 // BSD-style license that can be found in the LICENSE file.
10421 10421
(...skipping 4278 matching lines...) Expand 10 before | Expand all | Expand 10 after
14700 14700
14701 List<ClientRect> get clientRects() { 14701 List<ClientRect> get clientRects() {
14702 final out = new List(_clientRects.length); 14702 final out = new List(_clientRects.length);
14703 for (num i = 0; i < _clientRects.length; i++) { 14703 for (num i = 0; i < _clientRects.length; i++) {
14704 out[i] = LevelDom.wrapClientRect(_clientRects.item(i)); 14704 out[i] = LevelDom.wrapClientRect(_clientRects.item(i));
14705 } 14705 }
14706 return out; 14706 return out;
14707 } 14707 }
14708 } 14708 }
14709 14709
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
14710 class ElementWrappingImplementation extends NodeWrappingImplementation implement s Element { 14847 class ElementWrappingImplementation extends NodeWrappingImplementation implement s Element {
14711 14848
14712 static final _START_TAG_REGEXP = const RegExp('<(\\w+)'); 14849 static final _START_TAG_REGEXP = const RegExp('<(\\w+)');
14713 static final _CUSTOM_PARENT_TAG_MAP = const { 14850 static final _CUSTOM_PARENT_TAG_MAP = const {
14714 'body' : 'html', 14851 'body' : 'html',
14715 'head' : 'html', 14852 'head' : 'html',
14716 'caption' : 'table', 14853 'caption' : 'table',
14717 'td': 'tr', 14854 'td': 'tr',
14718 'tbody': 'table', 14855 'tbody': 'table',
14719 'colgroup': 'table', 14856 'colgroup': 'table',
(...skipping 2436 matching lines...) Expand 10 before | Expand all | Expand 10 after
17156 _ptr.setRequestHeader(header, value); 17293 _ptr.setRequestHeader(header, value);
17157 } 17294 }
17158 17295
17159 XMLHttpRequestEvents get on() { 17296 XMLHttpRequestEvents get on() {
17160 if (_on === null) { 17297 if (_on === null) {
17161 _on = new XMLHttpRequestEventsImplementation._wrap(_ptr); 17298 _on = new XMLHttpRequestEventsImplementation._wrap(_ptr);
17162 } 17299 }
17163 return _on; 17300 return _on;
17164 } 17301 }
17165 } 17302 }
OLDNEW
« no previous file with comments | « client/html/release/html.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698