mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 720697 - Provide internal API to get canvas image data as nsIInputStream; r=khuey
This commit is contained in:
parent
f180c3d0cb
commit
ad9e14771c
@ -216,6 +216,28 @@ nsHTMLCanvasElement::ToDataURL(const nsAString& aType, nsIVariant* aParams,
|
||||
return ToDataURLImpl(aType, aParams, aDataURL);
|
||||
}
|
||||
|
||||
// nsHTMLCanvasElement::mozFetchAsStream
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLCanvasElement::MozFetchAsStream(nsIInputStreamCallback *aCallback,
|
||||
const nsAString& aType)
|
||||
{
|
||||
if (!nsContentUtils::IsCallerChrome())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsresult rv;
|
||||
bool fellBackToPNG = false;
|
||||
nsCOMPtr<nsIInputStream> inputData;
|
||||
|
||||
rv = ExtractData(aType, EmptyString(), getter_AddRefs(inputData), fellBackToPNG);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIAsyncInputStream> asyncData = do_QueryInterface(inputData, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return aCallback->OnInputStreamReady(asyncData);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLCanvasElement::ExtractData(const nsAString& aType,
|
||||
const nsAString& aOptions,
|
||||
|
@ -54,6 +54,7 @@
|
||||
|
||||
interface nsIDOMFile;
|
||||
interface nsIVariant;
|
||||
interface nsIInputStreamCallback;
|
||||
|
||||
[scriptable, uuid(8cddbc86-f384-40ac-835b-fe3e00630cad)]
|
||||
interface nsIDOMHTMLCanvasElement : nsIDOMHTMLElement
|
||||
@ -82,5 +83,10 @@ interface nsIDOMHTMLCanvasElement : nsIDOMHTMLElement
|
||||
// A Mozilla-only extension to get a canvas context backed by double-buffered
|
||||
// shared memory. Only privileged callers can call this.
|
||||
nsISupports MozGetIPCContext(in DOMString contextId);
|
||||
|
||||
// A Mozilla-only extension that returns the canvas' image data as a data
|
||||
// stream in the desired image format.
|
||||
void mozFetchAsStream(in nsIInputStreamCallback callback,
|
||||
[optional] in DOMString type);
|
||||
};
|
||||
|
||||
|
@ -124,7 +124,7 @@ interface nsIAsyncInputStream : nsIInputStream
|
||||
/**
|
||||
* This is a companion interface for nsIAsyncInputStream::asyncWait.
|
||||
*/
|
||||
[scriptable, uuid(d1f28e94-3a6e-4050-a5f5-2e81b1fc2a43)]
|
||||
[function, scriptable, uuid(d1f28e94-3a6e-4050-a5f5-2e81b1fc2a43)]
|
||||
interface nsIInputStreamCallback : nsISupports
|
||||
{
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user