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

Unified Diff: lib/html/templates/html/dart2js/html_dart2js.darttemplate

Issue 11094082: Convert legacy 'native code' to JS-forms in dart:html (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: lib/html/templates/html/dart2js/html_dart2js.darttemplate
diff --git a/lib/html/templates/html/dart2js/html_dart2js.darttemplate b/lib/html/templates/html/dart2js/html_dart2js.darttemplate
index 9b10fb218c285a07ef5ade69babb2ab42b77b1e1..73036e942549638a0aa5469387a4472402a18315 100644
--- a/lib/html/templates/html/dart2js/html_dart2js.darttemplate
+++ b/lib/html/templates/html/dart2js/html_dart2js.darttemplate
@@ -37,12 +37,12 @@ $!GENERATED_DART_FILES
#source('$AUXILIARY_DIR/_Lists.dart');
-LocalWindow get window() native "return window;";
-_LocalWindowImpl get _window() native "return window;";
+LocalWindow get window() => JS('LocalWindow', 'window');
+_LocalWindowImpl get _window() => JS('_LocalWindowImpl', 'window');
-Document get document() native "return document;";
+Document get document() => JS('Document', 'document');
-_DocumentImpl get _document() native "return document;";
+_DocumentImpl get _document() => JS('_DocumentImpl', 'document');
Element query(String selector) => _document.query(selector);
List<Element> queryAll(String selector) => _document.queryAll(selector);
@@ -53,12 +53,12 @@ class _HTMLElementImpl extends _ElementImpl native "*HTMLElement" {
}
// Support for Send/ReceivePortSync.
-int _getNewIsolateId() native r'''
- if (!window.$dart$isolate$counter) {
- window.$dart$isolate$counter = 1;
+int _getNewIsolateId() {
+ if (JS('bool', r'!window.$dart$isolate$counter')) {
+ JS('void', r'window.$dart$isolate$counter = 1');
}
- return window.$dart$isolate$counter++;
-''';
+ return JS('int', r'window.$dart$isolate$counter++');
+}
// Fast path to invoke JS send port.
_callPortSync(int id, message) {

Powered by Google App Engine
This is Rietveld 408576698