# HG changeset patch # User Andrea Marchesini # Date 1540330544 -7200 # Tue Oct 23 23:35:44 2018 +0200 # Node ID e324b60281ddc58a514dc84db048431a64312a01 # Parent 96efb52c531ca39bd92a8cc59174f5eda19cb520 Bug 1500733 - Remove ImageBitmap.findOptimalFormat, r=aosmond diff --git a/dom/canvas/ImageBitmap.cpp b/dom/canvas/ImageBitmap.cpp --- a/dom/canvas/ImageBitmap.cpp +++ b/dom/canvas/ImageBitmap.cpp @@ -1512,45 +1512,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>& 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. diff --git a/dom/canvas/ImageBitmap.h b/dom/canvas/ImageBitmap.h --- a/dom/canvas/ImageBitmap.h +++ b/dom/canvas/ImageBitmap.h @@ -137,21 +137,16 @@ public: WriteStructuredClone(JSStructuredCloneWriter* aWriter, nsTArray>& aClonedSurfaces, ImageBitmap* aImageBitmap); friend CreateImageBitmapFromBlob; friend CreateImageBitmapFromBlobTask; friend CreateImageBitmapFromBlobWorkerTask; - // Mozilla Extensions - ImageBitmapFormat - FindOptimalFormat(const Optional>& aPossibleFormats, - ErrorResult& aRv); - size_t GetAllocatedSize() const; void OnShutdown(); protected: /* * The default value of aIsPremultipliedAlpha is TRUE because that the diff --git a/dom/webidl/ImageBitmap.webidl b/dom/webidl/ImageBitmap.webidl --- 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 ImagePixelLayout; - -partial interface ImageBitmap { - [Throws, Func="mozilla::dom::DOMPrefs::ImageBitmapExtensionsEnabled"] - ImageBitmapFormat findOptimalFormat (optional sequence aPossibleFormats); -};