Backed out changeset 06f41c22f3a6 (bug 1888460) for causing linux xpcshell failures...
[gecko.git] / dom / webidl / HTMLCanvasElement.webidl
blobdff2ac29895dc1cda2a4e07912b9d2582669aaee
1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5  *
6  * The origin of this IDL file is
7  * http://www.whatwg.org/specs/web-apps/current-work/#the-canvas-element
8  * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
9  * Opera Software ASA. You are granted a license to use, reproduce
10  * and create derivative works of this document.
11  */
13 interface nsISupports;
15 typedef (HTMLCanvasElement or OffscreenCanvas) CanvasSource;
17 [Exposed=Window]
18 interface HTMLCanvasElement : HTMLElement {
19   [HTMLConstructor] constructor();
21   [CEReactions, Pure, SetterThrows]
22            attribute unsigned long width;
23   [CEReactions, Pure, SetterThrows]
24            attribute unsigned long height;
26   [Throws]
27   nsISupports? getContext(DOMString contextId, optional any contextOptions = null);
29   [Throws, NeedsSubjectPrincipal]
30   DOMString toDataURL(optional DOMString type = "",
31                       optional any encoderOptions);
32   [Throws, NeedsSubjectPrincipal]
33   undefined toBlob(BlobCallback callback,
34                    optional DOMString type = "",
35                    optional any encoderOptions);
38 // Mozilla specific bits
39 partial interface HTMLCanvasElement {
40   [Pure, SetterThrows]
41            attribute boolean mozOpaque;
43            attribute PrintCallback? mozPrintCallback;
45   [Throws, NeedsSubjectPrincipal]
46   CanvasCaptureMediaStream captureStream(optional double frameRate);
49 // For OffscreenCanvas
50 // Reference: https://wiki.whatwg.org/wiki/OffscreenCanvas
51 partial interface HTMLCanvasElement {
52   [Pref="gfx.offscreencanvas.enabled", Throws]
53   OffscreenCanvas transferControlToOffscreen();
56 [ChromeOnly,
57  Exposed=Window]
58 interface MozCanvasPrintState
60   // A canvas rendering context.
61   readonly attribute nsISupports context;
63   // To be called when rendering to the context is done.
64   undefined done();
67 callback PrintCallback = undefined(MozCanvasPrintState ctx);
69 callback BlobCallback = undefined(Blob? blob);