Bug 1141979 - part10 - WebIDL for bindings; r?roc, smaug draft
authorKaku Kuo <tkuo@mozilla.com>
Wed, 18 Nov 2015 11:29:50 +0800
changeset 341997 b5b14217fe505563230355944377243e2bd174bb
parent 341996 a1c6471885a90d9a5a5733212630c364ad42b6c6
child 341998 47658cb2904a7243b6ff71b4e71b6758c2146416
push id13340
push usertkuo@mozilla.com
push dateFri, 18 Mar 2016 09:53:30 +0000
reviewersroc, smaug
bugs1141979
milestone48.0a1
Bug 1141979 - part10 - WebIDL for bindings; r?roc, smaug MozReview-Commit-ID: 5iR0WUuX6Zu
dom/webidl/ImageBitmap.webidl
--- a/dom/webidl/ImageBitmap.webidl
+++ b/dom/webidl/ImageBitmap.webidl
@@ -51,16 +51,30 @@ 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);
+  [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
@@ -404,8 +418,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