blob: c96ee3c7f5ac75b1253aa6c901c549400b458323 [file] [log] [blame]
/**
* HTML elements and other resources for web-based applications that need to
* interact with the browser and the DOM (Document Object Model).
*
* This library includes DOM element types, CSS styling, local storage,
* media, speech, events, and more.
* To get started,
* check out the [Element] class, the base class for many of the HTML
* DOM types.
*
* ## Other resources
*
* * If you've never written a web app before, try our
* tutorials—[A Game of Darts](http://dartlang.org/docs/tutorials).
*
* * To see some web-based Dart apps in action and to play with the code,
* download
* [Dart Editor](http://www.dartlang.org/#get-started)
* and run its built-in examples.
*
* * For even more examples, see
* [Dart HTML5 Samples](https://github.com/dart-lang/dart-html5-samples)
* on Github.
*/
library dart.dom.html;
import 'dart:async';
import 'dart:collection';
import 'dart:_internal' hide Symbol, deprecated;
import 'dart:html_common';
import 'dart:indexed_db';
import 'dart:isolate';
import "dart:convert";
import 'dart:math';
import 'dart:_native_typed_data';
import 'dart:typed_data';
import 'dart:svg' as svg;
import 'dart:svg' show Matrix;
import 'dart:svg' show SvgSvgElement;
import 'dart:web_audio' as web_audio;
import 'dart:web_gl' as gl;
import 'dart:web_gl' show RenderingContext;
import 'dart:web_sql';
import 'dart:_isolate_helper' show IsolateNatives;
import 'dart:_foreign_helper' show JS, JS_INTERCEPTOR_CONSTANT, JS_CONST;
// 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.
// DO NOT EDIT - unless you are editing documentation as per:
// https://code.google.com/p/dart/wiki/ContributingHTMLDocumentation
// Auto-generated dart:html library.
// Not actually used, but imported since dart:html can generate these objects.
import 'dart:_js_helper' show
convertDartClosureToJS, Creates, JavaScriptIndexingBehavior,
JSName, Native, Null, Returns, Inline, ForceInline,
findDispatchTagForInterceptorClass, setNativeSubclassDispatchRecord,
makeLeafDispatchRecord;
import 'dart:_interceptors' show
Interceptor, JSExtendableArray, JSUInt31,
findInterceptorConstructorForType,
findConstructorForNativeSubclassType,
getNativeInterceptor,
setDispatchProperty;
export 'dart:math' show Rectangle, Point;
/**
* Top-level container for a web page, which is usually a browser tab or window.
*
* Each web page loaded in the browser has its own [Window], which is a
* container for the web page.
*
* If the web page has any `<iframe>` elements, then each `<iframe>` has its own
* [Window] object, which is accessible only to that `<iframe>`.
*
* See also:
*
* * [Window](https://developer.mozilla.org/en-US/docs/Web/API/window) from MDN.
*/
Window get window => JS('Window', 'window');
/**
* Root node for all content in a web page.
*/
HtmlDocument get document => JS('HtmlDocument', 'document');
// Workaround for tags like <cite> that lack their own Element subclass --
// Dart issue 1990.
@Native("HTMLElement")
class HtmlElement extends Element {
factory HtmlElement() { throw new UnsupportedError("Not supported"); }
/**
* Constructor instantiated by the DOM when a custom element has been created.
*
* This can only be called by subclasses from their created constructor.
*/
HtmlElement.created() : super.created();
}
// EntryArray type was removed, so explicitly adding it to allow support for
// older Chrome versions.
// Issue #12573.
@Native("EntryArray")
abstract class _EntryArray implements List<Entry> {}
/**
* Spawn a DOM isolate using the given URI in the same window.
* This isolate is not concurrent. It runs on the browser thread
* with full access to the DOM.
* Note: this API is still evolving and may move to dart:isolate.
*/
@Experimental()
Future<Isolate> spawnDomUri(Uri uri, List<String> args, message) {
// TODO(17738): Implement this.
throw new UnimplementedError();
}
// Copyright (c) 2013, 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.
@DocsEditable()
@DomName('AbstractWorker')
abstract class AbstractWorker extends Interceptor implements EventTarget {
// To suppress missing implicit constructor warnings.
factory AbstractWorker._() { throw new UnsupportedError("Not supported"); }
/**
* Static factory designed to expose `error` events to event
* handlers that are not necessarily instances of [AbstractWorker].
*
* See [EventStreamProvider] for usage information.
*/
@DomName('AbstractWorker.errorEvent')
@DocsEditable()
static const EventStreamProvider<ErrorEvent> errorEvent = const EventStreamProvider<ErrorEvent>('error');
/// Stream of `error` events handled by this [AbstractWorker].
@DomName('AbstractWorker.onerror')
@DocsEditable()
Stream<ErrorEvent> get onError => errorEvent.forTarget(this);
}
// Copyright (c) 2015, 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.
@DocsEditable()
@DomName('HTMLAnchorElement')
@Native("HTMLAnchorElement")
class AnchorElement extends HtmlElement implements UrlUtils {
// To suppress missing implicit constructor warnings.
factory AnchorElement._() { throw new UnsupportedError("Not supported"); }
@DomName('HTMLAnchorElement.HTMLAnchorElement')
@DocsEditable()
factory AnchorElement({String href}) {
var e = document.createElement("a");
if (href != null) e.href = href;
return e;
}
/**
* Constructor instantiated by the DOM when a custom element has been created.
*
* This can only be called by subclasses from their created constructor.
*/
AnchorElement.created() : super.created();
@DomName('HTMLAnchorElement.download')
@DocsEditable()
String download;
@DomName('HTMLAnchorElement.hreflang')
@DocsEditable()
String hreflang;
@DomName('HTMLAnchorElement.integrity')
@DocsEditable()
@Experimental() // untriaged
String integrity;
@DomName('HTMLAnchorElement.rel')
@DocsEditable()
String rel;
@DomName('HTMLAnchorElement.target')
@DocsEditable()
String target;
@DomName('HTMLAnchorElement.type')
@DocsEditable()
String type;
// From URLUtils
@DomName('HTMLAnchorElement.hash')
@DocsEditable()
String hash;
@DomName('HTMLAnchorElement.host')
@DocsEditable()
String host;
@DomName('HTMLAnchorElement.hostname')
@DocsEditable()
String hostname;
@DomName('HTMLAnchorElement.href')
@DocsEditable()
String href;
@DomName('HTMLAnchorElement.origin')
@DocsEditable()
// WebKit only
@Experimental() // non-standard
final String origin;
@DomName('HTMLAnchorElement.password')
@DocsEditable()
@Experimental() // untriaged
String password;
@DomName('HTMLAnchorElement.pathname')
@DocsEditable()
String pathname;
@DomName('HTMLAnchorElement.port')
@DocsEditable()
String port;
@DomName('HTMLAnchorElement.protocol')
@DocsEditable()
String protocol;
@DomName('HTMLAnchorElement.search')
@DocsEditable()
String search;
@DomName('HTMLAnchorElement.username')
@DocsEditable()
@Experimental() // untriaged
String username;
@DomName('HTMLAnchorElement.toString')
@DocsEditable()
String toString() => JS('String', 'String(#)', this);
}
// 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.
@DocsEditable()
@DomName('Animation')
@Experimental() // untriaged
@Native("Animation")
class Animation extends AnimationNode {
// To suppress missing implicit constructor warnings.
factory Animation._() { throw new UnsupportedError("Not supported"); }
@DomName('Animation.Animation')
@DocsEditable()
factory Animation(Element target, List<Map> keyframes, [timingInput]) {
if ((keyframes is List<Map> || keyframes == null) && (target is Element || target == null) && timingInput == null) {
return Animation._create_1(target, keyframes);
}
if ((timingInput is num || timingInput == null) && (keyframes is List<Map> || keyframes == null) && (target is Element || target == null)) {
return Animation._create_2(target, keyframes, timingInput);
}
if ((timingInput is Map || timingInput == null) && (keyframes is List<Map> || keyframes == null) && (target is Element || target == null)) {
var timingInput_1 = convertDartToNative_Dictionary(timingInput);
return Animation._create_3(target, keyframes, timingInput_1);
}
throw new ArgumentError("Incorrect number or type of arguments");
}
static Animation _create_1(target, keyframes) => JS('Animation', 'new Animation(#,#)', target, keyframes);
static Animation _create_2(target, keyframes, timingInput) => JS('Animation', 'new Animation(#,#,#)', target, keyframes, timingInput);
static Animation _create_3(target, keyframes, timingInput) => JS('Animation', 'new Animation(#,#,#)', target, keyframes, timingInput);
}
// 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.
@DocsEditable()
@DomName('AnimationEffect')
@Experimental() // untriaged
@Native("AnimationEffect")
class AnimationEffect extends Interceptor {
// To suppress missing implicit constructor warnings.
factory AnimationEffect._() { throw new UnsupportedError("Not supported"); }
}
// 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.
@DocsEditable()
@DomName('WebKitAnimationEvent')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@Experimental()
@Native("WebKitAnimationEvent")
class AnimationEvent extends Event {
// To suppress missing implicit constructor warnings.
factory AnimationEvent._() { throw new UnsupportedError("Not supported"); }
@DomName('WebKitAnimationEvent.animationName')
@DocsEditable()
final String animationName;
@DomName('WebKitAnimationEvent.elapsedTime')
@DocsEditable()
final double elapsedTime;
}
// 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.
@DocsEditable()
@DomName('AnimationNode')
@Experimental() // untriaged
@Native("AnimationNode")
class AnimationNode extends Interceptor {
// To suppress missing implicit constructor warnings.
factory AnimationNode._() { throw new UnsupportedError("Not supported"); }
@DomName('AnimationNode.activeDuration')
@DocsEditable()
@Experimental() // untriaged
final double activeDuration;
@DomName('AnimationNode.currentIteration')
@DocsEditable()
@Experimental() // untriaged
final int currentIteration;
@DomName('AnimationNode.duration')
@DocsEditable()
@Experimental() // untriaged
final double duration;
@DomName('AnimationNode.endTime')
@DocsEditable()
@Experimental() // untriaged
final double endTime;
@DomName('AnimationNode.localTime')
@DocsEditable()
@Experimental() // untriaged
final double localTime;
@DomName('AnimationNode.player')
@DocsEditable()
@Experimental() // untriaged
final AnimationPlayer player;
@DomName('AnimationNode.startTime')
@DocsEditable()
@Experimental() // untriaged
final double startTime;
@DomName('AnimationNode.timing')
@DocsEditable()
@Experimental() // untriaged
final Timing timing;
}
// 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.
@DocsEditable()
@DomName('AnimationPlayer')
@Experimental() // untriaged
@Native("AnimationPlayer")
class AnimationPlayer extends EventTarget {
// To suppress missing implicit constructor warnings.
factory AnimationPlayer._() { throw new UnsupportedError("Not supported"); }
/// Checks if this type is supported on the current platform.
static bool get supported => JS('bool', '!!(document.body.animate)');
@DomName('AnimationPlayer.currentTime')
@DocsEditable()
@Experimental() // untriaged
num currentTime;
@DomName('AnimationPlayer.playState')
@DocsEditable()
@Experimental() // untriaged
final String playState;
@DomName('AnimationPlayer.playbackRate')
@DocsEditable()
@Experimental() // untriaged
num playbackRate;
@DomName('AnimationPlayer.source')
@DocsEditable()
@Experimental() // untriaged
AnimationNode source;
@DomName('AnimationPlayer.startTime')
@DocsEditable()
@Experimental() // untriaged
num startTime;
@DomName('AnimationPlayer.cancel')
@DocsEditable()
@Experimental() // untriaged
void cancel() native;
@DomName('AnimationPlayer.finish')
@DocsEditable()
@Experimental() // untriaged
void finish() native;
@DomName('AnimationPlayer.pause')
@DocsEditable()
@Experimental() // untriaged
void pause() native;
@DomName('AnimationPlayer.play')
@DocsEditable()
@Experimental() // untriaged
void play() native;
@DomName('AnimationPlayer.reverse')
@DocsEditable()
@Experimental() // untriaged
void reverse() native;
}
// 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.
@DocsEditable()
@DomName('AnimationPlayerEvent')
@Experimental() // untriaged
@Native("AnimationPlayerEvent")
class AnimationPlayerEvent extends Event {
// To suppress missing implicit constructor warnings.
factory AnimationPlayerEvent._() { throw new UnsupportedError("Not supported"); }
@DomName('AnimationPlayerEvent.currentTime')
@DocsEditable()
@Experimental() // untriaged
final double currentTime;
@DomName('AnimationPlayerEvent.timelineTime')
@DocsEditable()
@Experimental() // untriaged
final double timelineTime;
}
// 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.
@DocsEditable()
@DomName('AnimationTimeline')
@Experimental() // untriaged
@Native("AnimationTimeline")
class AnimationTimeline extends Interceptor {
// To suppress missing implicit constructor warnings.
factory AnimationTimeline._() { throw new UnsupportedError("Not supported"); }
@DomName('AnimationTimeline.currentTime')
@DocsEditable()
@Experimental() // untriaged
final double currentTime;
@DomName('AnimationTimeline.getAnimationPlayers')
@DocsEditable()
@Experimental() // untriaged
List<AnimationPlayer> getAnimationPlayers() native;
@DomName('AnimationTimeline.play')
@DocsEditable()
@Experimental() // untriaged
AnimationPlayer play(AnimationNode source) native;
}
// 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.
@DocsEditable()
/**
* ApplicationCache is accessed via [Window.applicationCache].
*/
@DomName('ApplicationCache')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.FIREFOX)
@SupportedBrowser(SupportedBrowser.IE, '10')
@SupportedBrowser(SupportedBrowser.OPERA)
@SupportedBrowser(SupportedBrowser.SAFARI)
@Unstable()
@Native("ApplicationCache,DOMApplicationCache,OfflineResourceList")
class ApplicationCache extends EventTarget {
// To suppress missing implicit constructor warnings.
factory ApplicationCache._() { throw new UnsupportedError("Not supported"); }
/**
* Static factory designed to expose `cached` events to event
* handlers that are not necessarily instances of [ApplicationCache].
*
* See [EventStreamProvider] for usage information.
*/
@DomName('ApplicationCache.cachedEvent')
@DocsEditable()
static const EventStreamProvider<Event> cachedEvent = const EventStreamProvider<Event>('cached');
/**
* Static factory designed to expose `checking` events to event
* handlers that are not necessarily instances of [ApplicationCache].
*
* See [EventStreamProvider] for usage information.
*/
@DomName('ApplicationCache.checkingEvent')
@DocsEditable()
static const EventStreamProvider<Event> checkingEvent = const EventStreamProvider<Event>('checking');
/**
* Static factory designed to expose `downloading` events to event
* handlers that are not necessarily instances of [ApplicationCache].
*
* See [EventStreamProvider] for usage information.
*/
@DomName('ApplicationCache.downloadingEvent')
@DocsEditable()
static const EventStreamProvider<Event> downloadingEvent = const EventStreamProvider<Event>('downloading');
/**
* Static factory designed to expose `error` events to event
* handlers that are not necessarily instances of [ApplicationCache].
*
* See [EventStreamProvider] for usage information.
*/
@DomName('ApplicationCache.errorEvent')
@DocsEditable()
static const EventStreamProvider<Event> errorEvent = const EventStreamProvider<Event>('error');
/**
* Static factory designed to expose `noupdate` events to event
* handlers that are not necessarily instances of [ApplicationCache].
*
* See [EventStreamProvider] for usage information.
*/
@DomName('ApplicationCache.noupdateEvent')
@DocsEditable()
static const EventStreamProvider<Event> noUpdateEvent = const EventStreamProvider<Event>('noupdate');
/**
* Static factory designed to expose `obsolete` events to event
* handlers that are not necessarily instances of [ApplicationCache].
*
* See [EventStreamProvider] for usage information.
*/
@DomName('ApplicationCache.obsoleteEvent')
@DocsEditable()
static const EventStreamProvider<Event> obsoleteEvent = const EventStreamProvider<Event>('obsolete');
/**
* Static factory designed to expose `progress` events to event
* handlers that are not necessarily instances of [ApplicationCache].
*
* See [EventStreamProvider] for usage information.
*/
@DomName('ApplicationCache.progressEvent')
@DocsEditable()
static const EventStreamProvider<ProgressEvent> progressEvent = const EventStreamProvider<ProgressEvent>('progress');
/**
* Static factory designed to expose `updateready` events to event
* handlers that are not necessarily instances of [ApplicationCache].
*
* See [EventStreamProvider] for usage information.
*/
@DomName('ApplicationCache.updatereadyEvent')
@DocsEditable()
static const EventStreamProvider<Event> updateReadyEvent = const EventStreamProvider<Event>('updateready');
/// Checks if this type is supported on the current platform.
static bool get supported => JS('bool', '!!(window.applicationCache)');
@DomName('ApplicationCache.CHECKING')
@DocsEditable()
static const int CHECKING = 2;
@DomName('ApplicationCache.DOWNLOADING')
@DocsEditable()
static const int DOWNLOADING = 3;
@DomName('ApplicationCache.IDLE')
@DocsEditable()
static const int IDLE = 1;
@DomName('ApplicationCache.OBSOLETE')
@DocsEditable()
static const int OBSOLETE = 5;
@DomName('ApplicationCache.UNCACHED')
@DocsEditable()
static const int UNCACHED = 0;
@DomName('ApplicationCache.UPDATEREADY')
@DocsEditable()
static const int UPDATEREADY = 4;
@DomName('ApplicationCache.status')
@DocsEditable()
final int status;
@DomName('ApplicationCache.abort')
@DocsEditable()
void abort() native;
@DomName('ApplicationCache.swapCache')
@DocsEditable()
void swapCache() native;
@DomName('ApplicationCache.update')
@DocsEditable()
void update() native;
/// Stream of `cached` events handled by this [ApplicationCache].
@DomName('ApplicationCache.oncached')
@DocsEditable()
Stream<Event> get onCached => cachedEvent.forTarget(this);
/// Stream of `checking` events handled by this [ApplicationCache].
@DomName('ApplicationCache.onchecking')
@DocsEditable()
Stream<Event> get onChecking => checkingEvent.forTarget(this);
/// Stream of `downloading` events handled by this [ApplicationCache].
@DomName('ApplicationCache.ondownloading')
@DocsEditable()
Stream<Event> get onDownloading => downloadingEvent.forTarget(this);
/// Stream of `error` events handled by this [ApplicationCache].
@DomName('ApplicationCache.onerror')
@DocsEditable()
Stream<Event> get onError => errorEvent.forTarget(this);
/// Stream of `noupdate` events handled by this [ApplicationCache].
@DomName('ApplicationCache.onnoupdate')
@DocsEditable()
Stream<Event> get onNoUpdate => noUpdateEvent.forTarget(this);
/// Stream of `obsolete` events handled by this [ApplicationCache].
@DomName('ApplicationCache.onobsolete')
@DocsEditable()
Stream<Event> get onObsolete => obsoleteEvent.forTarget(this);
/// Stream of `progress` events handled by this [ApplicationCache].
@DomName('ApplicationCache.onprogress')
@DocsEditable()
Stream<ProgressEvent> get onProgress => progressEvent.forTarget(this);
/// Stream of `updateready` events handled by this [ApplicationCache].
@DomName('ApplicationCache.onupdateready')
@DocsEditable()
Stream<Event> get onUpdateReady => updateReadyEvent.forTarget(this);
}
// 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.
@DocsEditable()
@DomName('ApplicationCacheErrorEvent')
@Experimental() // untriaged
@Native("ApplicationCacheErrorEvent")
class ApplicationCacheErrorEvent extends Event {
// To suppress missing implicit constructor warnings.
factory ApplicationCacheErrorEvent._() { throw new UnsupportedError("Not supported"); }
@DomName('ApplicationCacheErrorEvent.message')
@DocsEditable()
@Experimental() // untriaged
final String message;
@DomName('ApplicationCacheErrorEvent.reason')
@DocsEditable()
@Experimental() // untriaged
final String reason;
@DomName('ApplicationCacheErrorEvent.status')
@DocsEditable()
@Experimental() // untriaged
final int status;
@DomName('ApplicationCacheErrorEvent.url')
@DocsEditable()
@Experimental() // untriaged
final String url;
}
// Copyright (c) 2015, 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.
@DocsEditable()
/**
* DOM Area Element, which links regions of an image map with a hyperlink.
*
* The element can also define an uninteractive region of the map.
*
* See also:
*
* * [<area>](https://developer.mozilla.org/en-US/docs/HTML/Element/area)
* on MDN.
*/
@DomName('HTMLAreaElement')
@Native("HTMLAreaElement")
class AreaElement extends HtmlElement implements UrlUtils {
// To suppress missing implicit constructor warnings.
factory AreaElement._() { throw new UnsupportedError("Not supported"); }
@DomName('HTMLAreaElement.HTMLAreaElement')
@DocsEditable()
factory AreaElement() => document.createElement("area");
/**
* Constructor instantiated by the DOM when a custom element has been created.
*
* This can only be called by subclasses from their created constructor.
*/
AreaElement.created() : super.created();
@DomName('HTMLAreaElement.alt')
@DocsEditable()
String alt;
@DomName('HTMLAreaElement.coords')
@DocsEditable()
String coords;
@DomName('HTMLAreaElement.shape')
@DocsEditable()
String shape;
@DomName('HTMLAreaElement.target')
@DocsEditable()
String target;
// From URLUtils
@DomName('HTMLAreaElement.hash')
@DocsEditable()
String hash;
@DomName('HTMLAreaElement.host')
@DocsEditable()
String host;
@DomName('HTMLAreaElement.hostname')
@DocsEditable()
String hostname;
@DomName('HTMLAreaElement.href')
@DocsEditable()
String href;
@DomName('HTMLAreaElement.origin')
@DocsEditable()
@Experimental() // untriaged
final String origin;
@DomName('HTMLAreaElement.password')
@DocsEditable()
@Experimental() // untriaged
String password;
@DomName('HTMLAreaElement.pathname')
@DocsEditable()
String pathname;
@DomName('HTMLAreaElement.port')
@DocsEditable()
String port;
@DomName('HTMLAreaElement.protocol')
@DocsEditable()
String protocol;
@DomName('HTMLAreaElement.search')
@DocsEditable()
String search;
@DomName('HTMLAreaElement.username')
@DocsEditable()
@Experimental() // untriaged
String username;
@DomName('HTMLAreaElement.toString')
@DocsEditable()
String toString() => JS('String', 'String(#)', this);
}
// 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.
@DocsEditable()
@DomName('HTMLAudioElement')
@Native("HTMLAudioElement")
class AudioElement extends MediaElement {
// To suppress missing implicit constructor warnings.
factory AudioElement._() { throw new UnsupportedError("Not supported"); }
@DomName('HTMLAudioElement.HTMLAudioElement')
@DocsEditable()
factory AudioElement([String src]) {
if (src != null) {
return AudioElement._create_1(src);
}
return AudioElement._create_2();
}
static AudioElement _create_1(src) => JS('AudioElement', 'new Audio(#)', src);
static AudioElement _create_2() => JS('AudioElement', 'new Audio()');
/**
* Constructor instantiated by the DOM when a custom element has been created.
*
* This can only be called by subclasses from their created constructor.
*/
AudioElement.created() : super.created();
}
// 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.
@DocsEditable()
@DomName('AudioTrack')
@Experimental() // untriaged
@Native("AudioTrack")
class AudioTrack extends Interceptor {
// To suppress missing implicit constructor warnings.
factory AudioTrack._() { throw new UnsupportedError("Not supported"); }
@DomName('AudioTrack.enabled')
@DocsEditable()
@Experimental() // untriaged
bool enabled;
@DomName('AudioTrack.id')
@DocsEditable()
@Experimental() // untriaged
final String id;
@DomName('AudioTrack.kind')
@DocsEditable()
@Experimental() // untriaged
final String kind;
@DomName('AudioTrack.label')
@DocsEditable()
@Experimental() // untriaged
final String label;
@DomName('AudioTrack.language')
@DocsEditable()
@Experimental() // untriaged
final String language;
}
// 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.
@DocsEditable()
@DomName('AudioTrackList')
@Experimental() // untriaged
@Native("AudioTrackList")
class AudioTrackList extends EventTarget {
// To suppress missing implicit constructor warnings.
factory AudioTrackList._() { throw new UnsupportedError("Not supported"); }
@DomName('AudioTrackList.changeEvent')
@DocsEditable()
@Experimental() // untriaged
static const EventStreamProvider<Event> changeEvent = const EventStreamProvider<Event>('change');
@DomName('AudioTrackList.length')
@DocsEditable()
@Experimental() // untriaged
final int length;
@DomName('AudioTrackList.__getter__')
@DocsEditable()
@Experimental() // untriaged
AudioTrack __getter__(int index) native;
@DomName('AudioTrackList.getTrackById')
@DocsEditable()
@Experimental() // untriaged
AudioTrack getTrackById(String id) native;
@DomName('AudioTrackList.onchange')
@DocsEditable()
@Experimental() // untriaged
Stream<Event> get onChange => changeEvent.forTarget(this);
}
// 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.
@DocsEditable()
@DomName('AutocompleteErrorEvent')
// http://wiki.whatwg.org/wiki/RequestAutocomplete
@Experimental()
@Native("AutocompleteErrorEvent")
class AutocompleteErrorEvent extends Event {
// To suppress missing implicit constructor warnings.
factory AutocompleteErrorEvent._() { throw new UnsupportedError("Not supported"); }
@DomName('AutocompleteErrorEvent.reason')
@DocsEditable()
final String reason;
}
// 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.
@DocsEditable()
@DomName('HTMLBRElement')
@Native("HTMLBRElement")
class BRElement extends HtmlElement {
// To suppress missing implicit constructor warnings.
factory BRElement._() { throw new UnsupportedError("Not supported"); }
@DomName('HTMLBRElement.HTMLBRElement')
@DocsEditable()
factory BRElement() => document.createElement("br");
/**
* Constructor instantiated by the DOM when a custom element has been created.
*
* This can only be called by subclasses from their created constructor.
*/
BRElement.created() : super.created();
}
// 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.
@DocsEditable()
@DomName('BarProp')
// http://www.whatwg.org/specs/web-apps/current-work/multipage/browsers.html#barprop
@deprecated // standard
@Native("BarProp")
class BarProp extends Interceptor {
// To suppress missing implicit constructor warnings.
factory BarProp._() { throw new UnsupportedError("Not supported"); }
@DomName('BarProp.visible')
@DocsEditable()
final bool visible;
}
// 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.
@DocsEditable()
@DomName('HTMLBaseElement')
@Native("HTMLBaseElement")
class BaseElement extends HtmlElement {
// To suppress missing implicit constructor warnings.
factory BaseElement._() { throw new UnsupportedError("Not supported"); }
@DomName('HTMLBaseElement.HTMLBaseElement')
@DocsEditable()
factory BaseElement() => document.createElement("base");
/**
* Constructor instantiated by the DOM when a custom element has been created.
*
* This can only be called by subclasses from their created constructor.
*/
BaseElement.created() : super.created();
@DomName('HTMLBaseElement.href')
@DocsEditable()
String href;
@DomName('HTMLBaseElement.target')
@DocsEditable()
String target;
}
// 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.
@DocsEditable()
@DomName('BatteryManager')
// https://dvcs.w3.org/hg/dap/raw-file/default/battery/Overview.html#batterymanager-interface
@Experimental() // stable
@Native("BatteryManager")
class BatteryManager extends EventTarget {
// To suppress missing implicit constructor warnings.
factory BatteryManager._() { throw new UnsupportedError("Not supported"); }
@DomName('BatteryManager.charging')
@DocsEditable()
final bool charging;
@DomName('BatteryManager.chargingTime')
@DocsEditable()
final double chargingTime;
@DomName('BatteryManager.dischargingTime')
@DocsEditable()
final double dischargingTime;
@DomName('BatteryManager.level')
@DocsEditable()
final double level;
}
// 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.
@DocsEditable()
@DomName('BeforeUnloadEvent')
@Native("BeforeUnloadEvent")
class BeforeUnloadEvent extends Event {
// To suppress missing implicit constructor warnings.
factory BeforeUnloadEvent._() { throw new UnsupportedError("Not supported"); }
// Shadowing definition.
String get returnValue => JS("String", "#.returnValue", this);
void set returnValue(String value) {
JS("void", "#.returnValue = #", this, value);
}
}
// 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.
@DomName('Blob')
@Native("Blob")
class Blob extends Interceptor {
// To suppress missing implicit constructor warnings.
factory Blob._() { throw new UnsupportedError("Not supported"); }
@DomName('Blob.size')
@DocsEditable()
final int size;
@DomName('Blob.type')
@DocsEditable()
final String type;
@DomName('Blob.close')
@DocsEditable()
@Experimental() // untriaged
void close() native;
@DomName('Blob.slice')
@DocsEditable()
Blob slice([int start, int end, String contentType]) native;
factory Blob(List blobParts, [String type, String endings]) {
// TODO: validate that blobParts is a JS Array and convert if not.
// TODO: any coercions on the elements of blobParts, e.g. coerce a typed
// array to ArrayBuffer if it is a total view.
if (type == null && endings == null) {
return _create_1(blobParts);
}
var bag = _create_bag();
if (type != null) _bag_set(bag, 'type', type);
if (endings != null) _bag_set(bag, 'endings', endings);
return _create_2(blobParts, bag);
}
static _create_1(parts) => JS('Blob', 'new Blob(#)', parts);
static _create_2(parts, bag) => JS('Blob', 'new Blob(#, #)', parts, bag);
static _create_bag() => JS('var', '{}');
static _bag_set(bag, key, value) { JS('void', '#[#] = #', bag, key, value); }
}
// 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.
@DocsEditable()
@DomName('Body')
@Experimental() // untriaged
@Native("Body")
class Body extends Interceptor {
// To suppress missing implicit constructor warnings.
factory Body._() { throw new UnsupportedError("Not supported"); }
@DomName('Body.bodyUsed')
@DocsEditable()
@Experimental() // untriaged
final bool bodyUsed;
@DomName('Body.arrayBuffer')
@DocsEditable()
@Experimental() // untriaged
Future arrayBuffer() native;
@DomName('Body.blob')
@DocsEditable()
@Experimental() // untriaged
Future blob() native;
@DomName('Body.json')
@DocsEditable()
@Experimental() // untriaged
Future json() native;
@DomName('Body.text')
@DocsEditable()
@Experimental() // untriaged
Future text() native;
}
// 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.
@DocsEditable()
@DomName('HTMLBodyElement')
@Native("HTMLBodyElement")
class BodyElement extends HtmlElement implements WindowEventHandlers {
// To suppress missing implicit constructor warnings.
factory BodyElement._() { throw new UnsupportedError("Not supported"); }
/**
* Static factory designed to expose `blur` events to event
* handlers that are not necessarily instances of [BodyElement].
*
* See [EventStreamProvider] for usage information.
*/
@DomName('HTMLBodyElement.blurEvent')
@DocsEditable()
static const EventStreamProvider<Event> blurEvent = const EventStreamProvider<Event>('blur');
/**
* Static factory designed to expose `error` events to event
* handlers that are not necessarily instances of [BodyElement].
*
* See [EventStreamProvider] for usage information.
*/
@DomName('HTMLBodyElement.errorEvent')
@DocsEditable()
static const EventStreamProvider<Event> errorEvent = const EventStreamProvider<Event>('error');
/**
* Static factory designed to expose `focus` events to event
* handlers that are not necessarily instances of [BodyElement].
*
* See [EventStreamProvider] for usage information.
*/
@DomName('HTMLBodyElement.focusEvent')
@DocsEditable()
static const EventStreamProvider<Event> focusEvent = const EventStreamProvider<Event>('focus');
/**
* Static factory designed to expose `hashchange` events to event
* handlers that are not necessarily instances of [BodyElement].
*
* See [EventStreamProvider] for usage information.
*/
@DomName('HTMLBodyElement.hashchangeEvent')
@DocsEditable()
static const EventStreamProvider<Event> hashChangeEvent = const EventStreamProvider<Event>('hashchange');
/**
* Static factory designed to expose `load` events to event
* handlers that are not necessarily instances of [BodyElement].
*
* See [EventStreamProvider] for usage information.
*/
@DomName('HTMLBodyElement.loadEvent')
@DocsEditable()
static const EventStreamProvider<Event> loadEvent = const EventStreamProvider<Event>('load');
/**
* Static factory designed to expose `message` events to event
* handlers that are not necessarily instances of [BodyElement].
*
* See [EventStreamProvider] for usage information.
*/
@DomName('HTMLBodyElement.messageEvent')
@DocsEditable()
static const EventStreamProvider<MessageEvent> messageEvent = const EventStreamProvider<MessageEvent>('message');
/**
* Static factory designed to expose `offline` events to event
* handlers that are not necessarily instances of [BodyElement].
*
* See [EventStreamProvider] for usage information.
*/
@DomName('HTMLBodyElement.offlineEvent')
@DocsEditable()
static const EventStreamProvider<Event> offlineEvent = const EventStreamProvider<Event>('offline');
/**
* Static factory designed to expose `online` events to event
* handlers that are not necessarily instances of [BodyElement].
*
* See [EventStreamProvider] for usage information.
*/
@DomName('HTMLBodyElement.onlineEvent')
@DocsEditable()
static const EventStreamProvider<Event> onlineEvent = const EventStreamProvider<Event>('online');
/**
* Static factory designed to expose `popstate` events to event
* handlers that are not necessarily instances of [BodyElement].
*
* See [EventStreamProvider] for usage information.
*/
@DomName('HTMLBodyElement.popstateEvent')
@DocsEditable()
static const EventStreamProvider<PopStateEvent> popStateEvent = const EventStreamProvider<PopStateEvent>('popstate');
/**
* Static factory designed to expose `resize` events to event
* handlers that are not necessarily instances of [BodyElement].
*
* See [EventStreamProvider] for usage information.
*/
@DomName('HTMLBodyElement.resizeEvent')
@DocsEditable()
static const EventStreamProvider<Event> resizeEvent = const EventStreamProvider<Event>('resize');
@DomName('HTMLBodyElement.scrollEvent')
@DocsEditable()
@Experimental() // untriaged
static const EventStreamProvider<Event> scrollEvent = const EventStreamProvider<Event>('scroll');
/**
* Static factory designed to expose `storage` events to event
* handlers that are not necessarily instances of [BodyElement].
*
* See [EventStreamProvider] for usage information.
*/
@DomName('HTMLBodyElement.storageEvent')
@DocsEditable()
static const EventStreamProvider<StorageEvent> storageEvent = const EventStreamProvider<StorageEvent>('storage');
/**
* Static factory designed to expose `unload` events to event
* handlers that are not necessarily instances of [BodyElement].
*
* See [EventStreamProvider] for usage information.
*/
@DomName('HTMLBodyElement.unloadEvent')
@DocsEditable()
static const EventStreamProvider<Event> unloadEvent = const EventStreamProvider<Event>('unload');
@DomName('HTMLBodyElement.HTMLBodyElement')
@DocsEditable()
factory BodyElement() => document.createElement("body");
/**
* Constructor instantiated by the DOM when a custom element has been created.
*
* This can only be called by subclasses from their created constructor.
*/
BodyElement.created() : super.created();
/// Stream of `blur` events handled by this [BodyElement].
@DomName('HTMLBodyElement.onblur')
@DocsEditable()
ElementStream<Event> get onBlur => blurEvent.forElement(this);
/// Stream of `error` events handled by this [BodyElement].
@DomName('HTMLBodyElement.onerror')
@DocsEditable()
ElementStream<Event> get onError => errorEvent.forElement(this);
/// Stream of `focus` events handled by this [BodyElement].
@DomName('HTMLBodyElement.onfocus')
@DocsEditable()
ElementStream<Event> get onFocus => focusEvent.forElement(this);
/// Stream of `hashchange` events handled by this [BodyElement].
@DomName('HTMLBodyElement.onhashchange')
@DocsEditable()
ElementStream<Event> get onHashChange => hashChangeEvent.forElement(this);
/// Stream of `load` events handled by this [BodyElement].
@DomName('HTMLBodyElement.onload')
@DocsEditable()
ElementStream<Event> get onLoad => loadEvent.forElement(this);
/// Stream of `message` events handled by this [BodyElement].
@DomName('HTMLBodyElement.onmessage')
@DocsEditable()
ElementStream<MessageEvent> get onMessage => messageEvent.forElement(this);
/// Stream of `offline` events handled by this [BodyElement].
@DomName('HTMLBodyElement.onoffline')
@DocsEditable()
ElementStream<Event> get onOffline => offlineEvent.forElement(this);
/// Stream of `online` events handled by this [BodyElement].
@DomName('HTMLBodyElement.ononline')
@DocsEditable()
ElementStream<Event> get onOnline => onlineEvent.forElement(this);
/// Stream of `popstate` events handled by this [BodyElement].
@DomName('HTMLBodyElement.onpopstate')
@DocsEditable()
ElementStream<PopStateEvent> get onPopState => popStateEvent.forElement(this);
/// Stream of `resize` events handled by this [BodyElement].
@DomName('HTMLBodyElement.onresize')
@DocsEditable()
ElementStream<Event> get onResize => resizeEvent.forElement(this);
@DomName('HTMLBodyElement.onscroll')
@DocsEditable()
@Experimental() // untriaged
ElementStream<Event> get onScroll => scrollEvent.forElement(this);
/// Stream of `storage` events handled by this [BodyElement].
@DomName('HTMLBodyElement.onstorage')
@DocsEditable()
ElementStream<StorageEvent> get onStorage => storageEvent.forElement(this);
/// Stream of `unload` events handled by this [BodyElement].
@DomName('HTMLBodyElement.onunload')
@DocsEditable()
ElementStream<Event> get onUnload => unloadEvent.forElement(this);
}
// 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.
@DocsEditable()
@DomName('HTMLButtonElement')
@Native("HTMLButtonElement")
class ButtonElement extends HtmlElement {
// To suppress missing implicit constructor warnings.
factory ButtonElement._() { throw new UnsupportedError("Not supported"); }
@DomName('HTMLButtonElement.HTMLButtonElement')
@DocsEditable()
factory ButtonElement() => document.createElement("button");
/**
* Constructor instantiated by the DOM when a custom element has been created.
*
* This can only be called by subclasses from their created constructor.
*/
ButtonElement.created() : super.created();
@DomName('HTMLButtonElement.autofocus')
@DocsEditable()
bool autofocus;
@DomName('HTMLButtonElement.disabled')
@DocsEditable()
bool disabled;
@DomName('HTMLButtonElement.form')
@DocsEditable()
final FormElement form;
@DomName('HTMLButtonElement.formAction')
@DocsEditable()
String formAction;
@DomName('HTMLButtonElement.formEnctype')
@DocsEditable()
String formEnctype;
@DomName('HTMLButtonElement.formMethod')
@DocsEditable()
String formMethod;
@DomName('HTMLButtonElement.formNoValidate')
@DocsEditable()
bool formNoValidate;
@DomName('HTMLButtonElement.formTarget')
@DocsEditable()
String formTarget;
@DomName('HTMLButtonElement.labels')
@DocsEditable()
@Unstable()
@Returns('NodeList')
@Creates('NodeList')
final List<Node> labels;
@DomName('HTMLButtonElement.name')
@DocsEditable()
String name;
@DomName('HTMLButtonElement.type')
@DocsEditable()
String type;
@DomName('HTMLButtonElement.validationMessage')
@DocsEditable()
final String validationMessage;
@DomName('HTMLButtonElement.validity')
@DocsEditable()
final ValidityState validity;
@DomName('HTMLButtonElement.value')
@DocsEditable()
String value;
@DomName('HTMLButtonElement.willValidate')
@DocsEditable()
final bool willValidate;
@DomName('HTMLButtonElement.checkValidity')
@DocsEditable()
bool checkValidity() native;
@DomName('HTMLButtonElement.setCustomValidity')
@DocsEditable()
void setCustomValidity(String error) native;
}
// 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.
@DocsEditable()
@DomName('CDATASection')
// http://dom.spec.whatwg.org/#cdatasection
@deprecated // deprecated
@Native("CDATASection")
class CDataSection extends Text {
// To suppress missing implicit constructor warnings.
factory CDataSection._() { throw new UnsupportedError("Not supported"); }
}
// 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.
@DocsEditable()
@DomName('CacheStorage')
@Experimental() // untriaged
@Native("CacheStorage")
class CacheStorage extends Interceptor {
// To suppress missing implicit constructor warnings.
factory CacheStorage._() { throw new UnsupportedError("Not supported"); }
@DomName('CacheStorage.create')
@DocsEditable()
@Experimental() // untriaged
Future create(String cacheName) native;
@DomName('CacheStorage.delete')
@DocsEditable()
@Experimental() // untriaged
Future delete(String cacheName) native;
@DomName('CacheStorage.get')
@DocsEditable()
@Experimental() // untriaged
Future get(String cacheName) native;
@DomName('CacheStorage.has')
@DocsEditable()
@Experimental() // untriaged
Future has(String cacheName) native;
@DomName('CacheStorage.keys')
@DocsEditable()
@Experimental() // untriaged
Future keys() native;
}
// 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.
@DocsEditable()
@DomName('Canvas2DContextAttributes')
// http://wiki.whatwg.org/wiki/CanvasOpaque#Suggested_IDL
@Experimental()
@Native("Canvas2DContextAttributes")
class Canvas2DContextAttributes extends Interceptor {
// To suppress missing implicit constructor warnings.
factory Canvas2DContextAttributes._() { throw new UnsupportedError("Not supported"); }
@DomName('Canvas2DContextAttributes.alpha')
@DocsEditable()
bool alpha;
@DomName('Canvas2DContextAttributes.storage')
@DocsEditable()
@Experimental() // untriaged
String storage;
}
// 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.
@DomName('HTMLCanvasElement')
@Native("HTMLCanvasElement")
class CanvasElement extends HtmlElement implements CanvasImageSource {
// To suppress missing implicit constructor warnings.
factory CanvasElement._() { throw new UnsupportedError("Not supported"); }
/**
* Static factory designed to expose `webglcontextlost` events to event
* handlers that are not necessarily instances of [CanvasElement].
*
* See [EventStreamProvider] for usage information.
*/
@DomName('HTMLCanvasElement.webglcontextlostEvent')
@DocsEditable()
static const EventStreamProvider<gl.ContextEvent> webGlContextLostEvent = const EventStreamProvider<gl.ContextEvent>('webglcontextlost');
/**
* Static factory designed to expose `webglcontextrestored` events to event
* handlers that are not necessarily instances of [CanvasElement].
*
* See [EventStreamProvider] for usage information.
*/
@DomName('HTMLCanvasElement.webglcontextrestoredEvent')
@DocsEditable()
static const EventStreamProvider<gl.ContextEvent> webGlContextRestoredEvent = const EventStreamProvider<gl.ContextEvent>('webglcontextrestored');
@DomName('HTMLCanvasElement.HTMLCanvasElement')
@DocsEditable()
factory CanvasElement({int width, int height}) {
var e = document.createElement("canvas");
if (width != null) e.width = width;
if (height != null) e.height = height;
return e;
}
/**
* Constructor instantiated by the DOM when a custom element has been created.
*
* This can only be called by subclasses from their created constructor.
*/
CanvasElement.created() : super.created();
/// The height of this canvas element in CSS pixels.
@DomName('HTMLCanvasElement.height')
@DocsEditable()
int height;
/// The width of this canvas element in CSS pixels.
@DomName('HTMLCanvasElement.width')
@DocsEditable()
int width;
@DomName('HTMLCanvasElement.getContext')
@DocsEditable()
@Creates('CanvasRenderingContext2D|RenderingContext')
@Returns('CanvasRenderingContext2D|RenderingContext|Null')
Object getContext(String contextId, [Map attrs]) {
if (attrs != null) {
var attrs_1 = convertDartToNative_Dictionary(attrs);
return _getContext_1(contextId, attrs_1);
}
return _getContext_2(contextId);
}
@JSName('getContext')
@DomName('HTMLCanvasElement.getContext')
@DocsEditable()
@Creates('CanvasRenderingContext2D|RenderingContext')
@Returns('CanvasRenderingContext2D|RenderingContext|Null')
Object _getContext_1(contextId, attrs) native;
@JSName('getContext')
@DomName('HTMLCanvasElement.getContext')
@DocsEditable()
@Creates('CanvasRenderingContext2D|RenderingContext')
@Returns('CanvasRenderingContext2D|RenderingContext|Null')
Object _getContext_2(contextId) native;
@JSName('toDataURL')
@DomName('HTMLCanvasElement.toDataURL')
@DocsEditable()
String _toDataUrl(String type, [num quality]) native;
/// Stream of `webglcontextlost` events handled by this [CanvasElement].
@DomName('HTMLCanvasElement.onwebglcontextlost')
@DocsEditable()
ElementStream<gl.ContextEvent> get onWebGlContextLost => webGlContextLostEvent.forElement(this);
/// Stream of `webglcontextrestored` events handled by this [CanvasElement].
@DomName('HTMLCanvasElement.onwebglcontextrestored')
@DocsEditable()
ElementStream<gl.ContextEvent> get onWebGlContextRestored => webGlContextRestoredEvent.forElement(this);
/** An API for drawing on this canvas. */
CanvasRenderingContext2D get context2D =>
JS('Null|CanvasRenderingContext2D', '#.getContext(#)', this, '2d');
/**
* Returns a new Web GL context for this canvas.
*
* ## Other resources
*
* * [WebGL fundamentals]
* (http://www.html5rocks.com/en/tutorials/webgl/webgl_fundamentals/) from
* HTML5Rocks.
* * [WebGL homepage] (http://get.webgl.org/).
*/
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.FIREFOX)
@Experimental()
gl.RenderingContext getContext3d({alpha: true, depth: true, stencil: false,
antialias: true, premultipliedAlpha: true, preserveDrawingBuffer: false}) {
var options = {
'alpha': alpha,
'depth': depth,
'stencil': stencil,
'antialias': antialias,
'premultipliedAlpha': premultipliedAlpha,
'preserveDrawingBuffer': preserveDrawingBuffer,
};
var context = getContext('webgl', options);
if (context == null) {
context = getContext('experimental-webgl', options);
}
return context;
}
/**
* Returns a data URI containing a representation of the image in the
* format specified by type (defaults to 'image/png').
*
* Data Uri format is as follow
* `data:[<MIME-type>][;charset=<encoding>][;base64],<data>`
*
* Optional parameter [quality] in the range of 0.0 and 1.0 can be used when
* requesting [type] 'image/jpeg' or 'image/webp'. If [quality] is not passed
* the default value is used. Note: the default value varies by browser.
*
* If the height or width of this canvas element is 0, then 'data:' is
* returned, representing no data.
*
* If the type requested is not 'image/png', and the returned value is
* 'data:image/png', then the requested type is not supported.
*
* Example usage:
*
* CanvasElement canvas = new CanvasElement();
* var ctx = canvas.context2D
* ..fillStyle = "rgb(200,0,0)"
* ..fillRect(10, 10, 55, 50);
* var dataUrl = canvas.toDataUrl("image/jpeg", 0.95);
* // The Data Uri would look similar to
* // 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA
* // AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
* // 9TXL0Y4OHwAAAABJRU5ErkJggg=='
* //Create a new image element from the data URI.
* var img = new ImageElement();
* img.src = dataUrl;
* document.body.children.add(img);
*
* See also:
*
* * [Data URI Scheme](http://en.wikipedia.org/wiki/Data_URI_scheme) from Wikipedia.
*
* * [HTMLCanvasElement](https://developer.mozilla.org/en-US/docs/DOM/HTMLCanvasElement) from MDN.
*
* * [toDataUrl](http://dev.w3.org/html5/spec/the-canvas-element.html#dom-canvas-todataurl) from W3C.
*/
String toDataUrl([String type = 'image/png', num quality]) =>
_toDataUrl(type, quality);
}
// 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.
@DocsEditable()
/**
* An opaque canvas object representing a gradient.
*
* Created by calling [createLinearGradient] or [createRadialGradient] on a
* [CanvasRenderingContext2D] object.
*
* Example usage:
*
* var canvas = new CanvasElement(width: 600, height: 600);
* var ctx = canvas.context2D;
* ctx.clearRect(0, 0, 600, 600);
* ctx.save();
* // Create radial gradient.
* CanvasGradient gradient = ctx.createRadialGradient(0, 0, 0, 0, 0, 600);
* gradient.addColorStop(0, '#000');
* gradient.addColorStop(1, 'rgb(255, 255, 255)');
* // Assign gradients to fill.
* ctx.fillStyle = gradient;
* // Draw a rectangle with a gradient fill.
* ctx.fillRect(0, 0, 600, 600);
* ctx.save();
* document.body.children.add(canvas);
*
* See also:
*
* * [CanvasGradient](https://developer.mozilla.org/en-US/docs/DOM/CanvasGradient) from MDN.
* * [CanvasGradient](http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#canvasgradient) from whatwg.
* * [CanvasGradient](http://www.w3.org/TR/2010/WD-2dcontext-20100304/#canvasgradient) from W3C.
*/
@DomName('CanvasGradient')
@Native("CanvasGradient")
class CanvasGradient extends Interceptor {
// To suppress missing implicit constructor warnings.
factory CanvasGradient._() { throw new UnsupportedError("Not supported"); }
/**
* Adds a color stop to this gradient at the offset.
*
* The [offset] can range between 0.0 and 1.0.
*
* See also:
*
* * [Multiple Color Stops](https://developer.mozilla.org/en-US/docs/CSS/linear-gradient#Gradient_with_multiple_color_stops) from MDN.
*/
@DomName('CanvasGradient.addColorStop')
@DocsEditable()
void addColorStop(num offset, String color) native;
}
// 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.
@DocsEditable()
/**
* An opaque object representing a pattern of image, canvas, or video.
*
* Created by calling [createPattern] on a [CanvasRenderingContext2D] object.
*
* Example usage:
*
* var canvas = new CanvasElement(width: 600, height: 600);
* var ctx = canvas.context2D;
* var img = new ImageElement();
* // Image src needs to be loaded before pattern is applied.
* img.onLoad.listen((event) {
* // When the image is loaded, create a pattern
* // from the ImageElement.
* CanvasPattern pattern = ctx.createPattern(img, 'repeat');
* ctx.rect(0, 0, canvas.width, canvas.height);
* ctx.fillStyle = pattern;
* ctx.fill();
* });
* img.src = "images/foo.jpg";
* document.body.children.add(canvas);
*
* See also:
* * [CanvasPattern](https://developer.mozilla.org/en-US/docs/DOM/CanvasPattern) from MDN.
* * [CanvasPattern](http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#canvaspattern) from whatwg.
* * [CanvasPattern](http://www.w3.org/TR/2010/WD-2dcontext-20100304/#canvaspattern) from W3C.
*/
@DomName('CanvasPattern')
@Native("CanvasPattern")
class CanvasPattern extends Interceptor {
// To suppress missing implicit constructor warnings.
factory CanvasPattern._() { throw new UnsupportedError("Not supported"); }
@DomName('CanvasPattern.setTransform')
@DocsEditable()
@Experimental() // untriaged
void setTransform(Matrix transform) native;
}
// 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.
abstract class CanvasRenderingContext {
CanvasElement get canvas;
}
@DomName('CanvasRenderingContext2D')
@Native("CanvasRenderingContext2D")
class CanvasRenderingContext2D extends Interceptor implements CanvasRenderingContext {
// To suppress missing implicit constructor warnings.
factory CanvasRenderingContext2D._() { throw new UnsupportedError("Not supported"); }
@DomName('CanvasRenderingContext2D.canvas')
@DocsEditable()
@Experimental() // untriaged
final CanvasElement canvas;
@DomName('CanvasRenderingContext2D.currentTransform')
@DocsEditable()
@Experimental() // untriaged
Matrix currentTransform;
@DomName('CanvasRenderingContext2D.direction')
@DocsEditable()
@Experimental() // untriaged
String direction;
@DomName('CanvasRenderingContext2D.fillStyle')
@DocsEditable()
@Creates('String|CanvasGradient|CanvasPattern')
@Returns('String|CanvasGradient|CanvasPattern')
Object fillStyle;
@DomName('CanvasRenderingContext2D.font')
@DocsEditable()
String font;
@DomName('CanvasRenderingContext2D.globalAlpha')
@DocsEditable()
num globalAlpha;
@DomName('CanvasRenderingContext2D.globalCompositeOperation')
@DocsEditable()
String globalCompositeOperation;
/**
* Whether images and patterns on this canvas will be smoothed when this
* canvas is scaled.
*
* ## Other resources
*
* * [Image smoothing]
* (http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#image-smoothing)
* from WHATWG.
*/
@DomName('CanvasRenderingContext2D.imageSmoothingEnabled')
@DocsEditable()
@Experimental() // untriaged
bool imageSmoothingEnabled;
@DomName('CanvasRenderingContext2D.lineCap')
@DocsEditable()
String lineCap;
@DomName('CanvasRenderingContext2D.lineJoin')
@DocsEditable()
String lineJoin;
@DomName('CanvasRenderingContext2D.lineWidth')
@DocsEditable()
num lineWidth;
@DomName('CanvasRenderingContext2D.miterLimit')
@DocsEditable()
num miterLimit;
@DomName('CanvasRenderingContext2D.shadowBlur')
@DocsEditable()
num shadowBlur;
@DomName('CanvasRenderingContext2D.shadowColor')
@DocsEditable()
String shadowColor;
@DomName('CanvasRenderingContext2D.shadowOffsetX')
@DocsEditable()
num shadowOffsetX;
@DomName('CanvasRenderingContext2D.shadowOffsetY')
@DocsEditable()
num shadowOffsetY;
@DomName('CanvasRenderingContext2D.strokeStyle')
@DocsEditable()
@Creates('String|CanvasGradient|CanvasPattern')
@Returns('String|CanvasGradient|CanvasPattern')
Object strokeStyle;
@DomName('CanvasRenderingContext2D.textAlign')
@DocsEditable()
String textAlign;
@DomName('CanvasRenderingContext2D.textBaseline')
@DocsEditable()
String textBaseline;
@DomName('CanvasRenderingContext2D.addHitRegion')
@DocsEditable()
@Experimental() // untriaged
void addHitRegion([Map options]) {
if (options != null) {
var options_1 = convertDartToNative_Dictionary(options);
_addHitRegion_1(options_1);
return;
}
_addHitRegion_2();
return;
}
@JSName('addHitRegion')
@DomName('CanvasRenderingContext2D.addHitRegion')
@DocsEditable()
@Experimental() // untriaged
void _addHitRegion_1(options) native;
@JSName('addHitRegion')
@DomName('CanvasRenderingContext2D.addHitRegion')
@DocsEditable()
@Experimental() // untriaged
void _addHitRegion_2() native;
@DomName('CanvasRenderingContext2D.beginPath')
@DocsEditable()
void beginPath() native;
@DomName('CanvasRenderingContext2D.clearHitRegions')
@DocsEditable()
@Experimental() // untriaged
void clearHitRegions() native;
@DomName('CanvasRenderingContext2D.clearRect')
@DocsEditable()
void clearRect(num x, num y, num width, num height) native;
@DomName('CanvasRenderingContext2D.clip')
@DocsEditable()
void clip([path_OR_winding, String winding]) native;
@DomName('CanvasRenderingContext2D.createImageData')
@DocsEditable()
@Creates('ImageData|=Object')
ImageData createImageData(num sw, num sh) {
return convertNativeToDart_ImageData(_createImageData_1(sw, sh));
}
@JSName('createImageData')
@DomName('CanvasRenderingContext2D.createImageData')
@DocsEditable()
@Creates('ImageData|=Object')
_createImageData_1(sw, sh) native;
@DomName('CanvasRenderingContext2D.createImageData')
@DocsEditable()
@Creates('ImageData|=Object')
ImageData createImageDataFromImageData(ImageData imagedata) {
var imagedata_1 = convertDartToNative_ImageData(imagedata);
return convertNativeToDart_ImageData(_createImageDataFromImageData_1(imagedata_1));
}
@JSName('createImageData')
@DomName('CanvasRenderingContext2D.createImageData')
@DocsEditable()
@Creates('ImageData|=Object')
_createImageDataFromImageData_1(imagedata) native;
@DomName('CanvasRenderingContext2D.createLinearGradient')
@DocsEditable()
CanvasGradient createLinearGradient(num x0, num y0, num x1, num y1) native;
@DomName('CanvasRenderingContext2D.createPattern')
@DocsEditable()
CanvasPattern createPattern(canvas_OR_image, String repetitionType) native;
@JSName('createPattern')
@DomName('CanvasRenderingContext2D.createPattern')
@DocsEditable()
CanvasPattern createPatternFromImage(ImageElement image, String repetitionType) native;
@DomName('CanvasRenderingContext2D.createRadialGradient')
@DocsEditable()
CanvasGradient createRadialGradient(num x0, num y0, num r0, num x1, num y1, num r1) native;
@DomName('CanvasRenderingContext2D.drawFocusIfNeeded')
@DocsEditable()
@Experimental() // untriaged
void drawFocusIfNeeded(element_OR_path, [Element element]) native;
@DomName('CanvasRenderingContext2D.fillRect')
@DocsEditable()
void fillRect(num x, num y, num width, num height) native;
@DomName('CanvasRenderingContext2D.getContextAttributes')
@DocsEditable()
// http://wiki.whatwg.org/wiki/CanvasOpaque#Suggested_IDL
@Experimental()
Canvas2DContextAttributes getContextAttributes() native;
@DomName('CanvasRenderingContext2D.getImageData')
@DocsEditable()
@Creates('ImageData|=Object')
ImageData getImageData(num sx, num sy, num sw, num sh) {
return convertNativeToDart_ImageData(_getImageData_1(sx, sy, sw, sh));
}
@JSName('getImageData')
@DomName('CanvasRenderingContext2D.getImageData')
@DocsEditable()
@Creates('ImageData|=Object')
_getImageData_1(sx, sy, sw, sh) native;
@JSName('getLineDash')
@DomName('CanvasRenderingContext2D.getLineDash')
@DocsEditable()
List<num> _getLineDash() native;
@DomName('CanvasRenderingContext2D.isContextLost')
@DocsEditable()
@Experimental() // untriaged
bool isContextLost() native;
@DomName('CanvasRenderingContext2D.isPointInPath')
@DocsEditable()
bool isPointInPath(path_OR_x, num x_OR_y, [winding_OR_y, String winding]) native;
@DomName('CanvasRenderingContext2D.isPointInStroke')
@DocsEditable()
bool isPointInStroke(path_OR_x, num x_OR_y, [num y]) native;
@DomName('CanvasRenderingContext2D.measureText')
@DocsEditable()
TextMetrics measureText(String text) native;
@DomName('CanvasRenderingContext2D.putImageData')
@DocsEditable()
void putImageData(ImageData imagedata, num dx, num dy, [num dirtyX, num dirtyY, num dirtyWidth, num dirtyHeight]) {
if (dirtyX == null && dirtyY == null && dirtyWidth == null && dirtyHeight == null) {
var imagedata_1 = convertDartToNative_ImageData(imagedata);
_putImageData_1(imagedata_1, dx, dy);
return;
}
if (dirtyHeight != null && dirtyWidth != null && dirtyY != null && dirtyX != null) {
var imagedata_1 = convertDartToNative_ImageData(imagedata);
_putImageData_2(imagedata_1, dx, dy, dirtyX, dirtyY, dirtyWidth, dirtyHeight);
return;
}
throw new ArgumentError("Incorrect number or type of arguments");
}
@JSName('putImageData')
@DomName('CanvasRenderingContext2D.putImageData')
@DocsEditable()
void _putImageData_1(imagedata, dx, dy) native;
@JSName('putImageData')
@DomName('CanvasRenderingContext2D.putImageData')
@DocsEditable()
void _putImageData_2(imagedata, dx, dy, dirtyX, dirtyY, dirtyWidth, dirtyHeight) native;
@DomName('CanvasRenderingContext2D.removeHitRegion')
@DocsEditable()
@Experimental() // untriaged
void removeHitRegion(String id) native;
@DomName('CanvasRenderingContext2D.resetTransform')
@DocsEditable()
@Experimental() // untriaged
void resetTransform() native;
@DomName('CanvasRenderingContext2D.restore')
@DocsEditable()
void restore() native;
@DomName('CanvasRenderingContext2D.rotate')
@DocsEditable()
void rotate(num angle) native;
@DomName('CanvasRenderingContext2D.save')
@DocsEditable()
void save() native;
@DomName('CanvasRenderingContext2D.scale')
@DocsEditable()
void scale(num x, num y) native;
@DomName('CanvasRenderingContext2D.scrollPathIntoView')
@DocsEditable()
@Experimental() // untriaged
void scrollPathIntoView([Path2D path]) native;
@DomName('CanvasRenderingContext2D.setTransform')
@DocsEditable()
void setTransform(num a, num b, num c, num d, num e, num f) native;
@DomName('CanvasRenderingContext2D.stroke')
@DocsEditable()
void stroke([Path2D path]) native;
@DomName('CanvasRenderingContext2D.strokeRect')
@DocsEditable()
void strokeRect(num x, num y, num width, num height) native;
@DomName('CanvasRenderingContext2D.strokeText')
@DocsEditable()
void strokeText(String text, num x, num y, [num maxWidth]) native;
@DomName('CanvasRenderingContext2D.transform')
@DocsEditable()
void transform(num a, num b, num c, num d, num e, num f) native;
@DomName('CanvasRenderingContext2D.translate')
@DocsEditable()
void translate(num x, num y) native;
// From CanvasPathMethods
@JSName('arc')
@DomName('CanvasRenderingContext2D.arc')
@DocsEditable()
void _arc(num x, num y, num radius, num startAngle, num endAngle, bool anticlockwise) native;
@DomName('CanvasRenderingContext2D.arcTo')
@DocsEditable()
void arcTo(num x1, num y1, num x2, num y2, num radius) native;
@DomName('CanvasRenderingContext2D.bezierCurveTo')
@DocsEditable()
void bezierCurveTo(num cp1x, num cp1y, num cp2x, num cp2y, num x, num y) native;
@DomName('CanvasRenderingContext2D.closePath')
@DocsEditable()
void closePath() native;
@DomName('CanvasRenderingContext2D.ellipse')
@DocsEditable()
@Experimental() // untriaged
void ellipse(num x, num y, num radiusX, num radiusY, num rotation, num startAngle, num endAngle, bool anticlockwise) native;
@DomName('CanvasRenderingContext2D.lineTo')
@DocsEditable()
void lineTo(num x, num y) native;
@DomName('CanvasRenderingContext2D.moveTo')
@DocsEditable()
void moveTo(num x, num y) native;
@DomName('CanvasRenderingContext2D.quadraticCurveTo')
@DocsEditable()
void quadraticCurveTo(num cpx, num cpy, num x, num y) native;
@DomName('CanvasRenderingContext2D.rect')
@DocsEditable()
void rect(num x, num y, num width, num height) native;
/**
* Sets the color used inside shapes.
* [r], [g], [b] are 0-255, [a] is 0-1.
*/
void setFillColorRgb(int r, int g, int b, [num a = 1]) {
this.fillStyle = 'rgba($r, $g, $b, $a)';
}
/**
* Sets the color used inside shapes.
* [h] is in degrees, 0-360.
* [s], [l] are in percent, 0-100.
* [a] is 0-1.
*/
void setFillColorHsl(int h, num s, num l, [num a = 1]) {
this.fillStyle = 'hsla($h, $s%, $l%, $a)';
}
/**
* Sets the color used for stroking shapes.
* [r], [g], [b] are 0-255, [a] is 0-1.
*/
void setStrokeColorRgb(int r, int g, int b, [num a = 1]) {
this.strokeStyle = 'rgba($r, $g, $b, $a)';
}
/**
* Sets the color used for stroking shapes.
* [h] is in degrees, 0-360.
* [s], [l] are in percent, 0-100.
* [a] is 0-1.
*/
void setStrokeColorHsl(int h, num s, num l, [num a = 1]) {
this.strokeStyle = 'hsla($h, $s%, $l%, $a)';
}
@DomName('CanvasRenderingContext2D.arc')
void arc(num x, num y, num radius, num startAngle, num endAngle,
[bool anticlockwise = false]) {
// TODO(terry): This should not be needed: dartbug.com/20939.
JS('void', '#.arc(#, #, #, #, #, #)', this, x, y, radius, startAngle,
endAngle, anticlockwise);
}
/**
* Draws an image from a CanvasImageSource to an area of this canvas.
*
* The image will be drawn to an area of this canvas defined by
* [destRect]. [sourceRect] defines the region of the source image that is
* drawn.
* If [sourceRect] is not provided, then
* the entire rectangular image from [source] will be drawn to this context.
*
* If the image is larger than canvas
* will allow, the image will be clipped to fit the available space.
*
* CanvasElement canvas = new CanvasElement(width: 600, height: 600);
* CanvasRenderingContext2D ctx = canvas.context2D;
* ImageElement img = document.query('img');
* img.width = 100;
* img.height = 100;
*
* // Scale the image to 20x20.
* ctx.drawImageToRect(img, new Rectangle(50, 50, 20, 20));
*
* VideoElement video = document.query('video');
* video.width = 100;
* video.height = 100;
* // Take the middle 20x20 pixels from the video and stretch them.
* ctx.drawImageToRect(video, new Rectangle(50, 50, 100, 100),
* sourceRect: new Rectangle(40, 40, 20, 20));
*
* // Draw the top 100x20 pixels from the otherCanvas.
* CanvasElement otherCanvas = document.query('canvas');
* ctx.drawImageToRect(otherCanvas, new Rectangle(0, 0, 100, 20),
* sourceRect: new Rectangle(0, 0, 100, 20));
*
* See also:
*
* * [CanvasImageSource] for more information on what data is retrieved
* from [source].
* * [drawImage](http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#dom-context-2d-drawimage)
* from the WHATWG.
*/
@DomName('CanvasRenderingContext2D.drawImage')
void drawImageToRect(CanvasImageSource source, Rectangle destRect,
{Rectangle sourceRect}) {
if (sourceRect == null) {
drawImageScaled(source,
destRect.left,
destRect.top,
destRect.width,
destRect.height);
} else {
drawImageScaledFromSource(source,
sourceRect.left,
sourceRect.top,
sourceRect.width,
sourceRect.height,
destRect.left,
destRect.top,
destRect.width,
destRect.height);
}
}
/**
* Draws an image from a CanvasImageSource to this canvas.
*
* The entire image from [source] will be drawn to this context with its top
* left corner at the point ([destX], [destY]). If the image is
* larger than canvas will allow, the image will be clipped to fit the
* available space.
*
* CanvasElement canvas = new CanvasElement(width: 600, height: 600);
* CanvasRenderingContext2D ctx = canvas.context2D;
* ImageElement img = document.query('img');
*
* ctx.drawImage(img, 100, 100);
*
* VideoElement video = document.query('video');
* ctx.drawImage(video, 0, 0);
*
* CanvasElement otherCanvas = document.query('canvas');
* otherCanvas.width = 100;
* otherCanvas.height = 100;
* ctx.drawImage(otherCanvas, 590, 590); // will get clipped
*
* See also:
*
* * [CanvasImageSource] for more information on what data is retrieved
* from [source].
* * [drawImage](http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#dom-context-2d-drawimage)
* from the WHATWG.
*/
@DomName('CanvasRenderingContext2D.drawImage')
@JSName('drawImage')
void drawImage(CanvasImageSource source, num destX, num destY) native;
/**
* Draws an image from a CanvasImageSource to an area of this canvas.
*
* The image will be drawn to this context with its top left corner at the
* point ([destX], [destY]) and will be scaled to be [destWidth] wide and
* [destHeight] tall.
*
* If the image is larger than canvas
* will allow, the image will be clipped to fit the available space.
*
* CanvasElement canvas = new CanvasElement(width: 600, height: 600);
* CanvasRenderingContext2D ctx = canvas.context2D;
* ImageElement img = document.query('img');
* img.width = 100;
* img.height = 100;
*
* // Scale the image to 300x50 at the point (20, 20)
* ctx.drawImageScaled(img, 20, 20, 300, 50);
*
* See also:
*
* * [CanvasImageSource] for more information on what data is retrieved
* from [source].
* * [drawImage](http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#dom-context-2d-drawimage)
* from the WHATWG.
*/
@DomName('CanvasRenderingContext2D.drawImage')
@JSName('drawImage')
void drawImageScaled(CanvasImageSource source,
num destX, num destY, num destWidth, num destHeight) native;
/**
* Draws an image from a CanvasImageSource to an area of this canvas.
*
* The image is a region of [source] that is [sourceWidth] wide and
* [destHeight] tall with top left corner at ([sourceX], [sourceY]).
* The image will be drawn to this context with its top left corner at the
* point ([destX], [destY]) and will be scaled to be [destWidth] wide and
* [destHeight] tall.
*
* If the image is larger than canvas
* will allow, the image will be clipped to fit the available space.
*
* VideoElement video = document.query('video');
* video.width = 100;
* video.height = 100;
* // Take the middle 20x20 pixels from the video and stretch them.
* ctx.drawImageScaledFromSource(video, 40, 40, 20, 20, 50, 50, 100, 100);
*
* // Draw the top 100x20 pixels from the otherCanvas to this one.
* CanvasElement otherCanvas = document.query('canvas');
* ctx.drawImageScaledFromSource(otherCanvas, 0, 0, 100, 20, 0, 0, 100, 20);
*
* See also:
*
* * [CanvasImageSource] for more information on what data is retrieved
* from [source].
* * [drawImage](http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#dom-context-2d-drawimage)
* from the WHATWG.
*/
@DomName('CanvasRenderingContext2D.drawImage')
@JSName('drawImage')
void drawImageScaledFromSource(CanvasImageSource source,
num sourceX, num sourceY, num sourceWidth, num sourceHeight,
num destX, num destY, num destWidth, num destHeight) native;
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@SupportedBrowser(SupportedBrowser.IE, '11')
@Unstable()
@DomName('CanvasRenderingContext2D.lineDashOffset')
// TODO(14316): Firefox has this functionality with mozDashOffset, but it
// needs to be polyfilled.
num get lineDashOffset => JS('num',
'#.lineDashOffset || #.webkitLineDashOffset', this, this);
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@SupportedBrowser(SupportedBrowser.IE, '11')
@Unstable()
@DomName('CanvasRenderingContext2D.lineDashOffset')
// TODO(14316): Firefox has this functionality with mozDashOffset, but it
// needs to be polyfilled.
void set lineDashOffset(num value) {
JS('void',
'typeof #.lineDashOffset != "undefined" ? #.lineDashOffset = # : '
'#.webkitLineDashOffset = #', this, this, value, this, value);
}
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@SupportedBrowser(SupportedBrowser.IE, '11')
@Unstable()
@DomName('CanvasRenderingContext2D.getLineDash')
List<num> getLineDash() {
// TODO(14316): Firefox has this functionality with mozDash, but it's a bit
// different.
if (JS('bool', '!!#.getLineDash', this)) {
return JS('List<num>', '#.getLineDash()', this);
} else if (JS('bool', '!!#.webkitLineDash', this)) {
return JS('List<num>', '#.webkitLineDash', this);
}
}
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@SupportedBrowser(SupportedBrowser.IE, '11')
@Unstable()
@DomName('CanvasRenderingContext2D.setLineDash')
void setLineDash(List<num> dash) {
// TODO(14316): Firefox has this functionality with mozDash, but it's a bit
// different.
if (JS('bool', '!!#.setLineDash', this)) {
JS('void', '#.setLineDash(#)', this, dash);
} else if (JS('bool', '!!#.webkitLineDash', this)) {
JS('void', '#.webkitLineDash = #', this, dash);
}
}
/**
* Draws text to the canvas.
*
* The text is drawn starting at coordinates ([x], [y]).
* If [maxWidth] is provided and the [text] is computed to be wider than
* [maxWidth], then the drawn text is scaled down horizontally to fit.
*
* The text uses the current [CanvasRenderingContext2D.font] property for font
* options, such as typeface and size, and the current
* [CanvasRenderingContext2D.fillStyle] for style options such as color.
* The current [CanvasRenderingContext2D.textAlign] and
* [CanvasRenderingContext2D.textBaseLine] properties are also applied to the
* drawn text.
*/
@DomName('CanvasRenderingContext2D.fillText')
void fillText(String text, num x, num y, [num maxWidth]) {
if (maxWidth != null) {
JS('void', '#.fillText(#, #, #, #)', this, text, x, y, maxWidth);
} else {
JS('void', '#.fillText(#, #, #)', this, text, x, y);
}
}
@DomName('CanvasRenderingContext2D.fill')
void fill([String winding = 'nonzero']) {
JS('void', '#.fill(#)', this, winding);
}
/** Deprecated always returns 1.0 */
@DomName('CanvasRenderingContext2D.webkitBackingStorePixelRation')
@Experimental()
@deprecated
double get backingStorePixelRatio => 1.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.
@DocsEditable()
@DomName('CharacterData')
@Native("CharacterData")
class CharacterData extends Node implements ChildNode {
// To suppress missing implicit constructor warnings.
factory CharacterData._() { throw new UnsupportedError("Not supported"); }
@DomName('CharacterData.data')
@DocsEditable()
String data;
@DomName('CharacterData.length')
@DocsEditable()
final int length;
@DomName('CharacterData.appendData')
@DocsEditable()
void appendData(String data) native;
@DomName('CharacterData.deleteData')
@DocsEditable()
void deleteData(int offset, int length) native;
@DomName('CharacterData.insertData')
@DocsEditable()
void insertData(int offset, String data) native;
@DomName('CharacterData.replaceData')
@DocsEditable()
void replaceData(int offset, int length, String data) native;
@DomName('CharacterData.substringData')
@DocsEditable()
String substringData(int offset, int length) native;
// From ChildNode
@DomName('CharacterData.nextElementSibling')
@DocsEditable()
final Element nextElementSibling;
@DomName('CharacterData.previousElementSibling')
@DocsEditable()
final Element previousElementSibling;
}
// 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.
@DocsEditable()
@DomName('ChildNode')
@Experimental() // untriaged
abstract class ChildNode extends Interceptor {
// To suppress missing implicit constructor warnings.
factory ChildNode._() { throw new UnsupportedError("Not supported"); }
final Element nextElementSibling;
final Element previousElementSibling;
void remove();
}
// 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.
@DocsEditable()
@DomName('CircularGeofencingRegion')
@Experimental() // untriaged
@Native("CircularGeofencingRegion")
class CircularGeofencingRegion extends GeofencingRegion {
// To suppress missing implicit constructor warnings.
factory CircularGeofencingRegion._() { throw new UnsupportedError("Not supported"); }
@DomName('CircularGeofencingRegion.CircularGeofencingRegion')
@DocsEditable()
factory CircularGeofencingRegion(Map init) {
var init_1 = convertDartToNative_Dictionary(init);
return CircularGeofencingRegion._create_1(init_1);
}
static CircularGeofencingRegion _create_1(init) => JS('CircularGeofencingRegion', 'new CircularGeofencingRegion(#)', init);
@DomName('CircularGeofencingRegion.MAX_RADIUS')
@DocsEditable()
@Experimental() // untriaged
static const num MAX_RADIUS = 100.0;
@DomName('CircularGeofencingRegion.MIN_RADIUS')
@DocsEditable()
@Experimental() // untriaged
static const num MIN_RADIUS = 1.0;
@DomName('CircularGeofencingRegion.latitude')
@DocsEditable()
@Experimental() // untriaged
final double latitude;
@DomName('CircularGeofencingRegion.longitude')
@DocsEditable()
@Experimental() // untriaged
final double longitude;
@DomName('CircularGeofencingRegion.radius')
@DocsEditable()
@Experimental() // untriaged
final double radius;
}
// 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.
@DocsEditable()
@DomName('CloseEvent')
@Native("CloseEvent")
class CloseEvent extends Event {
// To suppress missing implicit constructor warnings.
factory CloseEvent._() { throw new UnsupportedError("Not supported"); }
@DomName('CloseEvent.code')
@DocsEditable()
final int code;
@DomName('CloseEvent.reason')
@DocsEditable()
final String reason;
@DomName('CloseEvent.wasClean')
@DocsEditable()
final bool wasClean;
}
// 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.
@DocsEditable()
@DomName('Comment')
@Native("Comment")
class Comment extends CharacterData {
factory Comment([String data]) {
if (data != null) {
return JS('Comment', '#.createComment(#)', document, data);
}
return JS('Comment', '#.createComment("")', document);
}
// To suppress missing implicit constructor warnings.
factory Comment._() { throw new UnsupportedError("Not supported"); }
}
// Copyright (c) 2013, 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.
// WARNING: Do not edit - generated code.
@DomName('CompositionEvent')
@Native("CompositionEvent")
class CompositionEvent extends UIEvent {
factory CompositionEvent(String type,
{bool canBubble: false, bool cancelable: false, Window view,
String data, String locale}) {
if (view == null) {
view = window;
}
var e = document._createEvent("CompositionEvent");
if (Device.isFirefox) {
// Firefox requires the locale parameter that isn't supported elsewhere.
JS('void', '#.initCompositionEvent(#, #, #, #, #, #)',
e, type, canBubble, cancelable, view, data, locale);
} else {
e._initCompositionEvent(type, canBubble, cancelable, view, data);
}
return e;
}
// To suppress missing implicit constructor warnings.
factory CompositionEvent._() { throw new UnsupportedError("Not supported"); }
@DomName('CompositionEvent.activeSegmentEnd')
@DocsEditable()
@Experimental() // untriaged
final int activeSegmentEnd;
@DomName('CompositionEvent.activeSegmentStart')
@DocsEditable()
@Experimental() // untriaged
final int activeSegmentStart;
@DomName('CompositionEvent.data')
@DocsEditable()
final String data;
@DomName('CompositionEvent.getSegments')
@DocsEditable()
@Experimental() // untriaged
List<int> getSegments() native;
@JSName('initCompositionEvent')
@DomName('CompositionEvent.initCompositionEvent')
@DocsEditable()
void _initCompositionEvent(String typeArg, bool canBubbleArg, bool cancelableArg, Window viewArg, String dataArg) native;
}
// 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.
@DomName('Console')
class Console {
const Console._safe();
static const Console _safeConsole = const Console._safe();
bool get _isConsoleDefined => JS('bool', 'typeof console != "undefined"');
@DomName('Console.memory')
MemoryInfo get memory => _isConsoleDefined ?
JS('MemoryInfo', 'console.memory') : null;
@DomName('Console.assertCondition')
void assertCondition(bool condition, Object arg) => _isConsoleDefined ?
JS('void', 'console.assertCondition(#, #)', condition, arg) : null;
@DomName('Console.clear')
void clear(Object arg) => _isConsoleDefined ?
JS('void', 'console.clear(#)', arg) : null;
@DomName('Console.count')
void count(Object arg) => _isConsoleDefined ?
JS('void', 'console.count(#)', arg) : null;
@DomName('Console.debug')
void debug(Object arg) => _isConsoleDefined ?
JS('void', 'console.debug(#)', arg) : null;
@DomName('Console.dir')
void dir(Object arg) => _isConsoleDefined ?
JS('void', 'console.dir(#)', arg) : null;
@DomName('Console.dirxml')
void dirxml(Object arg) => _isConsoleDefined ?
JS('void', 'console.dirxml(#)', arg) : null;
@DomName('Console.error')
void error(Object arg) => _isConsoleDefined ?
JS('void', 'console.error(#)', arg) : null;
@DomName('Console.group')
void group(Object arg) => _isConsoleDefined ?
JS('void', 'console.group(#)', arg) : null;
@DomName('Console.groupCollapsed')
void groupCollapsed(Object arg) => _isConsoleDefined ?
JS('void', 'console.groupCollapsed(#)', arg) : null;
@DomName('Console.groupEnd')
void groupEnd() => _isConsoleDefined ?
JS('void', 'console.groupEnd()') : null;
@DomName('Console.info')
void info(Object arg) => _isConsoleDefined ?
JS('void', 'console.info(#)', arg) : null;
@DomName('Console.log')
void log(Object arg) => _isConsoleDefined ?
JS('void', 'console.log(#)', arg) : null;
@DomName('Console.markTimeline')
void markTimeline(Object arg) => _isConsoleDefined ?
JS('void', 'console.markTimeline(#)', arg) : null;
@DomName('Console.profile')
void profile(String title) => _isConsoleDefined ?
JS('void', 'console.profile(#)', title) : null;
@DomName('Console.profileEnd')
void profileEnd(String title) => _isConsoleDefined ?
JS('void', 'console.profileEnd(#)', title) : null;
@DomName('Console.table')
void table(Object arg) => _isConsoleDefined ?
JS('void', 'console.table(#)', arg) : null;
@DomName('Console.time')
void time(String title) => _isConsoleDefined ?
JS('void', 'console.time(#)', title) : null;
@DomName('Console.timeEnd')
void timeEnd(String title) => _isConsoleDefined ?
JS('void', 'console.timeEnd(#)', title) : null;
@DomName('Console.timeStamp')
void timeStamp(Object arg) => _isConsoleDefined ?
JS('void', 'console.timeStamp(#)', arg) : null;
@DomName('Console.trace')
void trace(Object arg) => _isConsoleDefined ?
JS('void', 'console.trace(#)', arg) : null;
@DomName('Console.warn')
void warn(Object arg) => _isConsoleDefined ?
JS('void', 'console.warn(#)', arg) : null;
// To suppress missing implicit constructor warnings.
factory Console._() { throw new UnsupportedError("Not supported"); }
}
// 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.
@DocsEditable()
@DomName('ConsoleBase')
@Experimental() // untriaged
@Native("ConsoleBase")
class ConsoleBase extends Interceptor {
// To suppress missing implicit constructor warnings.
factory ConsoleBase._() { throw new UnsupportedError("Not supported"); }
@DomName('ConsoleBase.timeline')
@DocsEditable()
@Experimental() // untriaged
void timeline(String title) native;
@DomName('ConsoleBase.timelineEnd')
@DocsEditable()
@Experimental() // untriaged
void timelineEnd(String title) native;
}
// 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.
@DocsEditable()
@DomName('HTMLContentElement')
@SupportedBrowser(SupportedBrowser.CHROME, '26')
@Experimental()
// https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#content-element
@Native("HTMLContentElement")
class ContentElement extends HtmlElement {
// To suppress missing implicit constructor warnings.
factory ContentElement._() { throw new UnsupportedError("Not supported"); }
@DomName('HTMLContentElement.HTMLContentElement')
@DocsEditable()
factory ContentElement() => document.createElement("content");
/**
* Constructor instantiated by the DOM when a custom element has been created.
*
* This can only be called by subclasses from their created constructor.
*/
ContentElement.created() : super.created();
/// Checks if this type is supported on the current platform.
static bool get supported => Element.isTagSupported('content');
@DomName('HTMLContentElement.select')
@DocsEditable()
String select;
@DomName('HTMLContentElement.getDistributedNodes')
@DocsEditable()
@Returns('NodeList')
@Creates('NodeList')
List<Node> getDistributedNodes() native;
}
// 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.
@DocsEditable()
@DomName('Coordinates')
@Native("Coordinates")
class Coordinates extends Interceptor {
// To suppress missing implicit constructor warnings.
factory Coordinates._() { throw new UnsupportedError("Not supported"); }
@DomName('Coordinates.accuracy')
@DocsEditable()
final double accuracy;
@DomName('Coordinates.altitude')
@DocsEditable()
final double altitude;
@DomName('Coordinates.altitudeAccuracy')
@DocsEditable()
final double altitudeAccuracy;
@DomName('Coordinates.heading')
@DocsEditable()
final double heading;
@DomName('Coordinates.latitude')
@DocsEditable()
final double latitude;
@DomName('Coordinates.longitude')
@DocsEditable()
final double longitude;
@DomName('Coordinates.speed')
@DocsEditable()
final double speed;
}
// 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.
@DocsEditable()
@DomName('Credential')
@Experimental() // untriaged
@Native("Credential")
class Credential extends Interceptor {
// To suppress missing implicit constructor warnings.
factory Credential._() { throw new UnsupportedError("Not supported"); }
@JSName('avatarURL')
@DomName('Credential.avatarURL')
@DocsEditable()
@Experimental() // untriaged
final String avatarUrl;
@DomName('Credential.id')
@DocsEditable()
@Experimental() // untriaged
final String id;
@DomName('Credential.name')
@DocsEditable()
@Experimental() // untriaged
final String name;
}
// 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.
@DocsEditable()
@DomName('CredentialsContainer')
@Experimental() // untriaged
@Native("CredentialsContainer")
class CredentialsContainer extends Interceptor {
// To suppress missing implicit constructor warnings.
factory CredentialsContainer._() { throw new UnsupportedError("Not supported"); }
@DomName('CredentialsContainer.notifyFailedSignIn')
@DocsEditable()
@Experimental() // untriaged
Future notifyFailedSignIn(Credential credential) native;
@DomName('CredentialsContainer.notifySignedIn')
@DocsEditable()
@Experimental() // untriaged
Future notifySignedIn(Credential credential) native;
@DomName('CredentialsContainer.notifySignedOut')
@DocsEditable()
@Experimental() // untriaged
Future notifySignedOut() native;
@DomName('CredentialsContainer.request')
@DocsEditable()
@Experimental() // untriaged
Future request([Map options]) {
if (options != null) {
var options_1 = convertDartToNative_Dictionary(options);
return _request_1(options_1);
}
return _request_2();
}
@JSName('request')
@DomName('CredentialsContainer.request')
@DocsEditable()
@Experimental() // untriaged
Future _request_1(options) native;
@JSName('request')
@DomName('CredentialsContainer.request')
@DocsEditable()
@Experimental() // untriaged
Future _request_2() native;
}
// 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.
@DocsEditable()
@DomName('Crypto')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@Experimental()
// http://www.w3.org/TR/WebCryptoAPI/
@Native("Crypto")
class Crypto extends Interceptor {
// To suppress missing implicit constructor warnings.
factory Crypto._() { throw new UnsupportedError("Not supported"); }
/// Checks if this type is supported on the current platform.
static bool get supported => JS('bool', '!!(window.crypto && window.crypto.getRandomValues)');
@DomName('Crypto.subtle')
@DocsEditable()
@Experimental() // untriaged
final _SubtleCrypto subtle;
@DomName('Crypto.getRandomValues')
@DocsEditable()
@Creates('TypedData')
@Returns('TypedData|Null')
TypedData getRandomValues(TypedData array) native;
}
// 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.
@DocsEditable()
@DomName('CryptoKey')
@Experimental() // untriaged
@Native("CryptoKey")
class CryptoKey extends Interceptor {
// To suppress missing implicit constructor warnings.
factory CryptoKey._() { throw new UnsupportedError("Not supported"); }
@DomName('CryptoKey.algorithm')
@DocsEditable()
@Experimental() // untriaged
final Object algorithm;
@DomName('CryptoKey.extractable')
@DocsEditable()
@Experimental() // untriaged
final bool extractable;
@DomName('CryptoKey.type')
@DocsEditable()
@Experimental() // untriaged
final String type;
@DomName('CryptoKey.usages')
@DocsEditable()
@Experimental() // untriaged
final List<String> usages;
}
// 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.
@DocsEditable()
@DomName('CSS')
// http://www.w3.org/TR/css3-conditional/#the-css-interface
@Experimental() // None
@Native("CSS")
class Css extends Interceptor {
// To suppress missing implicit constructor warnings.
factory Css._() { throw new UnsupportedError("Not supported"); }
@DomName('CSS.supports')
@DocsEditable()
bool supports(String property, String value) native;
@JSName('supports')
@DomName('CSS.supports')
@DocsEditable()
bool supportsCondition(String conditionText) native;
}
// 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.
@DocsEditable()
@DomName('CSSCharsetRule')
// http://dev.w3.org/csswg/cssom/#the-csscharsetrule-interface
@Experimental()
@Native("CSSCharsetRule")
class CssCharsetRule extends CssRule {
// To suppress missing implicit constructor warnings.
factory CssCharsetRule._() { throw new UnsupportedError("Not supported"); }
@DomName('CSSCharsetRule.encoding')
@DocsEditable()
String encoding;
}
// 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.
@DocsEditable()
@DomName('WebKitCSSFilterRule')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@Experimental()
// http://www.w3.org/TR/filter-effects/
@Native("WebKitCSSFilterRule")
class CssFilterRule extends CssRule {
// To suppress missing implicit constructor warnings.
factory CssFilterRule._() { throw new UnsupportedError("Not supported"); }
@DomName('WebKitCSSFilterRule.style')
@DocsEditable()
final CssStyleDeclaration style;
}
// 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.
@DocsEditable()
@DomName('CSSFontFaceRule')
@Native("CSSFontFaceRule")
class CssFontFaceRule extends CssRule {
// To suppress missing implicit constructor warnings.
factory CssFontFaceRule._() { throw new UnsupportedError("Not supported"); }
@DomName('CSSFontFaceRule.style')
@DocsEditable()
final CssStyleDeclaration style;
}
// 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.
@DocsEditable()
@DomName('CSSImportRule')
@Native("CSSImportRule")
class CssImportRule extends CssRule {
// To suppress missing implicit constructor warnings.
factory CssImportRule._() { throw new UnsupportedError("Not supported"); }
@DomName('CSSImportRule.href')
@DocsEditable()
final String href;
@DomName('CSSImportRule.media')
@DocsEditable()
final MediaList media;
@DomName('CSSImportRule.styleSheet')
@DocsEditable()
final CssStyleSheet styleSheet;
}
// 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.
@DocsEditable()
@DomName('CSSKeyframeRule')
@Experimental() // untriaged
@Native("CSSKeyframeRule,MozCSSKeyframeRule,WebKitCSSKeyframeRule")
class CssKeyframeRule extends CssRule {
// To suppress missing implicit constructor warnings.
factory CssKeyframeRule._() { throw new UnsupportedError("Not supported"); }
@DomName('CSSKeyframeRule.keyText')
@DocsEditable()
@Experimental() // untriaged
String keyText;
@DomName('CSSKeyframeRule.style')
@DocsEditable()
@Experimental() // untriaged
final CssStyleDeclaration style;
}
// 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.
@DocsEditable()
@DomName('CSSKeyframesRule')
@Experimental() // untriaged
@Native("CSSKeyframesRule,MozCSSKeyframesRule,WebKitCSSKeyframesRule")
class CssKeyframesRule extends CssRule {
// To suppress missing implicit constructor warnings.
factory CssKeyframesRule._() { throw new UnsupportedError("Not supported"); }
@DomName('CSSKeyframesRule.cssRules')
@DocsEditable()
@Experimental() // untriaged
@Returns('_CssRuleList')
@Creates('_CssRuleList')
final List<CssRule> cssRules;
@DomName('CSSKeyframesRule.name')
@DocsEditable()
@Experimental() // untriaged
String name;
@DomName('CSSKeyframesRule.__getter__')
@DocsEditable()
@Experimental() // untriaged
CssKeyframeRule __getter__(int index) native;
@DomName('CSSKeyframesRule.deleteRule')
@DocsEditable()
@Experimental() // untriaged
void deleteRule(String key) native;
@DomName('CSSKeyframesRule.findRule')
@DocsEditable()
@Experimental() // untriaged
CssKeyframeRule findRule(String key) native;
@JSName('insertRule')
@DomName('CSSKeyframesRule.insertRule')
@DocsEditable()
@Experimental() // untriaged
void appendRule(String rule) native;
}
// 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.
@DocsEditable()
@DomName('CSSMediaRule')
@Native("CSSMediaRule")
class CssMediaRule extends CssRule {
// To suppress missing implicit constructor warnings.
factory CssMediaRule._() { throw new UnsupportedError("Not supported"); }
@DomName('CSSMediaRule.cssRules')
@DocsEditable()
@Returns('_CssRuleList')
@Creates('_CssRuleList')
final List<CssRule> cssRules;
@DomName('CSSMediaRule.media')
@DocsEditable()
final MediaList media;
@DomName('CSSMediaRule.deleteRule')
@DocsEditable()
void deleteRule(int index) native;
@DomName('CSSMediaRule.insertRule')
@DocsEditable()
int insertRule(String rule, int index) native;
}
// 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.
@DocsEditable()
@DomName('CSSPageRule')
@Native("CSSPageRule")
class CssPageRule extends CssRule {
// To suppress missing implicit constructor warnings.
factory CssPageRule._() { throw new UnsupportedError("Not supported"); }
@DomName('CSSPageRule.selectorText')
@DocsEditable()
String selectorText;
@DomName('CSSPageRule.style')
@DocsEditable()
final CssStyleDeclaration style;
}
// 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.
@DocsEditable()
@DomName('CSSRule')
@Native("CSSRule")
class CssRule extends Interceptor {
// To suppress missing implicit constructor warnings.
factory CssRule._() { throw new UnsupportedError("Not supported"); }
@DomName('CSSRule.CHARSET_RULE')
@DocsEditable()
static const int CHARSET_RULE = 2;
@DomName('CSSRule.FONT_FACE_RULE')
@DocsEditable()
static const int FONT_FACE_RULE = 5;
@DomName('CSSRule.IMPORT_RULE')
@DocsEditable()
static const int IMPORT_RULE = 3;
@DomName('CSSRule.KEYFRAMES_RULE')
@DocsEditable()
@Experimental() // untriaged
static const int KEYFRAMES_RULE = 7;
@DomName('CSSRule.KEYFRAME_RULE')
@DocsEditable()
@Experimental() // untriaged
static const int KEYFRAME_RULE = 8;
@DomName('CSSRule.MEDIA_RULE')
@DocsEditable()
static const int MEDIA_RULE = 4;
@DomName('CSSRule.PAGE_RULE')
@DocsEditable()
static const int PAGE_RULE = 6;
@DomName('CSSRule.STYLE_RULE')
@DocsEditable()
static const int STYLE_RULE = 1;
@DomName('CSSRule.SUPPORTS_RULE')
@DocsEditable()
static const int SUPPORTS_RULE = 12;
@DomName('CSSRule.VIEWPORT_RULE')
@DocsEditable()
@Experimental() // untriaged
static const int VIEWPORT_RULE = 15;
@DomName('CSSRule.WEBKIT_FILTER_RULE')
@DocsEditable()
// http://www.w3.org/TR/filter-effects/
@Experimental()
static const int WEBKIT_FILTER_RULE = 17;
@DomName('CSSRule.WEBKIT_KEYFRAMES_RULE')
@DocsEditable()
// http://www.w3.org/TR/css3-animations/#cssrule
@Experimental()
static const int WEBKIT_KEYFRAMES_RULE = 7;
@DomName('CSSRule.WEBKIT_KEYFRAME_RULE')
@DocsEditable()
// http://www.w3.org/TR/css3-animations/#cssrule
@Experimental()
static const int WEBKIT_KEYFRAME_RULE = 8;
@DomName('CSSRule.cssText')
@DocsEditable()
String cssText;
@DomName('CSSRule.parentRule')
@DocsEditable()
final CssRule parentRule;
@DomName('CSSRule.parentStyleSheet')
@DocsEditable()
final CssStyleSheet parentStyleSheet;
@DomName('CSSRule.type')
@DocsEditable()
final int type;
}
// Copyright (c) 2014, 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.
// WARNING: DO NOT EDIT THIS TEMPLATE FILE.
// The template file was generated by scripts/css_code_generator.py
// Source of CSS properties:
// CSSPropertyNames.in
<