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

Side by Side Diff: sdk/lib/html/dart2js/html_dart2js.dart

Issue 14630016: Getting html_dart2js and html_dartium a bit more in sync. (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
OLDNEW
1 /// The Dart HTML library. 1 /// The Dart HTML library.
2 library dart.dom.html; 2 library dart.dom.html;
3 3
4 import 'dart:async'; 4 import 'dart:async';
5 import 'dart:collection'; 5 import 'dart:collection';
6 import 'dart:_collection-dev' hide Symbol; 6 import 'dart:_collection-dev' hide Symbol;
7 import 'dart:html_common'; 7 import 'dart:html_common';
8 import 'dart:indexed_db'; 8 import 'dart:indexed_db';
9 import 'dart:isolate'; 9 import 'dart:isolate';
10 import 'dart:json' as json; 10 import 'dart:json' as json;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 JS('void', r'window.$dart$isolate$counter = 1'); 58 JS('void', r'window.$dart$isolate$counter = 1');
59 } 59 }
60 return JS('int', r'window.$dart$isolate$counter++'); 60 return JS('int', r'window.$dart$isolate$counter++');
61 } 61 }
62 62
63 // Fast path to invoke JS send port. 63 // Fast path to invoke JS send port.
64 _callPortSync(int id, message) { 64 _callPortSync(int id, message) {
65 return JS('var', r'ReceivePortSync.dispatchCall(#, #)', id, message); 65 return JS('var', r'ReceivePortSync.dispatchCall(#, #)', id, message);
66 } 66 }
67 67
68 spawnDomFunction(f) => IsolateNatives.spawnDomFunction(f); 68 spawnDomFunction(Function f) => IsolateNatives.spawnDomFunction(f);
69 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 69 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
70 // for details. All rights reserved. Use of this source code is governed by a 70 // for details. All rights reserved. Use of this source code is governed by a
71 // BSD-style license that can be found in the LICENSE file. 71 // BSD-style license that can be found in the LICENSE file.
72 72
73 73
74 @DocsEditable 74 @DocsEditable
75 @DomName('AbstractWorker') 75 @DomName('AbstractWorker')
76 class AbstractWorker extends EventTarget native "AbstractWorker" { 76 class AbstractWorker extends EventTarget native "AbstractWorker" {
77 77
78 @DomName('AbstractWorker.errorEvent') 78 @DomName('AbstractWorker.errorEvent')
(...skipping 1441 matching lines...) Expand 10 before | Expand all | Expand 10 after
1520 @JSName('drawImage') 1520 @JSName('drawImage')
1521 void drawImageScaledFromSource(CanvasImageSource source, 1521 void drawImageScaledFromSource(CanvasImageSource source,
1522 num sourceX, num sourceY, num sourceWidth, num sourceHeight, 1522 num sourceX, num sourceY, num sourceWidth, num sourceHeight,
1523 num destX, num destY, num destWidth, num destHeight) native; 1523 num destX, num destY, num destWidth, num destHeight) native;
1524 1524
1525 @DomName('CanvasRenderingContext2D.lineDashOffset') 1525 @DomName('CanvasRenderingContext2D.lineDashOffset')
1526 num get lineDashOffset => JS('num', 1526 num get lineDashOffset => JS('num',
1527 '#.lineDashOffset || #.webkitLineDashOffset', this, this); 1527 '#.lineDashOffset || #.webkitLineDashOffset', this, this);
1528 1528
1529 @DomName('CanvasRenderingContext2D.lineDashOffset') 1529 @DomName('CanvasRenderingContext2D.lineDashOffset')
1530 void set lineDashOffset(num value) => JS('void', 1530 void set lineDashOffset(num value) => JS('void',
1531 'typeof #.lineDashOffset != "undefined" ? #.lineDashOffset = # : ' 1531 'typeof #.lineDashOffset != "undefined" ? #.lineDashOffset = # : '
1532 '#.webkitLineDashOffset = #', this, this, value, this, value); 1532 '#.webkitLineDashOffset = #', this, this, value, this, value);
1533 } 1533 }
1534 1534
1535 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1535 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
1536 // for details. All rights reserved. Use of this source code is governed by a 1536 // for details. All rights reserved. Use of this source code is governed by a
1537 // BSD-style license that can be found in the LICENSE file. 1537 // BSD-style license that can be found in the LICENSE file.
1538 1538
1539 1539
1540 @DocsEditable 1540 @DocsEditable
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1630 1630
1631 } 1631 }
1632 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1632 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
1633 // for details. All rights reserved. Use of this source code is governed by a 1633 // for details. All rights reserved. Use of this source code is governed by a
1634 // BSD-style license that can be found in the LICENSE file. 1634 // BSD-style license that can be found in the LICENSE file.
1635 1635
1636 1636
1637 @DomName('Console') 1637 @DomName('Console')
1638 class Console { 1638 class Console {
1639 1639
1640 static Console safeConsole = new Console(); 1640 static Console _safeConsole = new Console();
1641 1641
1642 bool get _isConsoleDefined => JS('bool', 'typeof console != "undefined"'); 1642 bool get _isConsoleDefined => JS('bool', 'typeof console != "undefined"');
1643 1643
1644 @DomName('Console.memory') 1644 @DomName('Console.memory')
1645 MemoryInfo get memory => _isConsoleDefined ? 1645 MemoryInfo get memory => _isConsoleDefined ?
1646 JS('MemoryInfo', 'console.memory') : null; 1646 JS('MemoryInfo', 'console.memory') : null;
1647 1647
1648 @DomName('Console.profiles') 1648 @DomName('Console.profiles')
1649 List<ScriptProfile> get profiles => _isConsoleDefined ? 1649 List<ScriptProfile> get profiles => _isConsoleDefined ?
1650 JS('List<ScriptProfile>', 'console.profiles') : null; 1650 JS('List<ScriptProfile>', 'console.profiles') : null;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1703 1703
1704 @DomName('Console.profileEnd') 1704 @DomName('Console.profileEnd')
1705 void profileEnd(String title) => _isConsoleDefined ? 1705 void profileEnd(String title) => _isConsoleDefined ?
1706 JS('void', 'console.profileEnd(#)', title) : null; 1706 JS('void', 'console.profileEnd(#)', title) : null;
1707 1707
1708 @DomName('Console.time') 1708 @DomName('Console.time')
1709 void time(String title) => _isConsoleDefined ? 1709 void time(String title) => _isConsoleDefined ?
1710 JS('void', 'console.time(#)', title) : null; 1710 JS('void', 'console.time(#)', title) : null;
1711 1711
1712 @DomName('Console.timeEnd') 1712 @DomName('Console.timeEnd')
1713 void timeEnd(String timerName) => _isConsoleDefined ? 1713 void timeEnd(String title) => _isConsoleDefined ?
1714 JS('void', 'console.timeEnd(#)', timerName) : null; 1714 JS('void', 'console.timeEnd(#)', title) : null;
1715 1715
1716 @DomName('Console.timeStamp') 1716 @DomName('Console.timeStamp')
1717 void timeStamp(Object arg) => _isConsoleDefined ? 1717 void timeStamp(Object arg) => _isConsoleDefined ?
1718 JS('void', 'console.timeStamp(#)', arg) : null; 1718 JS('void', 'console.timeStamp(#)', arg) : null;
1719 1719
1720 @DomName('Console.trace') 1720 @DomName('Console.trace')
1721 void trace(Object arg) => _isConsoleDefined ? 1721 void trace(Object arg) => _isConsoleDefined ?
1722 JS('void', 'console.trace(#)', arg) : null; 1722 JS('void', 'console.trace(#)', arg) : null;
1723 1723
1724 @DomName('Console.warn') 1724 @DomName('Console.warn')
(...skipping 5778 matching lines...) Expand 10 before | Expand all | Expand 10 after
7503 * // Inserts as the first child 7503 * // Inserts as the first child
7504 * document.body.insertAdjacentHtml('afterBegin', html); 7504 * document.body.insertAdjacentHtml('afterBegin', html);
7505 * var createdElement = document.body.children[0]; 7505 * var createdElement = document.body.children[0];
7506 * print(createdElement.classes[0]); // Prints 'something' 7506 * print(createdElement.classes[0]); // Prints 'something'
7507 * 7507 *
7508 * See also: 7508 * See also:
7509 * 7509 *
7510 * * [insertAdjacentText] 7510 * * [insertAdjacentText]
7511 * * [insertAdjacentElement] 7511 * * [insertAdjacentElement]
7512 */ 7512 */
7513 void insertAdjacentHtml(String where, String text) { 7513 void insertAdjacentHtml(String where, String html) {
7514 if (JS('bool', '!!#.insertAdjacentHtml', this)) { 7514 if (JS('bool', '!!#.insertAdjacentHtml', this)) {
7515 _insertAdjacentHtml(where, text); 7515 _insertAdjacentHtml(where, html);
7516 } else { 7516 } else {
7517 _insertAdjacentNode(where, new DocumentFragment.html(text)); 7517 _insertAdjacentNode(where, new DocumentFragment.html(html));
7518 } 7518 }
7519 } 7519 }
7520 7520
7521 @JSName('insertAdjacentHTML') 7521 @JSName('insertAdjacentHTML')
7522 void _insertAdjacentHTML(String where, String text) native; 7522 void _insertAdjacentHTML(String where, String text) native;
7523 7523
7524 /** 7524 /**
7525 * Inserts [element] into the DOM at the specified location. 7525 * Inserts [element] into the DOM at the specified location.
7526 * 7526 *
7527 * To see the possible values for [where], read the doc for 7527 * To see the possible values for [where], read the doc for
(...skipping 12963 matching lines...) Expand 10 before | Expand all | Expand 10 after
20491 20491
20492 20492
20493 @DomName('URL') 20493 @DomName('URL')
20494 class Url native "URL" { 20494 class Url native "URL" {
20495 20495
20496 static String createObjectUrl(blob_OR_source_OR_stream) => 20496 static String createObjectUrl(blob_OR_source_OR_stream) =>
20497 JS('String', 20497 JS('String',
20498 '(window.URL || window.webkitURL).createObjectURL(#)', 20498 '(window.URL || window.webkitURL).createObjectURL(#)',
20499 blob_OR_source_OR_stream); 20499 blob_OR_source_OR_stream);
20500 20500
20501 static void revokeObjectUrl(String objectUrl) => 20501 static void revokeObjectUrl(String url) =>
20502 JS('void', 20502 JS('void',
20503 '(window.URL || window.webkitURL).revokeObjectURL(#)', objectUrl); 20503 '(window.URL || window.webkitURL).revokeObjectURL(#)', url);
20504 20504
20505 } 20505 }
20506 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 20506 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
20507 // for details. All rights reserved. Use of this source code is governed by a 20507 // for details. All rights reserved. Use of this source code is governed by a
20508 // BSD-style license that can be found in the LICENSE file. 20508 // BSD-style license that can be found in the LICENSE file.
20509 20509
20510 20510
20511 @DocsEditable 20511 @DocsEditable
20512 @DomName('ValidityState') 20512 @DomName('ValidityState')
20513 class ValidityState native "ValidityState" { 20513 class ValidityState native "ValidityState" {
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
21204 * 21204 *
21205 * Note: The supplied [callback] needs to call [requestAnimationFrame] again 21205 * Note: The supplied [callback] needs to call [requestAnimationFrame] again
21206 * for the animation to continue. 21206 * for the animation to continue.
21207 */ 21207 */
21208 @DomName('DOMWindow.requestAnimationFrame') 21208 @DomName('DOMWindow.requestAnimationFrame')
21209 int requestAnimationFrame(RequestAnimationFrameCallback callback) { 21209 int requestAnimationFrame(RequestAnimationFrameCallback callback) {
21210 _ensureRequestAnimationFrame(); 21210 _ensureRequestAnimationFrame();
21211 return _requestAnimationFrame(callback); 21211 return _requestAnimationFrame(callback);
21212 } 21212 }
21213 21213
21214 void cancelAnimationFrame(id) { 21214 void cancelAnimationFrame(int id) {
21215 _ensureRequestAnimationFrame(); 21215 _ensureRequestAnimationFrame();
21216 _cancelAnimationFrame(id); 21216 _cancelAnimationFrame(id);
21217 } 21217 }
21218 21218
21219 @JSName('requestAnimationFrame') 21219 @JSName('requestAnimationFrame')
21220 int _requestAnimationFrame(RequestAnimationFrameCallback callback) native; 21220 int _requestAnimationFrame(RequestAnimationFrameCallback callback) native;
21221 21221
21222 @JSName('cancelAnimationFrame') 21222 @JSName('cancelAnimationFrame')
21223 void _cancelAnimationFrame(int id) native; 21223 void _cancelAnimationFrame(int id) native;
21224 21224
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
21257 @SupportedBrowser(SupportedBrowser.CHROME, '23.0') 21257 @SupportedBrowser(SupportedBrowser.CHROME, '23.0')
21258 @SupportedBrowser(SupportedBrowser.FIREFOX, '15.0') 21258 @SupportedBrowser(SupportedBrowser.FIREFOX, '15.0')
21259 @SupportedBrowser(SupportedBrowser.IE, '10.0') 21259 @SupportedBrowser(SupportedBrowser.IE, '10.0')
21260 @Experimental 21260 @Experimental
21261 IdbFactory get indexedDB => 21261 IdbFactory get indexedDB =>
21262 JS('IdbFactory|Null', // If not supported, returns `null`. 21262 JS('IdbFactory|Null', // If not supported, returns `null`.
21263 '#.indexedDB || #.webkitIndexedDB || #.mozIndexedDB', 21263 '#.indexedDB || #.webkitIndexedDB || #.mozIndexedDB',
21264 this, this, this); 21264 this, this, this);
21265 21265
21266 @DomName('Window.console') 21266 @DomName('Window.console')
21267 Console get console => Console.safeConsole; 21267 Console get console => Console._safeConsole;
21268 21268
21269 /// Checks if _setImmediate is supported. 21269 /// Checks if _setImmediate is supported.
21270 static bool get _supportsSetImmediate => 21270 static bool get _supportsSetImmediate =>
21271 JS('bool', '!!(window.setImmediate)'); 21271 JS('bool', '!!(window.setImmediate)');
21272 21272
21273 // Set immediate implementation for IE 21273 // Set immediate implementation for IE
21274 void _setImmediate(void callback()) { 21274 void _setImmediate(void callback()) {
21275 JS('void', '#.setImmediate(#)', this, convertDartClosureToJS(callback, 0)); 21275 JS('void', '#.setImmediate(#)', this, convertDartClosureToJS(callback, 0));
21276 } 21276 }
21277 21277
(...skipping 6673 matching lines...) Expand 10 before | Expand all | Expand 10 after
27951 _position = nextPosition; 27951 _position = nextPosition;
27952 return true; 27952 return true;
27953 } 27953 }
27954 _current = null; 27954 _current = null;
27955 _position = _array.length; 27955 _position = _array.length;
27956 return false; 27956 return false;
27957 } 27957 }
27958 27958
27959 T get current => _current; 27959 T get current => _current;
27960 } 27960 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | tools/dom/templates/html/impl/impl_Element.darttemplate » ('J')

Powered by Google App Engine
This is Rietveld 408576698