| Index: client/html/generated/html/frog/Window.dart
|
| diff --git a/client/html/generated/html/frog/Window.dart b/client/html/generated/html/frog/Window.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..d36d312bb6b2e2836ec269a9710a52920870e658
|
| --- /dev/null
|
| +++ b/client/html/generated/html/frog/Window.dart
|
| @@ -0,0 +1,476 @@
|
| +// 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.
|
| +
|
| +typedef Object ComputeValue();
|
| +
|
| +class _MeasurementRequest<T> {
|
| + final ComputeValue computeValue;
|
| + final Completer<T> completer;
|
| + Object value;
|
| + bool exception = false;
|
| + _MeasurementRequest(this.computeValue, this.completer);
|
| +}
|
| +
|
| +final _MEASUREMENT_MESSAGE = "DART-MEASURE";
|
| +List<_MeasurementRequest> _pendingRequests;
|
| +List<TimeoutHandler> _pendingMeasurementFrameCallbacks;
|
| +bool _nextMeasurementFrameScheduled = false;
|
| +bool _firstMeasurementRequest = true;
|
| +
|
| +void _maybeScheduleMeasurementFrame() {
|
| + if (_nextMeasurementFrameScheduled) return;
|
| +
|
| + _nextMeasurementFrameScheduled = true;
|
| + // postMessage gives us a way to receive a callback after the current
|
| + // event listener has unwound but before the browser has repainted.
|
| + if (_firstMeasurementRequest) {
|
| + // Messages from other windows do not cause a security risk as
|
| + // all we care about is that _onCompleteMeasurementRequests is called
|
| + // after the current event loop is unwound and calling the function is
|
| + // a noop when zero requests are pending.
|
| + window.on.message.add((e) => _completeMeasurementFutures());
|
| + _firstMeasurementRequest = false;
|
| + }
|
| +
|
| + // TODO(jacobr): other mechanisms such as setImmediate and
|
| + // requestAnimationFrame may work better of platforms that support them.
|
| + // The key is we need a way to execute code immediately after the current
|
| + // event listener queue unwinds.
|
| + window.postMessage(_MEASUREMENT_MESSAGE, "*");
|
| +}
|
| +
|
| +/**
|
| + * Registers a [callback] which is called after the next batch of measurements
|
| + * completes. Even if no measurements completed, the callback is triggered
|
| + * when they would have completed to avoid confusing bugs if it happened that
|
| + * no measurements were actually requested.
|
| + */
|
| +void _addMeasurementFrameCallback(TimeoutHandler callback) {
|
| + if (_pendingMeasurementFrameCallbacks === null) {
|
| + _pendingMeasurementFrameCallbacks = <TimeoutHandler>[];
|
| + _maybeScheduleMeasurementFrame();
|
| + }
|
| + _pendingMeasurementFrameCallbacks.add(callback);
|
| +}
|
| +
|
| +/**
|
| + * Returns a [Future] whose value will be the result of evaluating
|
| + * [computeValue] during the next safe measurement interval.
|
| + * The next safe measurement interval is after the current event loop has
|
| + * unwound but before the browser has rendered the page.
|
| + * It is important that the [computeValue] function only queries the html
|
| + * layout and html in any way.
|
| + */
|
| +Future _createMeasurementFuture(ComputeValue computeValue,
|
| + Completer completer) {
|
| + if (_pendingRequests === null) {
|
| + _pendingRequests = <_MeasurementRequest>[];
|
| + _maybeScheduleMeasurementFrame();
|
| + }
|
| + _pendingRequests.add(new _MeasurementRequest(computeValue, completer));
|
| + return completer.future;
|
| +}
|
| +
|
| +/**
|
| + * Complete all pending measurement futures evaluating them in a single batch
|
| + * so that the the browser is guaranteed to avoid multiple layouts.
|
| + */
|
| +void _completeMeasurementFutures() {
|
| + if (_nextMeasurementFrameScheduled == false) {
|
| + // Ignore spurious call to this function.
|
| + return;
|
| + }
|
| +
|
| + _nextMeasurementFrameScheduled = false;
|
| + // We must compute all new values before fulfilling the futures as
|
| + // the onComplete callbacks for the futures could modify the DOM making
|
| + // subsequent measurement calculations expensive to compute.
|
| + if (_pendingRequests !== null) {
|
| + for (_MeasurementRequest request in _pendingRequests) {
|
| + try {
|
| + request.value = request.computeValue();
|
| + } catch(var e) {
|
| + request.value = e;
|
| + request.exception = true;
|
| + }
|
| + }
|
| + }
|
| +
|
| + final completedRequests = _pendingRequests;
|
| + final readyMeasurementFrameCallbacks = _pendingMeasurementFrameCallbacks;
|
| + _pendingRequests = null;
|
| + _pendingMeasurementFrameCallbacks = null;
|
| + if (completedRequests !== null) {
|
| + for (_MeasurementRequest request in completedRequests) {
|
| + if (request.exception) {
|
| + request.completer.completeException(request.value);
|
| + } else {
|
| + request.completer.complete(request.value);
|
| + }
|
| + }
|
| + }
|
| +
|
| + if (readyMeasurementFrameCallbacks !== null) {
|
| + for (TimeoutHandler handler in readyMeasurementFrameCallbacks) {
|
| + // TODO(jacobr): wrap each call to a handler in a try-catch block.
|
| + handler();
|
| + }
|
| + }
|
| +}
|
| +
|
| +class _WindowJs implements Window native "@*DOMWindow" {
|
| +
|
| + _DocumentJs get document() native "return this.document.documentElement;";
|
| +
|
| + void requestLayoutFrame(TimeoutHandler callback) {
|
| + _addMeasurementFrameCallback(callback);
|
| + }
|
| +
|
| +
|
| + static final int PERSISTENT = 1;
|
| +
|
| + static final int TEMPORARY = 0;
|
| +
|
| + final _DOMApplicationCacheJs applicationCache;
|
| +
|
| + _NavigatorJs clientInformation;
|
| +
|
| + final bool closed;
|
| +
|
| + _ConsoleJs console;
|
| +
|
| + final _CryptoJs crypto;
|
| +
|
| + String defaultStatus;
|
| +
|
| + String defaultstatus;
|
| +
|
| + num devicePixelRatio;
|
| +
|
| + _EventJs event;
|
| +
|
| + final _ElementJs frameElement;
|
| +
|
| + _WindowJs frames;
|
| +
|
| + _HistoryJs history;
|
| +
|
| + int innerHeight;
|
| +
|
| + int innerWidth;
|
| +
|
| + int length;
|
| +
|
| + final _StorageJs localStorage;
|
| +
|
| + _LocationJs location;
|
| +
|
| + _BarInfoJs locationbar;
|
| +
|
| + _BarInfoJs menubar;
|
| +
|
| + String name;
|
| +
|
| + _NavigatorJs navigator;
|
| +
|
| + bool offscreenBuffering;
|
| +
|
| + _WindowJs opener;
|
| +
|
| + int outerHeight;
|
| +
|
| + int outerWidth;
|
| +
|
| + final int pageXOffset;
|
| +
|
| + final int pageYOffset;
|
| +
|
| + _WindowJs parent;
|
| +
|
| + _PerformanceJs performance;
|
| +
|
| + _BarInfoJs personalbar;
|
| +
|
| + _ScreenJs screen;
|
| +
|
| + int screenLeft;
|
| +
|
| + int screenTop;
|
| +
|
| + int screenX;
|
| +
|
| + int screenY;
|
| +
|
| + int scrollX;
|
| +
|
| + int scrollY;
|
| +
|
| + _BarInfoJs scrollbars;
|
| +
|
| + _WindowJs self;
|
| +
|
| + final _StorageJs sessionStorage;
|
| +
|
| + String status;
|
| +
|
| + _BarInfoJs statusbar;
|
| +
|
| + final _StyleMediaJs styleMedia;
|
| +
|
| + _BarInfoJs toolbar;
|
| +
|
| + _WindowJs top;
|
| +
|
| + final _IDBFactoryJs webkitIndexedDB;
|
| +
|
| + final _NotificationCenterJs webkitNotifications;
|
| +
|
| + final _StorageInfoJs webkitStorageInfo;
|
| +
|
| + final _DOMURLJs webkitURL;
|
| +
|
| + final _WindowJs window;
|
| +
|
| + _WindowEventsImpl get on() =>
|
| + new _WindowEventsImpl(this);
|
| +
|
| + void _addEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.addEventListener(type, listener, useCapture);";
|
| +
|
| + void alert(String message) native;
|
| +
|
| + String atob(String string) native;
|
| +
|
| + void blur() native;
|
| +
|
| + String btoa(String string) native;
|
| +
|
| + void captureEvents() native;
|
| +
|
| + void clearInterval(int handle) native;
|
| +
|
| + void clearTimeout(int handle) native;
|
| +
|
| + void close() native;
|
| +
|
| + bool confirm(String message) native;
|
| +
|
| + bool _dispatchEvent(_EventJs evt) native "return this.dispatchEvent(evt);";
|
| +
|
| + bool find(String string, bool caseSensitive, bool backwards, bool wrap, bool wholeWord, bool searchInFrames, bool showDialog) native;
|
| +
|
| + void focus() native;
|
| +
|
| + _CSSStyleDeclarationJs _getComputedStyle(_ElementJs element, String pseudoElement) native "return this.getComputedStyle(element, pseudoElement);";
|
| +
|
| + _CSSRuleListJs getMatchedCSSRules(_ElementJs element, String pseudoElement) native;
|
| +
|
| + _DOMSelectionJs getSelection() native;
|
| +
|
| + _MediaQueryListJs matchMedia(String query) native;
|
| +
|
| + void moveBy(num x, num y) native;
|
| +
|
| + void moveTo(num x, num y) native;
|
| +
|
| + _WindowJs open(String url, String name, [String options = null]) native;
|
| +
|
| + _DatabaseJs openDatabase(String name, String version, String displayName, int estimatedSize, [DatabaseCallback creationCallback = null]) native;
|
| +
|
| + void postMessage(Dynamic message, String targetOrigin, [List messagePorts = null]) native;
|
| +
|
| + void print() native;
|
| +
|
| + String prompt(String message, String defaultValue) native;
|
| +
|
| + void releaseEvents() native;
|
| +
|
| + void _removeEventListener(String type, EventListener listener, [bool useCapture = null]) native "this.removeEventListener(type, listener, useCapture);";
|
| +
|
| + void resizeBy(num x, num y) native;
|
| +
|
| + void resizeTo(num width, num height) native;
|
| +
|
| + void scroll(int x, int y) native;
|
| +
|
| + void scrollBy(int x, int y) native;
|
| +
|
| + void scrollTo(int x, int y) native;
|
| +
|
| + int setInterval(TimeoutHandler handler, int timeout) native;
|
| +
|
| + int setTimeout(TimeoutHandler handler, int timeout) native;
|
| +
|
| + Object showModalDialog(String url, [Object dialogArgs = null, String featureArgs = null]) native;
|
| +
|
| + void stop() native;
|
| +
|
| + void webkitCancelAnimationFrame(int id) native;
|
| +
|
| + void webkitCancelRequestAnimationFrame(int id) native;
|
| +
|
| + _PointJs webkitConvertPointFromNodeToPage(_NodeJs node, _PointJs p) native;
|
| +
|
| + _PointJs webkitConvertPointFromPageToNode(_NodeJs node, _PointJs p) native;
|
| +
|
| + void webkitPostMessage(Dynamic message, String targetOrigin, [List transferList = null]) native;
|
| +
|
| + int webkitRequestAnimationFrame(RequestAnimationFrameCallback callback, _ElementJs element) native;
|
| +
|
| + void webkitRequestFileSystem(int type, int size, FileSystemCallback successCallback, [ErrorCallback errorCallback = null]) native;
|
| +
|
| + void webkitResolveLocalFileSystemURL(String url, [EntryCallback successCallback = null, ErrorCallback errorCallback = null]) native;
|
| +
|
| +}
|
| +
|
| +class _WindowEventsImpl extends _EventsImpl implements WindowEvents {
|
| + _WindowEventsImpl(_ptr) : super(_ptr);
|
| +
|
| + EventListenerList get abort() => _get('abort');
|
| +
|
| + EventListenerList get animationEnd() => _get('webkitAnimationEnd');
|
| +
|
| + EventListenerList get animationIteration() => _get('webkitAnimationIteration');
|
| +
|
| + EventListenerList get animationStart() => _get('webkitAnimationStart');
|
| +
|
| + EventListenerList get beforeUnload() => _get('beforeunload');
|
| +
|
| + EventListenerList get blur() => _get('blur');
|
| +
|
| + EventListenerList get canPlay() => _get('canplay');
|
| +
|
| + EventListenerList get canPlayThrough() => _get('canplaythrough');
|
| +
|
| + EventListenerList get change() => _get('change');
|
| +
|
| + EventListenerList get click() => _get('click');
|
| +
|
| + EventListenerList get contentLoaded() => _get('DOMContentLoaded');
|
| +
|
| + EventListenerList get contextMenu() => _get('contextmenu');
|
| +
|
| + EventListenerList get deviceMotion() => _get('devicemotion');
|
| +
|
| + EventListenerList get deviceOrientation() => _get('deviceorientation');
|
| +
|
| + EventListenerList get doubleClick() => _get('dblclick');
|
| +
|
| + EventListenerList get drag() => _get('drag');
|
| +
|
| + EventListenerList get dragEnd() => _get('dragend');
|
| +
|
| + EventListenerList get dragEnter() => _get('dragenter');
|
| +
|
| + EventListenerList get dragLeave() => _get('dragleave');
|
| +
|
| + EventListenerList get dragOver() => _get('dragover');
|
| +
|
| + EventListenerList get dragStart() => _get('dragstart');
|
| +
|
| + EventListenerList get drop() => _get('drop');
|
| +
|
| + EventListenerList get durationChange() => _get('durationchange');
|
| +
|
| + EventListenerList get emptied() => _get('emptied');
|
| +
|
| + EventListenerList get ended() => _get('ended');
|
| +
|
| + EventListenerList get error() => _get('error');
|
| +
|
| + EventListenerList get focus() => _get('focus');
|
| +
|
| + EventListenerList get hashChange() => _get('hashchange');
|
| +
|
| + EventListenerList get input() => _get('input');
|
| +
|
| + EventListenerList get invalid() => _get('invalid');
|
| +
|
| + EventListenerList get keyDown() => _get('keydown');
|
| +
|
| + EventListenerList get keyPress() => _get('keypress');
|
| +
|
| + EventListenerList get keyUp() => _get('keyup');
|
| +
|
| + EventListenerList get load() => _get('load');
|
| +
|
| + EventListenerList get loadStart() => _get('loadstart');
|
| +
|
| + EventListenerList get loadedData() => _get('loadeddata');
|
| +
|
| + EventListenerList get loadedMetadata() => _get('loadedmetadata');
|
| +
|
| + EventListenerList get message() => _get('message');
|
| +
|
| + EventListenerList get mouseDown() => _get('mousedown');
|
| +
|
| + EventListenerList get mouseMove() => _get('mousemove');
|
| +
|
| + EventListenerList get mouseOut() => _get('mouseout');
|
| +
|
| + EventListenerList get mouseOver() => _get('mouseover');
|
| +
|
| + EventListenerList get mouseUp() => _get('mouseup');
|
| +
|
| + EventListenerList get mouseWheel() => _get('mousewheel');
|
| +
|
| + EventListenerList get offline() => _get('offline');
|
| +
|
| + EventListenerList get online() => _get('online');
|
| +
|
| + EventListenerList get pageHide() => _get('pagehide');
|
| +
|
| + EventListenerList get pageShow() => _get('pageshow');
|
| +
|
| + EventListenerList get pause() => _get('pause');
|
| +
|
| + EventListenerList get play() => _get('play');
|
| +
|
| + EventListenerList get playing() => _get('playing');
|
| +
|
| + EventListenerList get popState() => _get('popstate');
|
| +
|
| + EventListenerList get progress() => _get('progress');
|
| +
|
| + EventListenerList get rateChange() => _get('ratechange');
|
| +
|
| + EventListenerList get reset() => _get('reset');
|
| +
|
| + EventListenerList get resize() => _get('resize');
|
| +
|
| + EventListenerList get scroll() => _get('scroll');
|
| +
|
| + EventListenerList get search() => _get('search');
|
| +
|
| + EventListenerList get seeked() => _get('seeked');
|
| +
|
| + EventListenerList get seeking() => _get('seeking');
|
| +
|
| + EventListenerList get select() => _get('select');
|
| +
|
| + EventListenerList get stalled() => _get('stalled');
|
| +
|
| + EventListenerList get storage() => _get('storage');
|
| +
|
| + EventListenerList get submit() => _get('submit');
|
| +
|
| + EventListenerList get suspend() => _get('suspend');
|
| +
|
| + EventListenerList get timeUpdate() => _get('timeupdate');
|
| +
|
| + EventListenerList get touchCancel() => _get('touchcancel');
|
| +
|
| + EventListenerList get touchEnd() => _get('touchend');
|
| +
|
| + EventListenerList get touchMove() => _get('touchmove');
|
| +
|
| + EventListenerList get touchStart() => _get('touchstart');
|
| +
|
| + EventListenerList get transitionEnd() => _get('webkitTransitionEnd');
|
| +
|
| + EventListenerList get unload() => _get('unload');
|
| +
|
| + EventListenerList get volumeChange() => _get('volumechange');
|
| +
|
| + EventListenerList get waiting() => _get('waiting');
|
| +}
|
|
|