Bug 1141979 - part10 - WebIDL for bindings; r?roc, smaug draft
authorKaku Kuo <tkuo@mozilla.com>
Wed, 18 Nov 2015 11:29:50 +0800
changeset 316246 736ce36897f5411398d66418c6497aa4cbee9c41
parent 316245 4b05b22584d2d94ab119a54ad2a37eb0e94f1fa3
child 316247 769c4658d71ede76d3c29a58e66e4fd71d75affd
push id8519
push usertkuo@mozilla.com
push dateFri, 18 Dec 2015 04:55:46 +0000
reviewersroc, smaug
bugs1141979
milestone45.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
@@ -387,8 +401,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]
+    ImageBitmapFormat               findOptimalFormat (optional sequence<ImageBitmapFormat> aPossibleFormats);
+    [Throws]
+    long                            mappedDataLength (ImageBitmapFormat aFormat);
+    [Throws]
+    Promise<ImagePixelLayout> mapDataInto (ImageBitmapFormat aFormat, BufferSource aBuffer, long aOffset);
+};
\ No newline at end of file