Bug 1141979 - part14 - WebIDL for bindings; r=jrmuizel, r=smaug draft
authorKaku Kuo <tkuo@mozilla.com>
Wed, 27 Apr 2016 11:47:54 +0800
changeset 373853 8e2c969b224f0c38828ea943a5ae0879545a450c
parent 373852 734d3e9122688d8c9c6f445be0e765c154fd1e54
child 373854 f6d2323fc722d73b9dbed25cf4992e3978b2cc0a
push id19853
push usertkuo@mozilla.com
push dateWed, 01 Jun 2016 09:17:41 +0000
reviewersjrmuizel, smaug
bugs1141979
milestone49.0a1
Bug 1141979 - part14 - WebIDL for bindings; r=jrmuizel, r=smaug MozReview-Commit-ID: 5iR0WUuX6Zu
dom/webidl/ImageBitmap.webidl
--- 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