blob: a6defbd57ae0321f2f9a0e76727c2c3ac37859f6 [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;
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,
Returns,
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('returns:HtmlDocument;depends:none;effects:none;gvn:true', '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();
}
/**
* 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();
}
createCustomUpgrader(Type customElementClass, $this) => $this;
// 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<Event> errorEvent =
const EventStreamProvider<Event>('error');
/// Stream of `error` events handled by this [AbstractWorker].
@DomName('AbstractWorker.onerror')
@DocsEditable()
Stream<Event> 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}) {
AnchorElement e = JS('returns:AnchorElement;creates:AnchorElement;new:true',
'#.createElement(#)', document, "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.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 EventTarget {
// To suppress missing implicit constructor warnings.
factory Animation._() {
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('Animation.currentTime')
@DocsEditable()
@Experimental() // untriaged
num currentTime;
@DomName('Animation.effect')
@DocsEditable()
@Experimental() // untriaged
AnimationEffectReadOnly effect;
@DomName('Animation.endClip')
@DocsEditable()
@Experimental() // untriaged
num endClip;
@DomName('Animation.finished')
@DocsEditable()
@Experimental() // untriaged
final Future finished;
@DomName('Animation.playState')
@DocsEditable()
@Experimental() // untriaged
final String playState;
@DomName('Animation.playbackRate')
@DocsEditable()
@Experimental() // untriaged
num playbackRate;
@DomName('Animation.ready')
@DocsEditable()
@Experimental() // untriaged
final Future ready;
@DomName('Animation.startClip')
@DocsEditable()
@Experimental() // untriaged
num startClip;
@DomName('Animation.startTime')
@DocsEditable()
@Experimental() // untriaged
num startTime;
@DomName('Animation.cancel')
@DocsEditable()
@Experimental() // untriaged
void cancel() native ;
@DomName('Animation.finish')
@DocsEditable()
@Experimental() // untriaged
void finish() native ;
@DomName('Animation.pause')
@DocsEditable()
@Experimental() // untriaged
void pause() native ;
@DomName('Animation.play')
@DocsEditable()
@Experimental() // untriaged
void play() native ;
@DomName('Animation.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('AnimationEffectReadOnly')
@Experimental() // untriaged
@Native("AnimationEffectReadOnly")
class AnimationEffectReadOnly extends Interceptor {
// To suppress missing implicit constructor warnings.
factory AnimationEffectReadOnly._() {
throw new UnsupportedError("Not supported");
}
@DomName('AnimationEffectReadOnly.computedTiming')
@DocsEditable()
@Experimental() // untriaged
Map get computedTiming =>
convertNativeToDart_Dictionary(this._get_computedTiming);
@JSName('computedTiming')
@DomName('AnimationEffectReadOnly.computedTiming')
@DocsEditable()
@Experimental() // untriaged
final dynamic _get_computedTiming;
@DomName('AnimationEffectReadOnly.timing')
@DocsEditable()
@Experimental() // untriaged
final AnimationEffectTiming 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('AnimationEffectTiming')
@Experimental() // untriaged
@Native("AnimationEffectTiming")
class AnimationEffectTiming extends Interceptor {
// To suppress missing implicit constructor warnings.
factory AnimationEffectTiming._() {
throw new UnsupportedError("Not supported");
}
@DomName('AnimationEffectTiming.delay')
@DocsEditable()
@Experimental() // untriaged
num delay;
@DomName('AnimationEffectTiming.direction')
@DocsEditable()
@Experimental() // untriaged
String direction;
@DomName('AnimationEffectTiming.duration')
@DocsEditable()
@Experimental() // untriaged
@Creates('Null')
@Returns('num|String')
Object duration;
@DomName('AnimationEffectTiming.easing')
@DocsEditable()
@Experimental() // untriaged
String easing;
@DomName('AnimationEffectTiming.endDelay')
@DocsEditable()
@Experimental() // untriaged
num endDelay;
@DomName('AnimationEffectTiming.fill')
@DocsEditable()
@Experimental() // untriaged
String fill;
@DomName('AnimationEffectTiming.iterationStart')
@DocsEditable()
@Experimental() // untriaged
num iterationStart;
@DomName('AnimationEffectTiming.iterations')
@DocsEditable()
@Experimental() // untriaged
num iterations;
@DomName('AnimationEffectTiming.playbackRate')
@DocsEditable()
@Experimental() // untriaged
num playbackRate;
}
// 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('AnimationEvent')
@Experimental() // untriaged
@Native("AnimationEvent")
class AnimationEvent extends Event {
// To suppress missing implicit constructor warnings.
factory AnimationEvent._() {
throw new UnsupportedError("Not supported");
}
@DomName('AnimationEvent.AnimationEvent')
@DocsEditable()
factory AnimationEvent(String type, [Map eventInitDict]) {
if (eventInitDict != null) {
var eventInitDict_1 = convertDartToNative_Dictionary(eventInitDict);
return AnimationEvent._create_1(type, eventInitDict_1);
}
return AnimationEvent._create_2(type);
}
static AnimationEvent _create_1(type, eventInitDict) =>
JS('AnimationEvent', 'new AnimationEvent(#,#)', type, eventInitDict);
static AnimationEvent _create_2(type) =>
JS('AnimationEvent', 'new AnimationEvent(#)', type);
@DomName('AnimationEvent.animationName')
@DocsEditable()
@Experimental() // untriaged
final String animationName;
@DomName('AnimationEvent.elapsedTime')
@DocsEditable()
@Experimental() // untriaged
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('AnimationPlayerEvent')
@Experimental() // untriaged
@Native("AnimationPlayerEvent")
class AnimationPlayerEvent extends Event {
// To suppress missing implicit constructor warnings.
factory AnimationPlayerEvent._() {
throw new UnsupportedError("Not supported");
}
@DomName('AnimationPlayerEvent.AnimationPlayerEvent')
@DocsEditable()
factory AnimationPlayerEvent(String type, [Map eventInitDict]) {
if (eventInitDict != null) {
var eventInitDict_1 = convertDartToNative_Dictionary(eventInitDict);
return AnimationPlayerEvent._create_1(type, eventInitDict_1);
}
return AnimationPlayerEvent._create_2(type);
}
static AnimationPlayerEvent _create_1(type, eventInitDict) => JS(
'AnimationPlayerEvent',
'new AnimationPlayerEvent(#,#)',
type,
eventInitDict);
static AnimationPlayerEvent _create_2(type) =>
JS('AnimationPlayerEvent', 'new AnimationPlayerEvent(#)', type);
@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
num currentTime;
@DomName('AnimationTimeline.playbackRate')
@DocsEditable()
@Experimental() // untriaged
num playbackRate;
@DomName('AnimationTimeline.getAnimations')
@DocsEditable()
@Experimental() // untriaged
List<Animation> getAnimations() native ;
@DomName('AnimationTimeline.play')
@DocsEditable()
@Experimental() // untriaged
Animation play(AnimationEffectReadOnly 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()
@DomName('AppBannerPromptResult')
@Experimental() // untriaged
@Native("AppBannerPromptResult")
class AppBannerPromptResult extends Interceptor {
// To suppress missing implicit constructor warnings.
factory AppBannerPromptResult._() {
throw new UnsupportedError("Not supported");
}
@DomName('AppBannerPromptResult.outcome')
@DocsEditable()
@Experimental() // untriaged
final String outcome;
@DomName('AppBannerPromptResult.platform')
@DocsEditable()
@Experimental() // untriaged
final String platform;
}
// 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.ApplicationCacheErrorEvent')
@DocsEditable()
factory ApplicationCacheErrorEvent(String type, [Map eventInitDict]) {
if (eventInitDict != null) {
var eventInitDict_1 = convertDartToNative_Dictionary(eventInitDict);
return ApplicationCacheErrorEvent._create_1(type, eventInitDict_1);
}
return ApplicationCacheErrorEvent._create_2(type);
}
static ApplicationCacheErrorEvent _create_1(type, eventInitDict) => JS(
'ApplicationCacheErrorEvent',
'new ApplicationCacheErrorEvent(#,#)',
type,
eventInitDict);
static ApplicationCacheErrorEvent _create_2(type) => JS(
'ApplicationCacheErrorEvent', 'new ApplicationCacheErrorEvent(#)', type);
@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() => JS(
'returns:AreaElement;creates:AreaElement;new:true',
'#.createElement(#)',
document,
"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 {
@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();
factory AudioElement([String src]) => new AudioElement._(src);
}
// 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.AutocompleteErrorEvent')
@DocsEditable()
factory AutocompleteErrorEvent(String type, [Map eventInitDict]) {
if (eventInitDict != null) {
var eventInitDict_1 = convertDartToNative_Dictionary(eventInitDict);
return AutocompleteErrorEvent._create_1(type, eventInitDict_1);
}
return AutocompleteErrorEvent._create_2(type);
}
static AutocompleteErrorEvent _create_1(type, eventInitDict) => JS(
'AutocompleteErrorEvent',
'new AutocompleteErrorEvent(#,#)',
type,
eventInitDict);
static AutocompleteErrorEvent _create_2(type) =>
JS('AutocompleteErrorEvent', 'new AutocompleteErrorEvent(#)', type);
@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() => JS('returns:BRElement;creates:BRElement;new:true',
'#.createElement(#)', document, "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() => JS(
'returns:BaseElement;creates:BaseElement;new:true',
'#.createElement(#)',
document,
"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('BeforeInstallPromptEvent')
@Experimental() // untriaged
@Native("BeforeInstallPromptEvent")
class BeforeInstallPromptEvent extends Event {
// To suppress missing implicit constructor warnings.
factory BeforeInstallPromptEvent._() {
throw new UnsupportedError("Not supported");
}
@DomName('BeforeInstallPromptEvent.BeforeInstallPromptEvent')
@DocsEditable()
factory BeforeInstallPromptEvent(String type, [Map eventInitDict]) {
if (eventInitDict != null) {
var eventInitDict_1 = convertDartToNative_Dictionary(eventInitDict);
return BeforeInstallPromptEvent._create_1(type, eventInitDict_1);
}
return BeforeInstallPromptEvent._create_2(type);
}
static BeforeInstallPromptEvent _create_1(type, eventInitDict) => JS(
'BeforeInstallPromptEvent',
'new BeforeInstallPromptEvent(#,#)',
type,
eventInitDict);
static BeforeInstallPromptEvent _create_2(type) =>
JS('BeforeInstallPromptEvent', 'new BeforeInstallPromptEvent(#)', type);
List<String> get platforms => JS("List<String>", "#.platforms", this);
@DomName('BeforeInstallPromptEvent.userChoice')
@DocsEditable()
@Experimental() // untriaged
final Future userChoice;
@DomName('BeforeInstallPromptEvent.prompt')
@DocsEditable()
@Experimental() // untriaged
Future prompt() 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('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);
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 self.Blob(#)', parts);
static _create_2(parts, bag) => JS('Blob', 'new self.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('Bluetooth')
@Experimental() // untriaged
@Native("Bluetooth")
class Bluetooth extends Interceptor {
// To suppress missing implicit constructor warnings.
factory Bluetooth._() {
throw new UnsupportedError("Not supported");
}
@DomName('Bluetooth.requestDevice')
@DocsEditable()
@Experimental() // untriaged
Future requestDevice(Map options) {
var options_1 = convertDartToNative_Dictionary(options);
return _requestDevice_1(options_1);
}
@JSName('requestDevice')
@DomName('Bluetooth.requestDevice')
@DocsEditable()
@Experimental() // untriaged
Future _requestDevice_1(options) 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('BluetoothDevice')
@Experimental() // untriaged
@Native("BluetoothDevice")
class BluetoothDevice extends Interceptor {
// To suppress missing implicit constructor warnings.
factory BluetoothDevice._() {
throw new UnsupportedError("Not supported");
}
@DomName('BluetoothDevice.deviceClass')
@DocsEditable()
@Experimental() // untriaged
final int deviceClass;
@DomName('BluetoothDevice.instanceID')
@DocsEditable()
@Experimental() // untriaged
final String instanceID;
@DomName('BluetoothDevice.name')
@DocsEditable()
@Experimental() // untriaged
final String name;
@DomName('BluetoothDevice.paired')
@DocsEditable()
@Experimental() // untriaged
final bool paired;
@DomName('BluetoothDevice.productID')
@DocsEditable()
@Experimental() // untriaged
final int productID;
@DomName('BluetoothDevice.productVersion')
@DocsEditable()
@Experimental() // untriaged
final int productVersion;
@DomName('BluetoothDevice.vendorID')
@DocsEditable()
@Experimental() // untriaged
final int vendorID;
@DomName('BluetoothDevice.vendorIDSource')
@DocsEditable()
@Experimental() // untriaged
final String vendorIDSource;
@JSName('connectGATT')
@DomName('BluetoothDevice.connectGATT')
@DocsEditable()
@Experimental() // untriaged
Future connectGatt() 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('BluetoothGATTCharacteristic')
@Experimental() // untriaged
@Native("BluetoothGATTCharacteristic")
class BluetoothGattCharacteristic extends Interceptor {
// To suppress missing implicit constructor warnings.
factory BluetoothGattCharacteristic._() {
throw new UnsupportedError("Not supported");
}
@DomName('BluetoothGATTCharacteristic.uuid')
@DocsEditable()
@Experimental() // untriaged
final String uuid;
@DomName('BluetoothGATTCharacteristic.readValue')
@DocsEditable()
@Experimental() // untriaged
Future readValue() native ;
@DomName('BluetoothGATTCharacteristic.writeValue')
@DocsEditable()
@Experimental() // untriaged
Future writeValue(/*BufferSource*/ value) 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('BluetoothGATTRemoteServer')
@Experimental() // untriaged
@Native("BluetoothGATTRemoteServer")
class BluetoothGattRemoteServer extends Interceptor {
// To suppress missing implicit constructor warnings.
factory BluetoothGattRemoteServer._() {
throw new UnsupportedError("Not supported");
}
@DomName('BluetoothGATTRemoteServer.connected')
@DocsEditable()
@Experimental() // untriaged
final bool connected;
@DomName('BluetoothGATTRemoteServer.getPrimaryService')
@DocsEditable()
@Experimental() // untriaged
Future getPrimaryService(/*BluetoothServiceUUID*/ service) 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('BluetoothGATTService')
@Experimental() // untriaged
@Native("BluetoothGATTService")
class BluetoothGattService extends Interceptor {
// To suppress missing implicit constructor warnings.
factory BluetoothGattService._() {
throw new UnsupportedError("Not supported");
}
@DomName('BluetoothGATTService.isPrimary')
@DocsEditable()
@Experimental() // untriaged
final bool isPrimary;
@DomName('BluetoothGATTService.uuid')
@DocsEditable()
@Experimental() // untriaged
final String uuid;
@DomName('BluetoothGATTService.getCharacteristic')
@DocsEditable()
@Experimental() // untriaged
Future getCharacteristic(/*BluetoothCharacteristicUUID*/ characteristic)
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('BluetoothUUID')
@Experimental() // untriaged
@Native("BluetoothUUID")
class BluetoothUuid extends Interceptor {
// To suppress missing implicit constructor warnings.
factory BluetoothUuid._() {
throw new UnsupportedError("Not supported");
}
@JSName('canonicalUUID')
@DomName('BluetoothUUID.canonicalUUID')
@DocsEditable()
@Experimental() // untriaged
static String canonicalUuid(int alias) native ;
@DomName('BluetoothUUID.getCharacteristic')
@DocsEditable()
@Experimental() // untriaged
static String getCharacteristic(Object name) native ;
@DomName('BluetoothUUID.getDescriptor')
@DocsEditable()
@Experimental() // untriaged
static String getDescriptor(Object name) native ;
@DomName('BluetoothUUID.getService')
@DocsEditable()
@Experimental() // untriaged
static String getService(Object name) 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('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() => JS(
'returns:BodyElement;creates:BodyElement;new:true',
'#.createElement(#)',
document,
"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() => JS(
'returns:ButtonElement;creates:ButtonElement;new:true',
'#.createElement(#)',
document,
"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.reportValidity')
@DocsEditable()
@Experimental() // untriaged
bool reportValidity() 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.delete')
@DocsEditable()
@Experimental() // untriaged
Future delete(String cacheName) native ;
@DomName('CacheStorage.has')
@DocsEditable()
@Experimental() // untriaged
Future has(String cacheName) native ;
@DomName('CacheStorage.keys')
@DocsEditable()
@Experimental() // untriaged
Future keys() native ;
@DomName('CacheStorage.match')
@DocsEditable()
@Experimental() // untriaged
Future match(/*RequestInfo*/ request, [Map options]) {
if (options != null) {
var options_1 = convertDartToNative_Dictionary(options);
return _match_1(request, options_1);
}
return _match_2(request);
}
@JSName('match')
@DomName('CacheStorage.match')
@DocsEditable()
@Experimental() // untriaged
Future _match_1(request, options) native ;
@JSName('match')
@DomName('CacheStorage.match')
@DocsEditable()
@Experimental() // untriaged
Future _match_2(request) native ;
@DomName('CacheStorage.open')
@DocsEditable()
@Experimental() // untriaged
Future open(String cacheName) 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('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}) {
CanvasElement e = JS('returns:CanvasElement;creates:CanvasElement;new:true',
'#.createElement(#)', document, "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 attributes]) {
if (attributes != null) {
var attributes_1 = convertDartToNative_Dictionary(attributes);
return _getContext_1(contextId, attributes_1);
}
return _getContext_2(contextId);
}
@JSName('getContext')
@DomName('HTMLCanvasElement.getContext')
@DocsEditable()
@Creates('CanvasRenderingContext2D|RenderingContext')
@Returns('CanvasRenderingContext2D|RenderingContext|Null')
Object _getContext_1(contextId, attributes) 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, [arguments_OR_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](https://html.spec.whatwg.org/multipage/scripting.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](https://html.spec.whatwg.org/multipage/scripting.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.filter')
@DocsEditable()
@Experimental() // untriaged
String filter;
@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](https://html.spec.whatwg.org/multipage/scripting.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(imagedata_OR_sw, [num sh]) {
if ((imagedata_OR_sw is ImageData) && sh == null) {
var imagedata_1 = convertDartToNative_ImageData(imagedata_OR_sw);
return convertNativeToDart_ImageData(_createImageData_1(imagedata_1));
}
if (sh != null && (imagedata_OR_sw is num)) {
return convertNativeToDart_ImageData(
_createImageData_2(imagedata_OR_sw, sh));
}
throw new ArgumentError("Incorrect number or type of arguments");
}
@JSName('createImageData')
@DomName('CanvasRenderingContext2D.createImageData')
@DocsEditable()
@Creates('ImageData|=Object')
_createImageData_1(imagedata) native ;
@JSName('createImageData')
@DomName('CanvasRenderingContext2D.createImageData')
@DocsEditable()
@Creates('ImageData|=Object')
_createImageData_2(num sw, sh) native ;
@DomName('CanvasRenderingContext2D.createLinearGradient')
@DocsEditable()
CanvasGradient createLinearGradient(num x0, num y0, num x1, num y1) native ;
@DomName('CanvasRenderingContext2D.createPattern')
@DocsEditable()
CanvasPattern createPattern(Object 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()
Map getContextAttributes() {
return convertNativeToDart_Dictionary(_getContextAttributes_1());
}
@JSName('getContextAttributes')
@DomName('CanvasRenderingContext2D.getContextAttributes')
@DocsEditable()
// http://wiki.whatwg.org/wiki/CanvasOpaque#Suggested_IDL
@Experimental()
_getContextAttributes_1() 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 ;
@DomName('CanvasRenderingContext2D.createImageDataFromImageData')
@DocsEditable()
ImageData createImageDataFromImageData(ImageData imagedata) =>
JS('ImageData', '#.createImageData(#)', this, imagedata);
/**
* 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);
}
@DomName('CanvasRenderingContext2D.createPatternFromImage')
CanvasPattern createPatternFromImage(
ImageElement image, String repetitionType) =>
JS('CanvasPattern', '#.createPattern(#, #)', this, image, repetitionType);
/**
* 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.
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 NonDocumentTypeChildNode, 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 count) native ;
@DomName('CharacterData.insertData')
@DocsEditable()
void insertData(int offset, String data) native ;
@DomName('CharacterData.replaceData')
@DocsEditable()
void replaceData(int offset, int count, String data) native ;
@DomName('CharacterData.substringData')
@DocsEditable()
String substringData(int offset, int count) native ;
// From ChildNode
@DomName('CharacterData.after')
@DocsEditable()
@Experimental() // untriaged
void after(Object nodes) native ;
@DomName('CharacterData.before')
@DocsEditable()
@Experimental() // untriaged
void before(Object nodes) native ;
// From NonDocumentTypeChildNode
@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");
}
void after(Object nodes);
void before(Object nodes);
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('CHROMIUMValuebuffer')
@Experimental() // untriaged