| Index: sdk/lib/html/templates/html/dart2js/impl_LocalWindow.darttemplate
|
| diff --git a/sdk/lib/html/templates/html/dart2js/impl_LocalWindow.darttemplate b/sdk/lib/html/templates/html/dart2js/impl_LocalWindow.darttemplate
|
| deleted file mode 100644
|
| index d05349c3550e6fb151454a8e75145964e8577213..0000000000000000000000000000000000000000
|
| --- a/sdk/lib/html/templates/html/dart2js/impl_LocalWindow.darttemplate
|
| +++ /dev/null
|
| @@ -1,151 +0,0 @@
|
| -// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
| -// for details. All rights reserved. Use of this source code is governed by a
|
| -// BSD-style license that can be found in the LICENSE file.
|
| -
|
| -part of html;
|
| -
|
| -/// @domName $DOMNAME
|
| -class $CLASSNAME$EXTENDS$IMPLEMENTS native "@*DOMWindow" {
|
| -
|
| - Document get document => JS('Document', '#.document', this);
|
| -
|
| - Window _open2(url, name) => JS('Window', '#.open(#,#)', this, url, name);
|
| -
|
| - Window _open3(url, name, options) =>
|
| - JS('Window', '#.open(#,#,#)', this, url, name, options);
|
| -
|
| - Window open(String url, String name, [String options]) {
|
| - if (options == null) {
|
| - return _DOMWindowCrossFrame._createSafe(_open2(url, name));
|
| - } else {
|
| - return _DOMWindowCrossFrame._createSafe(_open3(url, name, options));
|
| - }
|
| - }
|
| -
|
| - // API level getter and setter for Location.
|
| - // TODO: The cross domain safe wrapper can be inserted here or folded into
|
| - // _LocationWrapper.
|
| - LocalLocation get location {
|
| - // Firefox work-around for Location. The Firefox location object cannot be
|
| - // made to behave like a Dart object so must be wrapped.
|
| - var result = _location;
|
| - if (_isDartLocation(result)) return result; // e.g. on Chrome.
|
| - if (null == _location_wrapper) {
|
| - _location_wrapper = new _LocationWrapper(result);
|
| - }
|
| - return _location_wrapper;
|
| - }
|
| -
|
| - // TODO: consider forcing users to do: window.location.assign('string').
|
| - /**
|
| - * Sets the window's location, which causes the browser to navigate to the new
|
| - * location. [value] may be a Location object or a string.
|
| - */
|
| - void set location(value) {
|
| - if (value is _LocationWrapper) {
|
| - _location = value._ptr;
|
| - } else {
|
| - _location = value;
|
| - }
|
| - }
|
| -
|
| - _LocationWrapper _location_wrapper; // Cached wrapped Location object.
|
| -
|
| - // Native getter and setter to access raw Location object.
|
| - Location get _location => JS('Location', '#.location', this);
|
| - void set _location(Location value) {
|
| - JS('void', '#.location = #', this, value);
|
| - }
|
| - // Prevent compiled from thinking 'location' property is available for a Dart
|
| - // member.
|
| - @JSName('location')
|
| - _protect_location() native;
|
| -
|
| - static _isDartLocation(thing) {
|
| - // On Firefox the code that implements 'is Location' fails to find the patch
|
| - // stub on Object.prototype and throws an exception.
|
| - try {
|
| - return thing is Location;
|
| - } catch (e) {
|
| - return false;
|
| - }
|
| - }
|
| -
|
| - /**
|
| - * Executes a [callback] after the next batch of browser layout measurements
|
| - * has completed or would have completed if any browser layout measurements
|
| - * had been scheduled.
|
| - */
|
| - void requestLayoutFrame(TimeoutHandler callback) {
|
| - _addMeasurementFrameCallback(callback);
|
| - }
|
| -
|
| - /** @domName DOMWindow.requestAnimationFrame */
|
| - int requestAnimationFrame(RequestAnimationFrameCallback callback) {
|
| - _ensureRequestAnimationFrame();
|
| - return _requestAnimationFrame(callback);
|
| - }
|
| -
|
| - void cancelAnimationFrame(id) {
|
| - _ensureRequestAnimationFrame();
|
| - _cancelAnimationFrame(id);
|
| - }
|
| -
|
| - @JSName('requestAnimationFrame')
|
| - int _requestAnimationFrame(RequestAnimationFrameCallback callback) native;
|
| -
|
| - @JSName('cancelAnimationFrame')
|
| - void _cancelAnimationFrame(int id) native;
|
| -
|
| - _ensureRequestAnimationFrame() {
|
| - if (JS('bool',
|
| - '!!(#.requestAnimationFrame && #.cancelAnimationFrame)', this, this))
|
| - return;
|
| -
|
| - JS('void',
|
| - r"""
|
| - (function($this) {
|
| - var vendors = ['ms', 'moz', 'webkit', 'o'];
|
| - for (var i = 0; i < vendors.length && !$this.requestAnimationFrame; ++i) {
|
| - $this.requestAnimationFrame = $this[vendors[i] + 'RequestAnimationFrame'];
|
| - $this.cancelAnimationFrame =
|
| - $this[vendors[i]+'CancelAnimationFrame'] ||
|
| - $this[vendors[i]+'CancelRequestAnimationFrame'];
|
| - }
|
| - if ($this.requestAnimationFrame && $this.cancelAnimationFrame) return;
|
| - $this.requestAnimationFrame = function(callback) {
|
| - return window.setTimeout(function() {
|
| - callback(Date.now());
|
| - }, 16 /* 16ms ~= 60fps */);
|
| - };
|
| - $this.cancelAnimationFrame = function(id) { clearTimeout(id); }
|
| - })(#)""",
|
| - this);
|
| - }
|
| -
|
| - IDBFactory get indexedDB =>
|
| - JS('IDBFactory',
|
| - '#.indexedDB || #.webkitIndexedDB || #.mozIndexedDB',
|
| - this, this, this);
|
| -
|
| - /**
|
| - * Lookup a port by its [name]. Return null if no port is
|
| - * registered under [name].
|
| - */
|
| - SendPortSync lookupPort(String name) {
|
| - var port = JSON.parse(document.documentElement.attributes['dart-port:$name']);
|
| - return _deserialize(port);
|
| - }
|
| -
|
| - /**
|
| - * Register a [port] on this window under the given [name]. This
|
| - * port may be retrieved by any isolate (or JavaScript script)
|
| - * running in this window.
|
| - */
|
| - void registerPort(String name, var port) {
|
| - var serialized = _serialize(port);
|
| - document.documentElement.attributes['dart-port:$name'] = JSON.stringify(serialized);
|
| - }
|
| -
|
| -$!MEMBERS
|
| -}
|
|
|