Bug 1355898. Rename flag SFE_WANT_FIRST_FRAME to SFE_WANT_FIRST_FRAME_IF_IMAGE to represent what it does better. r=jgilbert. a=gchang
We only pay attention to the flag for images.
--- a/dom/canvas/CanvasRenderingContext2D.cpp
+++ b/dom/canvas/CanvasRenderingContext2D.cpp
@@ -2564,17 +2564,17 @@ CanvasRenderingContext2D::CreatePattern(
}
EnsureTarget();
// The canvas spec says that createPattern should use the first frame
// of animated images
nsLayoutUtils::SurfaceFromElementResult res =
nsLayoutUtils::SurfaceFromElement(htmlElement,
- nsLayoutUtils::SFE_WANT_FIRST_FRAME, mTarget);
+ nsLayoutUtils::SFE_WANT_FIRST_FRAME_IF_IMAGE, mTarget);
if (!res.GetSourceSurface()) {
return nullptr;
}
RefPtr<CanvasPattern> pat = new CanvasPattern(this, res.GetSourceSurface(), repeatMode,
res.mPrincipal, res.mIsWriteOnly,
res.mCORSUsed);
--- a/dom/canvas/ImageBitmap.cpp
+++ b/dom/canvas/ImageBitmap.cpp
@@ -383,17 +383,17 @@ CheckSecurityForHTMLElements(const nsLay
* A wrapper to the nsLayoutUtils::SurfaceFromElement() function followed by the
* security checking.
*/
template<class HTMLElementType>
static already_AddRefed<SourceSurface>
GetSurfaceFromElement(nsIGlobalObject* aGlobal, HTMLElementType& aElement, ErrorResult& aRv)
{
nsLayoutUtils::SurfaceFromElementResult res =
- nsLayoutUtils::SurfaceFromElement(&aElement, nsLayoutUtils::SFE_WANT_FIRST_FRAME);
+ nsLayoutUtils::SurfaceFromElement(&aElement, nsLayoutUtils::SFE_WANT_FIRST_FRAME_IF_IMAGE);
// check origin-clean
if (!CheckSecurityForHTMLElements(res)) {
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
return nullptr;
}
RefPtr<SourceSurface> surface = res.GetSourceSurface();
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -7186,17 +7186,17 @@ nsLayoutUtils::SurfaceFromElement(nsIIma
nsCOMPtr<imgIContainer> imgContainer;
rv = imgRequest->GetImage(getter_AddRefs(imgContainer));
if (NS_FAILED(rv)) {
return result;
}
uint32_t noRasterize = aSurfaceFlags & SFE_NO_RASTERIZING_VECTORS;
- uint32_t whichFrame = (aSurfaceFlags & SFE_WANT_FIRST_FRAME)
+ uint32_t whichFrame = (aSurfaceFlags & SFE_WANT_FIRST_FRAME_IF_IMAGE)
? (uint32_t) imgIContainer::FRAME_FIRST
: (uint32_t) imgIContainer::FRAME_CURRENT;
uint32_t frameFlags = imgIContainer::FLAG_SYNC_DECODE
| imgIContainer::FLAG_ASYNC_NOTIFY;
if (aSurfaceFlags & SFE_NO_COLORSPACE_CONVERSION)
frameFlags |= imgIContainer::FLAG_DECODE_NO_COLORSPACE_CONVERSION;
if (aSurfaceFlags & SFE_PREFER_NO_PREMULTIPLY_ALPHA) {
frameFlags |= imgIContainer::FLAG_DECODE_NO_PREMULTIPLY_ALPHA;
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -2068,17 +2068,17 @@ public:
* forcing image surface, etc.).
*/
enum {
/* When creating a new surface, create an image surface */
SFE_WANT_IMAGE_SURFACE = 1 << 0,
/* Whether to extract the first frame (as opposed to the
current frame) in the case that the element is an image. */
- SFE_WANT_FIRST_FRAME = 1 << 1,
+ SFE_WANT_FIRST_FRAME_IF_IMAGE = 1 << 1,
/* Whether we should skip colorspace/gamma conversion */
SFE_NO_COLORSPACE_CONVERSION = 1 << 2,
/* Specifies that the caller wants unpremultiplied pixel data.
If this is can be done efficiently, the result will be a
DataSourceSurface and mIsPremultiplied with be set to false. */
SFE_PREFER_NO_PREMULTIPLY_ALPHA = 1 << 3,
/* Whether we should skip getting a surface for vector images and
return a DirectDrawInfo containing an imgIContainer instead. */