Bug 1141979 - part14 - WebIDL for bindings; r=jrmuizel, r=smaug
MozReview-Commit-ID: 5iR0WUuX6Zu
--- a/dom/webidl/ImageBitmap.webidl
+++ b/dom/webidl/ImageBitmap.webidl
@@ -51,16 +51,28 @@ partial interface ImageBitmap {
};
[NoInterfaceObject, Exposed=(Window,Worker)]
interface ImageBitmapFactories {
[Throws]
Promise<ImageBitmap> createImageBitmap(ImageBitmapSource aImage);
[Throws]
Promise<ImageBitmap> createImageBitmap(ImageBitmapSource aImage, long aSx, long aSy, long aSw, long aSh);
+
+ // Extensions
+ // Bug 1141979 - [FoxEye] Extend ImageBitmap with interfaces to access its
+ // underlying image data
+ //
+ // Note:
+ // Overloaded functions cannot have different "extended attributes",
+ // so I cannot add preference on the extended version of createImageBitmap().
+ // To work around, I will then check the preference at run time and throw if
+ // the preference is set to be false.
+ [Throws]
+ Promise<ImageBitmap> createImageBitmap(ImageBitmapSource aImage, long aOffset, long aLength, ImageBitmapFormat aFormat, ImagePixelLayout aLayout);
};
// ImageBitmap-extensions
// Bug 1141979 - [FoxEye] Extend ImageBitmap with interfaces to access its
// underlying image data
/*
* An image or a video frame is conceptually a two-dimensional array of data and
@@ -404,8 +416,17 @@ dictionary ChannelPixelLayout {
required unsigned long width;
required unsigned long height;
required ChannelPixelLayoutDataType dataType;
required unsigned long stride;
required unsigned long skip;
};
typedef sequence<ChannelPixelLayout> ImagePixelLayout;
+
+partial interface ImageBitmap {
+ [Throws, Func="mozilla::dom::ImageBitmap::ExtensionsEnabled"]
+ ImageBitmapFormat findOptimalFormat (optional sequence<ImageBitmapFormat> aPossibleFormats);
+ [Throws, Func="mozilla::dom::ImageBitmap::ExtensionsEnabled"]
+ long mappedDataLength (ImageBitmapFormat aFormat);
+ [Throws, Func="mozilla::dom::ImageBitmap::ExtensionsEnabled"]
+ Promise<ImagePixelLayout> mapDataInto (ImageBitmapFormat aFormat, BufferSource aBuffer, long aOffset);
+};
\ No newline at end of file