Bug 1500733 - Remove ImageBitmap.findOptimalFormat, r=aosmond
authorAndrea Marchesini <amarchesini@mozilla.com>
Tue, 23 Oct 2018 23:35:44 +0200
changeset 490927 e324b60281ddc58a514dc84db048431a64312a01
parent 490926 17ac83c08f67ff1e3846c375de8d5dd0851580b3
child 490928 8b5a4cd42d40d1ff27ec63265960f7e6fd43dfea
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersaosmond
bugs1500733
milestone65.0a1
Bug 1500733 - Remove ImageBitmap.findOptimalFormat, r=aosmond
dom/canvas/ImageBitmap.cpp
dom/canvas/ImageBitmap.h
dom/webidl/ImageBitmap.webidl
--- a/dom/canvas/ImageBitmap.cpp
+++ b/dom/canvas/ImageBitmap.cpp
@@ -1515,45 +1515,16 @@ ImageBitmap::WriteStructuredClone(JSStru
   if (NS_WARN_IF(!dstDataSurface)) {
     return false;
   }
   Factory::CopyDataSourceSurface(snapshot, dstDataSurface);
   aClonedSurfaces.AppendElement(dstDataSurface);
   return true;
 }
 
-// ImageBitmap extensions.
-ImageBitmapFormat
-ImageBitmap::FindOptimalFormat(const Optional<Sequence<ImageBitmapFormat>>& aPossibleFormats,
-                               ErrorResult& aRv)
-{
-  if (!mDataWrapper) {
-    aRv.Throw(NS_ERROR_NOT_AVAILABLE);
-    return ImageBitmapFormat::EndGuard_;
-  }
-
-  ImageBitmapFormat platformFormat = mDataWrapper->GetFormat();
-
-  if (!aPossibleFormats.WasPassed() ||
-      aPossibleFormats.Value().Contains(platformFormat)) {
-    return platformFormat;
-  } else {
-    // If no matching is found, FindBestMatchingFromat() returns
-    // ImageBitmapFormat::EndGuard_ and we throw an exception.
-    ImageBitmapFormat optimalFormat =
-      FindBestMatchingFromat(platformFormat, aPossibleFormats.Value());
-
-    if (optimalFormat == ImageBitmapFormat::EndGuard_) {
-      aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
-    }
-
-    return optimalFormat;
-  }
-}
-
 size_t
 ImageBitmap::GetAllocatedSize() const
 {
   if (!mAllocatedImageData) {
     return 0;
   }
 
   // Calculate how many bytes are used.
--- a/dom/canvas/ImageBitmap.h
+++ b/dom/canvas/ImageBitmap.h
@@ -143,21 +143,16 @@ public:
   WriteStructuredClone(JSStructuredCloneWriter* aWriter,
                        nsTArray<RefPtr<gfx::DataSourceSurface>>& aClonedSurfaces,
                        ImageBitmap* aImageBitmap);
 
   friend CreateImageBitmapFromBlob;
   friend CreateImageBitmapFromBlobTask;
   friend CreateImageBitmapFromBlobWorkerTask;
 
-  // Mozilla Extensions
-  ImageBitmapFormat
-  FindOptimalFormat(const Optional<Sequence<ImageBitmapFormat>>& aPossibleFormats,
-                    ErrorResult& aRv);
-
   size_t GetAllocatedSize() const;
 
   void OnShutdown();
 
 protected:
 
   /*
    * The default value of aIsPremultipliedAlpha is TRUE because that the
--- a/dom/webidl/ImageBitmap.webidl
+++ b/dom/webidl/ImageBitmap.webidl
@@ -388,13 +388,8 @@ 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::DOMPrefs::canvas_imagebitmap_extensions_enabled"]
-    ImageBitmapFormat               findOptimalFormat (optional sequence<ImageBitmapFormat> aPossibleFormats);
-};