michael@0: /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: * michael@0: * The origin of this IDL file is michael@0: * http://www.whatwg.org/specs/web-apps/current-work/#the-canvas-element michael@0: * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and michael@0: * Opera Software ASA. You are granted a license to use, reproduce michael@0: * and create derivative works of this document. michael@0: */ michael@0: michael@0: interface Blob; michael@0: interface nsIInputStreamCallback; michael@0: interface nsISupports; michael@0: interface Variant; michael@0: michael@0: interface HTMLCanvasElement : HTMLElement { michael@0: [Pure, SetterThrows] michael@0: attribute unsigned long width; michael@0: [Pure, SetterThrows] michael@0: attribute unsigned long height; michael@0: michael@0: [Throws] michael@0: nsISupports? getContext(DOMString contextId, optional any contextOptions = null); michael@0: michael@0: [Throws] michael@0: DOMString toDataURL(optional DOMString type = "", michael@0: optional any encoderOptions); michael@0: [Throws] michael@0: void toBlob(FileCallback _callback, michael@0: optional DOMString type = "", michael@0: optional any encoderOptions); michael@0: }; michael@0: michael@0: // Mozilla specific bits michael@0: partial interface HTMLCanvasElement { michael@0: [Pure, SetterThrows] michael@0: attribute boolean mozOpaque; michael@0: [Throws] michael@0: File mozGetAsFile(DOMString name, optional DOMString? type = null); michael@0: [ChromeOnly, Throws] michael@0: nsISupports? MozGetIPCContext(DOMString contextId); michael@0: [ChromeOnly] michael@0: void mozFetchAsStream(nsIInputStreamCallback callback, optional DOMString? type = null); michael@0: attribute PrintCallback? mozPrintCallback; michael@0: }; michael@0: michael@0: [ChromeOnly] michael@0: interface MozCanvasPrintState michael@0: { michael@0: // A canvas rendering context. michael@0: readonly attribute nsISupports context; michael@0: michael@0: // To be called when rendering to the context is done. michael@0: void done(); michael@0: }; michael@0: michael@0: callback PrintCallback = void(MozCanvasPrintState ctx); michael@0: michael@0: callback FileCallback = void(Blob file);