Bug 1141979 - part10 - WebIDL for bindings; r?roc, smaug draft
authorKaku Kuo <tkuo@mozilla.com>
Wed, 18 Nov 2015 11:29:50 +0800
changeset 316836 9902030cadc8edb3293f324eb5335e2c5343eb8a
parent 316835 9cd5e6daae3411857038acddea6cba5e63cea342
child 316837 e3c18f3f7e27021b8dd03d55953cf17a147470b2
push id8625
push usertkuo@mozilla.com
push dateTue, 22 Dec 2015 08:28:53 +0000
reviewersroc, smaug
bugs1141979
milestone46.0a1
Bug 1141979 - part10 - WebIDL for bindings; r?roc, smaug
dom/webidl/ImageBitmap.webidl
--- a/dom/webidl/ImageBitmap.webidl
+++ b/dom/webidl/ImageBitmap.webidl
@@ -39,16 +39,30 @@ 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);
+  [Throws]
+  Promise<ImageBitmap> createImageBitmap(ImageBitmapSource aImage, long aOffset, long aLength, ImageBitmapFormat aFormat, ImagePixelLayout aLayout, long aSx, long aSy, long aSw, long aSh);
 };
 
 // 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
@@ -392,8 +406,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::PrefEnabled"]
+    ImageBitmapFormat               findOptimalFormat (optional sequence<ImageBitmapFormat> aPossibleFormats);
+    [Throws, Func="mozilla::dom::ImageBitmap::PrefEnabled"]
+    long                            mappedDataLength (ImageBitmapFormat aFormat);
+    [Throws, Func="mozilla::dom::ImageBitmap::PrefEnabled"]
+    Promise<ImagePixelLayout> mapDataInto (ImageBitmapFormat aFormat, BufferSource aBuffer, long aOffset);
+};
\ No newline at end of file