--- a/dom/canvas/CanvasRenderingContext2D.cpp
+++ b/dom/canvas/CanvasRenderingContext2D.cpp
@@ -5404,17 +5404,17 @@ CanvasRenderingContext2D::DrawDirectlyTo
CSSIntSize sz(scaledImageSize.width, scaledImageSize.height); // XXX hmm is scaledImageSize really in CSS pixels?
SVGImageContext svgContext(Some(sz));
auto result = aImage.mImgContainer->
Draw(context, scaledImageSize,
ImageRegion::Create(gfxRect(aSrc.x, aSrc.y, aSrc.width, aSrc.height)),
aImage.mWhichFrame, SamplingFilter::GOOD, Some(svgContext), modifiedFlags, CurrentState().globalAlpha);
- if (result != DrawResult::SUCCESS) {
+ if (result != ImgDrawResult::SUCCESS) {
NS_WARNING("imgIContainer::Draw failed");
}
}
void
CanvasRenderingContext2D::SetGlobalCompositeOperation(const nsAString& aOp,
ErrorResult& aError)
{
--- a/image/ClippedImage.cpp
+++ b/image/ClippedImage.cpp
@@ -38,17 +38,17 @@ namespace image {
class ClippedImageCachedSurface
{
public:
ClippedImageCachedSurface(already_AddRefed<SourceSurface> aSurface,
const nsIntSize& aSize,
const Maybe<SVGImageContext>& aSVGContext,
float aFrame,
uint32_t aFlags,
- DrawResult aDrawResult)
+ ImgDrawResult aDrawResult)
: mSurface(aSurface)
, mSize(aSize)
, mSVGContext(aSVGContext)
, mFrame(aFrame)
, mFlags(aFlags)
, mDrawResult(aDrawResult)
{
MOZ_ASSERT(mSurface, "Must have a valid surface");
@@ -66,51 +66,51 @@ public:
}
already_AddRefed<SourceSurface> Surface() const
{
RefPtr<SourceSurface> surf(mSurface);
return surf.forget();
}
- DrawResult GetDrawResult() const
+ ImgDrawResult GetDrawResult() const
{
return mDrawResult;
}
bool NeedsRedraw() const
{
- return mDrawResult != DrawResult::SUCCESS &&
- mDrawResult != DrawResult::BAD_IMAGE;
+ return mDrawResult != ImgDrawResult::SUCCESS &&
+ mDrawResult != ImgDrawResult::BAD_IMAGE;
}
private:
RefPtr<SourceSurface> mSurface;
const nsIntSize mSize;
Maybe<SVGImageContext> mSVGContext;
const float mFrame;
const uint32_t mFlags;
- const DrawResult mDrawResult;
+ const ImgDrawResult mDrawResult;
};
class DrawSingleTileCallback : public gfxDrawingCallback
{
public:
DrawSingleTileCallback(ClippedImage* aImage,
const nsIntSize& aSize,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aWhichFrame,
uint32_t aFlags,
float aOpacity)
: mImage(aImage)
, mSize(aSize)
, mSVGContext(aSVGContext)
, mWhichFrame(aWhichFrame)
, mFlags(aFlags)
- , mDrawResult(DrawResult::NOT_READY)
+ , mDrawResult(ImgDrawResult::NOT_READY)
, mOpacity(aOpacity)
{
MOZ_ASSERT(mImage, "Must have an image to clip");
}
virtual bool operator()(gfxContext* aContext,
const gfxRect& aFillRect,
const SamplingFilter aSamplingFilter,
@@ -125,25 +125,25 @@ public:
mDrawResult =
mImage->DrawSingleTile(aContext, mSize, ImageRegion::Create(aFillRect),
mWhichFrame, aSamplingFilter, mSVGContext, mFlags,
mOpacity);
return true;
}
- DrawResult GetDrawResult() { return mDrawResult; }
+ ImgDrawResult GetDrawResult() { return mDrawResult; }
private:
RefPtr<ClippedImage> mImage;
const nsIntSize mSize;
const Maybe<SVGImageContext>& mSVGContext;
const uint32_t mWhichFrame;
const uint32_t mFlags;
- DrawResult mDrawResult;
+ ImgDrawResult mDrawResult;
float mOpacity;
};
ClippedImage::ClippedImage(Image* aImage,
nsIntRect aClip,
const Maybe<nsSize>& aSVGViewportSize)
: ImageWrapper(aImage)
, mClip(aClip)
@@ -255,56 +255,56 @@ ClippedImage::GetIntrinsicRatio(nsSize*
*aRatio = nsSize(mClip.Width(), mClip.Height());
return NS_OK;
}
NS_IMETHODIMP_(already_AddRefed<SourceSurface>)
ClippedImage::GetFrame(uint32_t aWhichFrame,
uint32_t aFlags)
{
- DrawResult result;
+ ImgDrawResult result;
RefPtr<SourceSurface> surface;
Tie(result, surface) = GetFrameInternal(mClip.Size(), Nothing(), aWhichFrame, aFlags, 1.0);
return surface.forget();
}
NS_IMETHODIMP_(already_AddRefed<SourceSurface>)
ClippedImage::GetFrameAtSize(const IntSize& aSize,
uint32_t aWhichFrame,
uint32_t aFlags)
{
// XXX(seth): It'd be nice to support downscale-during-decode for this case,
// but right now we just fall back to the intrinsic size.
return GetFrame(aWhichFrame, aFlags);
}
-Pair<DrawResult, RefPtr<SourceSurface>>
+Pair<ImgDrawResult, RefPtr<SourceSurface>>
ClippedImage::GetFrameInternal(const nsIntSize& aSize,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aWhichFrame,
uint32_t aFlags,
float aOpacity)
{
if (!ShouldClip()) {
RefPtr<SourceSurface> surface = InnerImage()->GetFrame(aWhichFrame, aFlags);
- return MakePair(surface ? DrawResult::SUCCESS : DrawResult::NOT_READY,
+ return MakePair(surface ? ImgDrawResult::SUCCESS : ImgDrawResult::NOT_READY,
Move(surface));
}
float frameToDraw = InnerImage()->GetFrameIndex(aWhichFrame);
if (!mCachedSurface ||
!mCachedSurface->Matches(aSize, aSVGContext, frameToDraw, aFlags) ||
mCachedSurface->NeedsRedraw()) {
// Create a surface to draw into.
RefPtr<DrawTarget> target = gfxPlatform::GetPlatform()->
CreateOffscreenContentDrawTarget(IntSize(aSize.width, aSize.height),
SurfaceFormat::B8G8R8A8);
if (!target || !target->IsValid()) {
NS_ERROR("Could not create a DrawTarget");
- return MakePair(DrawResult::TEMPORARY_ERROR, RefPtr<SourceSurface>());
+ return MakePair(ImgDrawResult::TEMPORARY_ERROR, RefPtr<SourceSurface>());
}
RefPtr<gfxContext> ctx = gfxContext::CreateOrNull(target);
MOZ_ASSERT(ctx); // already checked the draw target above
// Create our callback.
RefPtr<DrawSingleTileCallback> drawTileCallback =
new DrawSingleTileCallback(this, aSize, aSVGContext, aWhichFrame, aFlags,
@@ -396,17 +396,17 @@ MustCreateSurface(gfxContext* aContext,
gfxRect imageRect(0, 0, aSize.width, aSize.height);
bool willTile = !imageRect.Contains(aRegion.Rect()) &&
!(aFlags & imgIContainer::FLAG_CLAMP);
bool willResample = aContext->CurrentMatrix().HasNonIntegerTranslation() &&
(willTile || !aRegion.RestrictionContains(imageRect));
return willTile || willResample;
}
-NS_IMETHODIMP_(DrawResult)
+NS_IMETHODIMP_(ImgDrawResult)
ClippedImage::Draw(gfxContext* aContext,
const nsIntSize& aSize,
const ImageRegion& aRegion,
uint32_t aWhichFrame,
SamplingFilter aSamplingFilter,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aFlags,
float aOpacity)
@@ -416,22 +416,22 @@ ClippedImage::Draw(gfxContext* aContext,
aSamplingFilter, aSVGContext, aFlags, aOpacity);
}
// Check for tiling. If we need to tile then we need to create a
// gfxCallbackDrawable to handle drawing for us.
if (MustCreateSurface(aContext, aSize, aRegion, aFlags)) {
// Create a temporary surface containing a single tile of this image.
// GetFrame will call DrawSingleTile internally.
- DrawResult result;
+ ImgDrawResult result;
RefPtr<SourceSurface> surface;
Tie(result, surface) =
GetFrameInternal(aSize, aSVGContext, aWhichFrame, aFlags, aOpacity);
if (!surface) {
- MOZ_ASSERT(result != DrawResult::SUCCESS);
+ MOZ_ASSERT(result != ImgDrawResult::SUCCESS);
return result;
}
// Create a drawable from that surface.
RefPtr<gfxSurfaceDrawable> drawable =
new gfxSurfaceDrawable(surface, aSize);
// Draw.
@@ -441,17 +441,17 @@ ClippedImage::Draw(gfxContext* aContext,
return result;
}
return DrawSingleTile(aContext, aSize, aRegion, aWhichFrame,
aSamplingFilter, aSVGContext, aFlags, aOpacity);
}
-DrawResult
+ImgDrawResult
ClippedImage::DrawSingleTile(gfxContext* aContext,
const nsIntSize& aSize,
const ImageRegion& aRegion,
uint32_t aWhichFrame,
SamplingFilter aSamplingFilter,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aFlags,
float aOpacity)
--- a/image/ClippedImage.h
+++ b/image/ClippedImage.h
@@ -51,17 +51,17 @@ public:
IsImageContainerAvailableAtSize(layers::LayerManager* aManager,
const gfx::IntSize& aSize,
uint32_t aFlags) override;
NS_IMETHOD_(already_AddRefed<layers::ImageContainer>)
GetImageContainerAtSize(layers::LayerManager* aManager,
const gfx::IntSize& aSize,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aFlags) override;
- NS_IMETHOD_(DrawResult) Draw(gfxContext* aContext,
+ NS_IMETHOD_(ImgDrawResult) Draw(gfxContext* aContext,
const nsIntSize& aSize,
const ImageRegion& aRegion,
uint32_t aWhichFrame,
gfx::SamplingFilter aSamplingFilter,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aFlags,
float aOpacity) override;
NS_IMETHOD RequestDiscard() override;
@@ -75,24 +75,24 @@ public:
protected:
ClippedImage(Image* aImage, nsIntRect aClip,
const Maybe<nsSize>& aSVGViewportSize);
virtual ~ClippedImage();
private:
- Pair<DrawResult, RefPtr<SourceSurface>>
+ Pair<ImgDrawResult, RefPtr<SourceSurface>>
GetFrameInternal(const nsIntSize& aSize,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aWhichFrame,
uint32_t aFlags,
float aOpacity);
bool ShouldClip();
- DrawResult DrawSingleTile(gfxContext* aContext,
+ ImgDrawResult DrawSingleTile(gfxContext* aContext,
const nsIntSize& aSize,
const ImageRegion& aRegion,
uint32_t aWhichFrame,
gfx::SamplingFilter aSamplingFilter,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aFlags,
float aOpacity);
--- a/image/DynamicImage.cpp
+++ b/image/DynamicImage.cpp
@@ -200,17 +200,17 @@ DynamicImage::GetFrameAtSize(const IntSi
}
RefPtr<gfxContext> context = gfxContext::CreateOrNull(dt);
MOZ_ASSERT(context); // already checked the draw target above
auto result = Draw(context, aSize, ImageRegion::Create(aSize),
aWhichFrame, SamplingFilter::POINT, Nothing(), aFlags,
1.0);
- return result == DrawResult::SUCCESS ? dt->Snapshot() : nullptr;
+ return result == ImgDrawResult::SUCCESS ? dt->Snapshot() : nullptr;
}
NS_IMETHODIMP_(bool)
DynamicImage::WillDrawOpaqueNow()
{
return false;
}
@@ -238,17 +238,17 @@ NS_IMETHODIMP_(already_AddRefed<ImageCon
DynamicImage::GetImageContainerAtSize(LayerManager* aManager,
const IntSize& aSize,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aFlags)
{
return nullptr;
}
-NS_IMETHODIMP_(DrawResult)
+NS_IMETHODIMP_(ImgDrawResult)
DynamicImage::Draw(gfxContext* aContext,
const nsIntSize& aSize,
const ImageRegion& aRegion,
uint32_t aWhichFrame,
SamplingFilter aSamplingFilter,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aFlags,
float aOpacity)
@@ -256,32 +256,32 @@ DynamicImage::Draw(gfxContext* aContext,
MOZ_ASSERT(!aSize.IsEmpty(), "Unexpected empty size");
IntSize drawableSize(mDrawable->Size());
if (aSize == drawableSize) {
gfxUtils::DrawPixelSnapped(aContext, mDrawable, SizeDouble(drawableSize), aRegion,
SurfaceFormat::B8G8R8A8, aSamplingFilter,
aOpacity);
- return DrawResult::SUCCESS;
+ return ImgDrawResult::SUCCESS;
}
gfxSize scale(double(aSize.width) / drawableSize.width,
double(aSize.height) / drawableSize.height);
ImageRegion region(aRegion);
region.Scale(1.0 / scale.width, 1.0 / scale.height);
gfxContextMatrixAutoSaveRestore saveMatrix(aContext);
aContext->Multiply(gfxMatrix::Scaling(scale.width, scale.height));
gfxUtils::DrawPixelSnapped(aContext, mDrawable, SizeDouble(drawableSize), region,
SurfaceFormat::B8G8R8A8, aSamplingFilter,
aOpacity);
- return DrawResult::SUCCESS;
+ return ImgDrawResult::SUCCESS;
}
NS_IMETHODIMP
DynamicImage::StartDecoding(uint32_t aFlags)
{
return NS_OK;
}
--- a/image/FrozenImage.cpp
+++ b/image/FrozenImage.cpp
@@ -88,17 +88,17 @@ FrozenImage::GetImageContainerAtSize(lay
// XXX(seth): GetImageContainer does not currently support anything but the
// current frame. We work around this by always returning null, but if it ever
// turns out that FrozenImage is widely used on codepaths that can actually
// benefit from GetImageContainer, it would be a good idea to fix that method
// for performance reasons.
return nullptr;
}
-NS_IMETHODIMP_(DrawResult)
+NS_IMETHODIMP_(ImgDrawResult)
FrozenImage::Draw(gfxContext* aContext,
const nsIntSize& aSize,
const ImageRegion& aRegion,
uint32_t /* aWhichFrame - ignored */,
SamplingFilter aSamplingFilter,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aFlags,
float aOpacity)
--- a/image/FrozenImage.h
+++ b/image/FrozenImage.h
@@ -50,17 +50,17 @@ public:
IsImageContainerAvailableAtSize(layers::LayerManager* aManager,
const gfx::IntSize& aSize,
uint32_t aFlags) override;
NS_IMETHOD_(already_AddRefed<layers::ImageContainer>)
GetImageContainerAtSize(layers::LayerManager* aManager,
const gfx::IntSize& aSize,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aFlags) override;
- NS_IMETHOD_(DrawResult) Draw(gfxContext* aContext,
+ NS_IMETHOD_(ImgDrawResult) Draw(gfxContext* aContext,
const nsIntSize& aSize,
const ImageRegion& aRegion,
uint32_t aWhichFrame,
gfx::SamplingFilter aSamplingFilter,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aFlags,
float aOpacity) override;
NS_IMETHOD_(void) RequestRefresh(const TimeStamp& aTime) override;
--- a/image/Image.cpp
+++ b/image/Image.cpp
@@ -131,38 +131,38 @@ ImageResource::GetImageContainerImpl(Lay
// It isn't a match, but still valid. Forget the container so we don't
// try to reuse it below.
container = nullptr;
}
}
if (container) {
switch (entry->mLastDrawResult) {
- case DrawResult::SUCCESS:
- case DrawResult::BAD_IMAGE:
- case DrawResult::BAD_ARGS:
+ case ImgDrawResult::SUCCESS:
+ case ImgDrawResult::BAD_IMAGE:
+ case ImgDrawResult::BAD_ARGS:
return container.forget();
- case DrawResult::NOT_READY:
- case DrawResult::INCOMPLETE:
- case DrawResult::TEMPORARY_ERROR:
+ case ImgDrawResult::NOT_READY:
+ case ImgDrawResult::INCOMPLETE:
+ case ImgDrawResult::TEMPORARY_ERROR:
// Temporary conditions where we need to rerequest the frame to recover.
break;
- case DrawResult::WRONG_SIZE:
+ case ImgDrawResult::WRONG_SIZE:
// Unused by GetFrameInternal
default:
- MOZ_ASSERT_UNREACHABLE("Unhandled DrawResult type!");
+ MOZ_ASSERT_UNREACHABLE("Unhandled ImgDrawResult type!");
return container.forget();
}
}
#ifdef DEBUG
NotifyDrawingObservers();
#endif
- DrawResult drawResult;
+ ImgDrawResult drawResult;
IntSize bestSize;
RefPtr<SourceSurface> surface;
Tie(drawResult, bestSize, surface) =
GetFrameInternal(size, aSVGContext, FRAME_CURRENT,
aFlags | FLAG_ASYNC_NOTIFY);
// The requested size might be refused by the surface cache (i.e. due to
// factor-of-2 mode). In that case we don't want to create an entry for this
@@ -188,27 +188,27 @@ ImageResource::GetImageContainerImpl(Lay
i = mImageContainers.Length() - 1;
for (; i >= 0; --i) {
entry = &mImageContainers[i];
if (bestSize == entry->mSize && flags == entry->mFlags &&
aSVGContext == entry->mSVGContext) {
container = entry->mContainer.get();
if (container) {
switch (entry->mLastDrawResult) {
- case DrawResult::SUCCESS:
- case DrawResult::BAD_IMAGE:
- case DrawResult::BAD_ARGS:
+ case ImgDrawResult::SUCCESS:
+ case ImgDrawResult::BAD_IMAGE:
+ case ImgDrawResult::BAD_ARGS:
return container.forget();
- case DrawResult::NOT_READY:
- case DrawResult::INCOMPLETE:
- case DrawResult::TEMPORARY_ERROR:
+ case ImgDrawResult::NOT_READY:
+ case ImgDrawResult::INCOMPLETE:
+ case ImgDrawResult::TEMPORARY_ERROR:
// Temporary conditions where we need to rerequest the frame to
// recover. We have already done so!
break;
- case DrawResult::WRONG_SIZE:
+ case ImgDrawResult::WRONG_SIZE:
// Unused by GetFrameInternal
default:
MOZ_ASSERT_UNREACHABLE("Unhandled DrawResult type!");
return container.forget();
}
}
break;
}
--- a/image/Image.h
+++ b/image/Image.h
@@ -332,23 +332,23 @@ protected:
TimeStamp mLastRefreshTime;
uint64_t mInnerWindowId;
uint32_t mAnimationConsumers;
uint16_t mAnimationMode; // Enum values in imgIContainer
bool mInitialized:1; // Have we been initalized?
bool mAnimating:1; // Are we currently animating?
bool mError:1; // Error handling
- virtual Tuple<DrawResult, gfx::IntSize, RefPtr<gfx::SourceSurface>>
+ virtual Tuple<ImgDrawResult, gfx::IntSize, RefPtr<gfx::SourceSurface>>
GetFrameInternal(const gfx::IntSize& aSize,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aWhichFrame,
uint32_t aFlags)
{
- return MakeTuple(DrawResult::BAD_IMAGE, aSize,
+ return MakeTuple(ImgDrawResult::BAD_IMAGE, aSize,
RefPtr<gfx::SourceSurface>());
}
/**
* Calculate the estimated size to use for an image container with the given
* parameters. It may not be the same as the given size, and it may not be
* the same as the size of the surface in the image container, but it is the
* best effort estimate.
@@ -378,28 +378,28 @@ private:
struct ImageContainerEntry {
ImageContainerEntry(const gfx::IntSize& aSize,
const Maybe<SVGImageContext>& aSVGContext,
layers::ImageContainer* aContainer,
uint32_t aFlags)
: mSize(aSize)
, mSVGContext(aSVGContext)
, mContainer(aContainer)
- , mLastDrawResult(DrawResult::NOT_READY)
+ , mLastDrawResult(ImgDrawResult::NOT_READY)
, mFlags(aFlags)
{ }
gfx::IntSize mSize;
Maybe<SVGImageContext> mSVGContext;
// A weak pointer to our ImageContainer, which stays alive only as long as
// the layer system needs it.
WeakPtr<layers::ImageContainer> mContainer;
- // If mContainer is non-null, this contains the DrawResult we obtained
+ // If mContainer is non-null, this contains the ImgDrawResult we obtained
// the last time we updated it.
- DrawResult mLastDrawResult;
+ ImgDrawResult mLastDrawResult;
// Cached flags to use for decoding. FLAG_ASYNC_NOTIFY should always be set
// but FLAG_HIGH_QUALITY_SCALING may vary.
uint32_t mFlags;
};
AutoTArray<ImageContainerEntry, 1> mImageContainers;
layers::ImageContainer::ProducerID mImageProducerID;
layers::ImageContainer::FrameID mLastFrameID;
--- a/image/ImageWrapper.cpp
+++ b/image/ImageWrapper.cpp
@@ -227,17 +227,17 @@ ImageWrapper::GetImageContainerAtSize(La
const IntSize& aSize,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aFlags)
{
return mInnerImage->GetImageContainerAtSize(aManager, aSize,
aSVGContext, aFlags);
}
-NS_IMETHODIMP_(DrawResult)
+NS_IMETHODIMP_(ImgDrawResult)
ImageWrapper::Draw(gfxContext* aContext,
const nsIntSize& aSize,
const ImageRegion& aRegion,
uint32_t aWhichFrame,
SamplingFilter aSamplingFilter,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aFlags,
float aOpacity)
rename from image/DrawResult.h
rename to image/ImgDrawResult.h
--- a/image/DrawResult.h
+++ b/image/ImgDrawResult.h
@@ -1,27 +1,27 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#ifndef mozilla_image_DrawResult_h
-#define mozilla_image_DrawResult_h
+#ifndef mozilla_image_ImgDrawResult_h
+#define mozilla_image_ImgDrawResult_h
#include <cstdint> // for uint8_t
#include "mozilla/Attributes.h"
#include "mozilla/Likely.h"
namespace mozilla {
namespace image {
/**
* An enumeration representing the result of a drawing operation.
*
- * Most users of DrawResult will only be interested in whether the value is
+ * Most users of ImgDrawResult will only be interested in whether the value is
* SUCCESS or not. The other values are primarily useful for debugging and error
* handling.
*
* SUCCESS: We successfully drew a completely decoded frame of the requested
* size. Drawing again with FLAG_SYNC_DECODE would not change the result.
*
* INCOMPLETE: We successfully drew a frame that was partially decoded. (Note
* that successfully drawing a partially decoded frame may not actually draw any
@@ -41,66 +41,66 @@ namespace image {
* TEMPORARY_ERROR: We failed to draw due to a temporary error. Drawing may
* succeed at a later time.
*
* BAD_IMAGE: We failed to draw because the image has an error. This is a
* permanent condition.
*
* BAD_ARGS: We failed to draw because bad arguments were passed to draw().
*/
-enum class MOZ_MUST_USE_TYPE DrawResult : uint8_t
+enum class MOZ_MUST_USE_TYPE ImgDrawResult : uint8_t
{
SUCCESS,
INCOMPLETE,
WRONG_SIZE,
NOT_READY,
TEMPORARY_ERROR,
BAD_IMAGE,
BAD_ARGS
};
/**
- * You can combine DrawResults with &. By analogy to bitwise-&, the result is
- * DrawResult::SUCCESS only if both operands are DrawResult::SUCCESS. Otherwise,
- * a failing DrawResult is returned; we favor the left operand's failure when
+ * You can combine ImgDrawResults with &. By analogy to bitwise-&, the result is
+ * ImgDrawResult::SUCCESS only if both operands are ImgDrawResult::SUCCESS. Otherwise,
+ * a failing ImgDrawResult is returned; we favor the left operand's failure when
* deciding which failure to return, with the exception that we always prefer
- * any other kind of failure over DrawResult::BAD_IMAGE, since other failures
+ * any other kind of failure over ImgDrawResult::BAD_IMAGE, since other failures
* are recoverable and we want to know if any recoverable failures occurred.
*/
-inline DrawResult
-operator&(const DrawResult aLeft, const DrawResult aRight)
+inline ImgDrawResult
+operator&(const ImgDrawResult aLeft, const ImgDrawResult aRight)
{
- if (MOZ_LIKELY(aLeft == DrawResult::SUCCESS)) {
+ if (MOZ_LIKELY(aLeft == ImgDrawResult::SUCCESS)) {
return aRight;
}
- if (aLeft == DrawResult::BAD_IMAGE && aRight != DrawResult::SUCCESS) {
+ if (aLeft == ImgDrawResult::BAD_IMAGE && aRight != ImgDrawResult::SUCCESS) {
return aRight;
}
return aLeft;
}
-inline DrawResult&
-operator&=(DrawResult& aLeft, const DrawResult aRight)
+inline ImgDrawResult&
+operator&=(ImgDrawResult& aLeft, const ImgDrawResult aRight)
{
aLeft = aLeft & aRight;
return aLeft;
}
/**
* A struct used during painting to provide input flags to determine how
- * imagelib draw calls should behave and an output DrawResult to return
+ * imagelib draw calls should behave and an output ImgDrawResult to return
* information about the result of any imagelib draw calls that may have
* occurred.
*/
struct imgDrawingParams {
explicit imgDrawingParams(uint32_t aImageFlags = 0)
- : imageFlags(aImageFlags), result(DrawResult::SUCCESS)
+ : imageFlags(aImageFlags), result(ImgDrawResult::SUCCESS)
{}
const uint32_t imageFlags; // imgIContainer::FLAG_* image flags to pass to
// image lib draw calls.
- DrawResult result; // To return results from image lib painting.
+ ImgDrawResult result; // To return results from image lib painting.
};
} // namespace image
} // namespace mozilla
-#endif // mozilla_image_DrawResult_h
+#endif // mozilla_image_ImgDrawResult_h
--- a/image/OrientedImage.cpp
+++ b/image/OrientedImage.cpp
@@ -298,17 +298,17 @@ OrientedImage::OrientationMatrix(const n
break;
default:
MOZ_ASSERT(false, "Invalid rotation value");
}
return builder.Build();
}
-NS_IMETHODIMP_(DrawResult)
+NS_IMETHODIMP_(ImgDrawResult)
OrientedImage::Draw(gfxContext* aContext,
const nsIntSize& aSize,
const ImageRegion& aRegion,
uint32_t aWhichFrame,
SamplingFilter aSamplingFilter,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aFlags,
float aOpacity)
--- a/image/OrientedImage.h
+++ b/image/OrientedImage.h
@@ -48,17 +48,17 @@ public:
IsImageContainerAvailableAtSize(layers::LayerManager* aManager,
const gfx::IntSize& aSize,
uint32_t aFlags) override;
NS_IMETHOD_(already_AddRefed<layers::ImageContainer>)
GetImageContainerAtSize(layers::LayerManager* aManager,
const gfx::IntSize& aSize,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aFlags) override;
- NS_IMETHOD_(DrawResult) Draw(gfxContext* aContext,
+ NS_IMETHOD_(ImgDrawResult) Draw(gfxContext* aContext,
const nsIntSize& aSize,
const ImageRegion& aRegion,
uint32_t aWhichFrame,
gfx::SamplingFilter aSamplingFilter,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aFlags,
float aOpacity) override;
NS_IMETHOD_(nsIntRect) GetImageSpaceInvalidationRect(
--- a/image/RasterImage.cpp
+++ b/image/RasterImage.cpp
@@ -580,31 +580,31 @@ RasterImage::GetFrameAtSize(const IntSiz
RefPtr<SourceSurface> surf = mozilla::Get<2>(result).forget();
// If we are here, it suggests the image is embedded in a canvas or some
// other path besides layers, and we won't need the file handle.
MarkSurfaceShared(surf);
return surf.forget();
}
-Tuple<DrawResult, IntSize, RefPtr<SourceSurface>>
+Tuple<ImgDrawResult, IntSize, RefPtr<SourceSurface>>
RasterImage::GetFrameInternal(const IntSize& aSize,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aWhichFrame,
uint32_t aFlags)
{
MOZ_ASSERT(aWhichFrame <= FRAME_MAX_VALUE);
if (aSize.IsEmpty() || aWhichFrame > FRAME_MAX_VALUE) {
- return MakeTuple(DrawResult::BAD_ARGS, aSize,
+ return MakeTuple(ImgDrawResult::BAD_ARGS, aSize,
RefPtr<SourceSurface>());
}
if (mError) {
- return MakeTuple(DrawResult::BAD_IMAGE, aSize,
+ return MakeTuple(ImgDrawResult::BAD_IMAGE, aSize,
RefPtr<SourceSurface>());
}
// Get the frame. If it's not there, it's probably the caller's fault for
// not waiting for the data to be loaded from the network or not passing
// FLAG_SYNC_DECODE.
LookupResult result =
LookupFrame(aSize, aFlags, ToPlaybackType(aWhichFrame));
@@ -614,26 +614,26 @@ RasterImage::GetFrameInternal(const IntS
// actual surface, depending on what it has in its cache.
IntSize suggestedSize = result.SuggestedSize().IsEmpty()
? aSize : result.SuggestedSize();
MOZ_ASSERT_IF(result.Type() == MatchType::SUBSTITUTE_BECAUSE_BEST,
suggestedSize != aSize);
if (!result) {
// The OS threw this frame away and we couldn't redecode it.
- return MakeTuple(DrawResult::TEMPORARY_ERROR, suggestedSize,
+ return MakeTuple(ImgDrawResult::TEMPORARY_ERROR, suggestedSize,
RefPtr<SourceSurface>());
}
RefPtr<SourceSurface> surface = result.Surface()->GetSourceSurface();
if (!result.Surface()->IsFinished()) {
- return MakeTuple(DrawResult::INCOMPLETE, suggestedSize, Move(surface));
+ return MakeTuple(ImgDrawResult::INCOMPLETE, suggestedSize, Move(surface));
}
- return MakeTuple(DrawResult::SUCCESS, suggestedSize, Move(surface));
+ return MakeTuple(ImgDrawResult::SUCCESS, suggestedSize, Move(surface));
}
IntSize
RasterImage::GetImageContainerSize(LayerManager* aManager,
const IntSize& aSize,
uint32_t aFlags)
{
if (!IsImageContainerAvailableAtSize(aManager, aSize, aFlags)) {
@@ -1371,17 +1371,17 @@ RasterImage::CanDownscaleDuringDecode(co
// There's no point in scaling if we can't store the result.
if (!SurfaceCache::CanHold(aSize)) {
return false;
}
return true;
}
-DrawResult
+ImgDrawResult
RasterImage::DrawInternal(DrawableSurface&& aSurface,
gfxContext* aContext,
const IntSize& aSize,
const ImageRegion& aRegion,
SamplingFilter aSamplingFilter,
uint32_t aFlags,
float aOpacity)
{
@@ -1403,55 +1403,55 @@ RasterImage::DrawInternal(DrawableSurfac
aContext->Multiply(gfxMatrix::Scaling(scale.width, scale.height));
region.Scale(1.0 / scale.width, 1.0 / scale.height);
couldRedecodeForBetterFrame = CanDownscaleDuringDecode(aSize, aFlags);
}
if (!aSurface->Draw(aContext, region, aSamplingFilter, aFlags, aOpacity)) {
RecoverFromInvalidFrames(aSize, aFlags);
- return DrawResult::TEMPORARY_ERROR;
+ return ImgDrawResult::TEMPORARY_ERROR;
}
if (!frameIsFinished) {
- return DrawResult::INCOMPLETE;
+ return ImgDrawResult::INCOMPLETE;
}
if (couldRedecodeForBetterFrame) {
- return DrawResult::WRONG_SIZE;
+ return ImgDrawResult::WRONG_SIZE;
}
- return DrawResult::SUCCESS;
+ return ImgDrawResult::SUCCESS;
}
//******************************************************************************
-NS_IMETHODIMP_(DrawResult)
+NS_IMETHODIMP_(ImgDrawResult)
RasterImage::Draw(gfxContext* aContext,
const IntSize& aSize,
const ImageRegion& aRegion,
uint32_t aWhichFrame,
SamplingFilter aSamplingFilter,
const Maybe<SVGImageContext>& /*aSVGContext - ignored*/,
uint32_t aFlags,
float aOpacity)
{
if (aWhichFrame > FRAME_MAX_VALUE) {
- return DrawResult::BAD_ARGS;
+ return ImgDrawResult::BAD_ARGS;
}
if (mError) {
- return DrawResult::BAD_IMAGE;
+ return ImgDrawResult::BAD_IMAGE;
}
// Illegal -- you can't draw with non-default decode flags.
// (Disabling colorspace conversion might make sense to allow, but
// we don't currently.)
if (ToSurfaceFlags(aFlags) != DefaultSurfaceFlags()) {
- return DrawResult::BAD_ARGS;
+ return ImgDrawResult::BAD_ARGS;
}
if (!aContext) {
- return DrawResult::BAD_ARGS;
+ return ImgDrawResult::BAD_ARGS;
}
if (mAnimationConsumers == 0) {
SendOnUnlockedDraw(aFlags);
}
// If we're not using SamplingFilter::GOOD, we shouldn't high-quality scale or
@@ -1462,17 +1462,17 @@ RasterImage::Draw(gfxContext* aContext,
LookupResult result =
LookupFrame(aSize, flags, ToPlaybackType(aWhichFrame));
if (!result) {
// Getting the frame (above) touches the image and kicks off decoding.
if (mDrawStartTime.IsNull()) {
mDrawStartTime = TimeStamp::Now();
}
- return DrawResult::NOT_READY;
+ return ImgDrawResult::NOT_READY;
}
bool shouldRecordTelemetry = !mDrawStartTime.IsNull() &&
result.Surface()->IsFinished();
auto drawResult = DrawInternal(Move(result.Surface()), aContext, aSize,
aRegion, aSamplingFilter, flags, aOpacity);
--- a/image/RasterImage.h
+++ b/image/RasterImage.h
@@ -294,25 +294,25 @@ private:
uint32_t aFlags,
PlaybackType aPlaybackType);
/// Helper method for LookupFrame().
LookupResult LookupFrameInternal(const gfx::IntSize& aSize,
uint32_t aFlags,
PlaybackType aPlaybackType);
- DrawResult DrawInternal(DrawableSurface&& aFrameRef,
+ ImgDrawResult DrawInternal(DrawableSurface&& aFrameRef,
gfxContext* aContext,
const nsIntSize& aSize,
const ImageRegion& aRegion,
gfx::SamplingFilter aSamplingFilter,
uint32_t aFlags,
float aOpacity);
- Tuple<DrawResult, gfx::IntSize, RefPtr<gfx::SourceSurface>>
+ Tuple<ImgDrawResult, gfx::IntSize, RefPtr<gfx::SourceSurface>>
GetFrameInternal(const gfx::IntSize& aSize,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aWhichFrame,
uint32_t aFlags) override;
gfx::IntSize GetImageContainerSize(layers::LayerManager* aManager,
const gfx::IntSize& aSize,
uint32_t aFlags) override;
--- a/image/VectorImage.cpp
+++ b/image/VectorImage.cpp
@@ -779,48 +779,48 @@ VectorImage::GetFrameAtSize(const IntSiz
RefPtr<SourceSurface> surf = Get<2>(result).forget();
// If we are here, it suggests the image is embedded in a canvas or some
// other path besides layers, and we won't need the file handle.
MarkSurfaceShared(surf);
return surf.forget();
}
-Tuple<DrawResult, IntSize, RefPtr<SourceSurface>>
+Tuple<ImgDrawResult, IntSize, RefPtr<SourceSurface>>
VectorImage::GetFrameInternal(const IntSize& aSize,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aWhichFrame,
uint32_t aFlags)
{
MOZ_ASSERT(aWhichFrame <= FRAME_MAX_VALUE);
if (aSize.IsEmpty() || aWhichFrame > FRAME_MAX_VALUE) {
- return MakeTuple(DrawResult::BAD_ARGS, aSize,
+ return MakeTuple(ImgDrawResult::BAD_ARGS, aSize,
RefPtr<SourceSurface>());
}
if (mError) {
- return MakeTuple(DrawResult::BAD_IMAGE, aSize,
+ return MakeTuple(ImgDrawResult::BAD_IMAGE, aSize,
RefPtr<SourceSurface>());
}
if (!mIsFullyLoaded) {
- return MakeTuple(DrawResult::NOT_READY, aSize,
+ return MakeTuple(ImgDrawResult::NOT_READY, aSize,
RefPtr<SourceSurface>());
}
RefPtr<SourceSurface> sourceSurface =
LookupCachedSurface(aSize, aSVGContext, aFlags);
if (sourceSurface) {
- return MakeTuple(DrawResult::SUCCESS, aSize, Move(sourceSurface));
+ return MakeTuple(ImgDrawResult::SUCCESS, aSize, Move(sourceSurface));
}
if (mIsDrawing) {
NS_WARNING("Refusing to make re-entrant call to VectorImage::Draw");
- return MakeTuple(DrawResult::TEMPORARY_ERROR, aSize,
+ return MakeTuple(ImgDrawResult::TEMPORARY_ERROR, aSize,
RefPtr<SourceSurface>());
}
// By using a null gfxContext, we ensure that we will always attempt to
// create a surface, even if we aren't capable of caching it (e.g. due to our
// flags, having an animation, etc). Otherwise CreateSurface will assume that
// the caller is capable of drawing directly to its own draw target if we
// cannot cache.
@@ -835,22 +835,22 @@ VectorImage::GetFrameInternal(const IntS
AutoRestoreSVGState autoRestore(params, mSVGDocumentWrapper,
mIsDrawing, contextPaint);
RefPtr<gfxDrawable> svgDrawable = CreateSVGDrawable(params);
RefPtr<SourceSurface> surface =
CreateSurface(params, svgDrawable, didCache);
if (!surface) {
MOZ_ASSERT(!didCache);
- return MakeTuple(DrawResult::TEMPORARY_ERROR, aSize,
+ return MakeTuple(ImgDrawResult::TEMPORARY_ERROR, aSize,
RefPtr<SourceSurface>());
}
SendFrameComplete(didCache, params.flags);
- return MakeTuple(DrawResult::SUCCESS, aSize, Move(surface));
+ return MakeTuple(ImgDrawResult::SUCCESS, aSize, Move(surface));
}
//******************************************************************************
IntSize
VectorImage::GetImageContainerSize(LayerManager* aManager,
const IntSize& aSize,
uint32_t aFlags)
{
@@ -950,40 +950,40 @@ VectorImage::MaybeRestrictSVGContext(May
aNewSVGContext->ClearContextPaint();
}
}
return haveContextPaint && !blockContextPaint;
}
//******************************************************************************
-NS_IMETHODIMP_(DrawResult)
+NS_IMETHODIMP_(ImgDrawResult)
VectorImage::Draw(gfxContext* aContext,
const nsIntSize& aSize,
const ImageRegion& aRegion,
uint32_t aWhichFrame,
SamplingFilter aSamplingFilter,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aFlags,
float aOpacity)
{
if (aWhichFrame > FRAME_MAX_VALUE) {
- return DrawResult::BAD_ARGS;
+ return ImgDrawResult::BAD_ARGS;
}
if (!aContext) {
- return DrawResult::BAD_ARGS;
+ return ImgDrawResult::BAD_ARGS;
}
if (mError) {
- return DrawResult::BAD_IMAGE;
+ return ImgDrawResult::BAD_IMAGE;
}
if (!mIsFullyLoaded) {
- return DrawResult::NOT_READY;
+ return ImgDrawResult::NOT_READY;
}
if (mAnimationConsumers == 0) {
SendOnUnlockedDraw(aFlags);
}
// We should always bypass the cache when using DrawTargetRecording because
// we prefer the drawing commands in general to the rasterized surface. This
@@ -1011,47 +1011,47 @@ VectorImage::Draw(gfxContext* aContext,
// If we have an prerasterized version of this image that matches the
// drawing parameters, use that.
RefPtr<SourceSurface> sourceSurface =
LookupCachedSurface(aSize, params.svgContext, aFlags);
if (sourceSurface) {
RefPtr<gfxDrawable> svgDrawable =
new gfxSurfaceDrawable(sourceSurface, sourceSurface->GetSize());
Show(svgDrawable, params);
- return DrawResult::SUCCESS;
+ return ImgDrawResult::SUCCESS;
}
// else, we need to paint the image:
if (mIsDrawing) {
NS_WARNING("Refusing to make re-entrant call to VectorImage::Draw");
- return DrawResult::TEMPORARY_ERROR;
+ return ImgDrawResult::TEMPORARY_ERROR;
}
AutoRestoreSVGState autoRestore(params, mSVGDocumentWrapper,
mIsDrawing, contextPaint);
bool didCache; // Was the surface put into the cache?
RefPtr<gfxDrawable> svgDrawable = CreateSVGDrawable(params);
sourceSurface = CreateSurface(params, svgDrawable, didCache);
if (!sourceSurface) {
MOZ_ASSERT(!didCache);
Show(svgDrawable, params);
- return DrawResult::SUCCESS;
+ return ImgDrawResult::SUCCESS;
}
RefPtr<gfxDrawable> drawable =
new gfxSurfaceDrawable(sourceSurface, params.size);
Show(drawable, params);
SendFrameComplete(didCache, params.flags);
// Image got put into a painted layer, it will not be shared with another
// process.
MarkSurfaceShared(sourceSurface);
- return DrawResult::SUCCESS;
+ return ImgDrawResult::SUCCESS;
}
already_AddRefed<gfxDrawable>
VectorImage::CreateSVGDrawable(const SVGDrawingParameters& aParams)
{
RefPtr<gfxDrawingCallback> cb =
new SVGDrawingCallback(mSVGDocumentWrapper,
aParams.viewportSize,
--- a/image/VectorImage.h
+++ b/image/VectorImage.h
@@ -76,17 +76,17 @@ protected:
explicit VectorImage(ImageURL* aURI = nullptr);
virtual ~VectorImage();
virtual nsresult StartAnimation() override;
virtual nsresult StopAnimation() override;
virtual bool ShouldAnimate() override;
private:
- Tuple<DrawResult, IntSize, RefPtr<SourceSurface>>
+ Tuple<ImgDrawResult, IntSize, RefPtr<SourceSurface>>
GetFrameInternal(const IntSize& aSize,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aWhichFrame,
uint32_t aFlags) override;
IntSize GetImageContainerSize(layers::LayerManager* aManager,
const IntSize& aSize,
uint32_t aFlags) override;
--- a/image/imgIContainer.idl
+++ b/image/imgIContainer.idl
@@ -2,17 +2,17 @@
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
%{C++
-#include "DrawResult.h"
+#include "ImgDrawResult.h"
#include "gfxContext.h"
#include "gfxMatrix.h"
#include "gfxRect.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/Maybe.h"
#include "mozilla/RefPtr.h"
#include "nsRect.h"
#include "nsSize.h"
@@ -40,17 +40,17 @@ namespace image {
class ImageRegion;
struct Orientation;
}
}
%}
-native DrawResult(mozilla::image::DrawResult);
+native ImgDrawResult(mozilla::image::ImgDrawResult);
[ptr] native gfxContext(gfxContext);
[ref] native gfxMatrix(gfxMatrix);
[ref] native gfxRect(gfxRect);
[ref] native gfxSize(gfxSize);
native SamplingFilter(mozilla::gfx::SamplingFilter);
[ref] native nsIntRect(nsIntRect);
native nsIntRectByVal(nsIntRect);
[ref] native nsIntSize(nsIntSize);
@@ -427,20 +427,20 @@ interface imgIContainer : nsISupports
* snapping.
* @param aWhichFrame Frame specifier of the FRAME_* variety.
* @param aSamplingFilter The filter to be used if we're scaling the image.
* @param aSVGContext If specified, SVG-related rendering context, such as
* overridden attributes on the image document's root <svg>
* node, and the size of the viewport that the full image
* would occupy. Ignored for raster images.
* @param aFlags Flags of the FLAG_* variety
- * @return A DrawResult value indicating whether and to what degree the
+ * @return A ImgDrawResult value indicating whether and to what degree the
* drawing operation was successful.
*/
- [noscript, notxpcom] DrawResult
+ [noscript, notxpcom] ImgDrawResult
draw(in gfxContext aContext,
[const] in nsIntSize aSize,
[const] in ImageRegion aRegion,
in uint32_t aWhichFrame,
in SamplingFilter aSamplingFilter,
[const] in MaybeSVGImageContext aSVGContext,
in uint32_t aFlags,
in float aOpacity);
--- a/image/moz.build
+++ b/image/moz.build
@@ -33,23 +33,23 @@ XPIDL_SOURCES += [
'imgIScriptedNotificationObserver.idl',
'imgITools.idl',
'nsIIconURI.idl',
]
XPIDL_MODULE = 'imglib2'
EXPORTS += [
- 'DrawResult.h',
'FrameTimeout.h',
'ImageCacheKey.h',
'ImageLogging.h',
'ImageMetadata.h',
'ImageOps.h',
'ImageRegion.h',
+ 'ImgDrawResult.h',
'imgLoader.h',
'imgRequest.h',
'imgRequestProxy.h',
'IProgressObserver.h',
'Orientation.h',
'SurfaceCacheUtils.h',
]
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -6942,31 +6942,31 @@ ComputeSnappedImageDrawingParameters(gfx
ImageRegion::CreateWithSamplingRestriction(imageSpaceFill, subimage, extendMode);
return SnappedImageDrawingParameters(transform, intImageSize,
region,
CSSIntSize(svgViewportSize.width,
svgViewportSize.height));
}
-static DrawResult
+static ImgDrawResult
DrawImageInternal(gfxContext& aContext,
nsPresContext* aPresContext,
imgIContainer* aImage,
const SamplingFilter aSamplingFilter,
const nsRect& aDest,
const nsRect& aFill,
const nsPoint& aAnchor,
const nsRect& aDirty,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aImageFlags,
ExtendMode aExtendMode = ExtendMode::CLAMP,
float aOpacity = 1.0)
{
- DrawResult result = DrawResult::SUCCESS;
+ ImgDrawResult result = ImgDrawResult::SUCCESS;
aImageFlags |= imgIContainer::FLAG_ASYNC_NOTIFY;
if (aPresContext->Type() == nsPresContext::eContext_Print) {
// We want vector images to be passed on as vector commands, not a raster
// image.
aImageFlags |= imgIContainer::FLAG_BYPASS_SURFACE_CACHE;
}
@@ -7001,32 +7001,32 @@ DrawImageInternal(gfxContext&
aSVGContext ? aSVGContext : fallbackContext,
aImageFlags, aOpacity);
}
return result;
}
-/* static */ DrawResult
+/* static */ ImgDrawResult
nsLayoutUtils::DrawSingleUnscaledImage(gfxContext& aContext,
nsPresContext* aPresContext,
imgIContainer* aImage,
const SamplingFilter aSamplingFilter,
const nsPoint& aDest,
const nsRect* aDirty,
uint32_t aImageFlags,
const nsRect* aSourceArea)
{
CSSIntSize imageSize;
aImage->GetWidth(&imageSize.width);
aImage->GetHeight(&imageSize.height);
if (imageSize.width < 1 || imageSize.height < 1) {
NS_WARNING("Image width or height is non-positive");
- return DrawResult::TEMPORARY_ERROR;
+ return ImgDrawResult::TEMPORARY_ERROR;
}
nsSize size(CSSPixel::ToAppUnits(imageSize));
nsRect source;
if (aSourceArea) {
source = *aSourceArea;
} else {
source.SizeTo(size);
@@ -7039,34 +7039,34 @@ nsLayoutUtils::DrawSingleUnscaledImage(g
// translation but we don't want to actually tile the image.
fill.IntersectRect(fill, dest);
return DrawImageInternal(aContext, aPresContext,
aImage, aSamplingFilter,
dest, fill, aDest, aDirty ? *aDirty : dest,
/* no SVGImageContext */ Nothing(), aImageFlags);
}
-/* static */ DrawResult
+/* static */ ImgDrawResult
nsLayoutUtils::DrawSingleImage(gfxContext& aContext,
nsPresContext* aPresContext,
imgIContainer* aImage,
const SamplingFilter aSamplingFilter,
const nsRect& aDest,
const nsRect& aDirty,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aImageFlags,
const nsPoint* aAnchorPoint,
const nsRect* aSourceArea)
{
nscoord appUnitsPerCSSPixel = nsDeviceContext::AppUnitsPerCSSPixel();
CSSIntSize pixelImageSize(ComputeSizeForDrawingWithFallback(aImage, aDest.Size()));
if (pixelImageSize.width < 1 || pixelImageSize.height < 1) {
NS_ASSERTION(pixelImageSize.width >= 0 && pixelImageSize.height >= 0,
"Image width or height is negative");
- return DrawResult::SUCCESS; // no point in drawing a zero size image
+ return ImgDrawResult::SUCCESS; // no point in drawing a zero size image
}
nsSize imageSize(CSSPixel::ToAppUnits(pixelImageSize));
nsRect source;
nsCOMPtr<imgIContainer> image;
if (aSourceArea) {
source = *aSourceArea;
nsIntRect subRect(source.x, source.y, source.width, source.height);
@@ -7246,17 +7246,17 @@ nsLayoutUtils::GetBackgroundFirstTilePos
const nsPoint& aFill,
const nsSize& aRepeatSize)
{
return nsPoint(NSToIntFloor(float(aFill.x - aDest.x) / aRepeatSize.width) * aRepeatSize.width,
NSToIntFloor(float(aFill.y - aDest.y) / aRepeatSize.height) * aRepeatSize.height) +
aDest;
}
-/* static */ DrawResult
+/* static */ ImgDrawResult
nsLayoutUtils::DrawBackgroundImage(gfxContext& aContext,
nsIFrame* aForFrame,
nsPresContext* aPresContext,
imgIContainer* aImage,
const CSSIntSize& aImageSize,
SamplingFilter aSamplingFilter,
const nsRect& aDest,
const nsRect& aFill,
@@ -7279,30 +7279,30 @@ nsLayoutUtils::DrawBackgroundImage(gfxCo
aDirty, svgContext, aImageFlags, aExtendMode,
aOpacity);
}
nsPoint firstTilePos = GetBackgroundFirstTilePos(aDest.TopLeft(), aFill.TopLeft(), aRepeatSize);
for (int32_t i = firstTilePos.x; i < aFill.XMost(); i += aRepeatSize.width) {
for (int32_t j = firstTilePos.y; j < aFill.YMost(); j += aRepeatSize.height) {
nsRect dest(i, j, aDest.width, aDest.height);
- DrawResult result = DrawImageInternal(aContext, aPresContext, aImage, aSamplingFilter,
+ ImgDrawResult result = DrawImageInternal(aContext, aPresContext, aImage, aSamplingFilter,
dest, dest, aAnchor, aDirty, svgContext,
aImageFlags, ExtendMode::CLAMP,
aOpacity);
- if (result != DrawResult::SUCCESS) {
+ if (result != ImgDrawResult::SUCCESS) {
return result;
}
}
}
- return DrawResult::SUCCESS;
-}
-
-/* static */ DrawResult
+ return ImgDrawResult::SUCCESS;
+}
+
+/* static */ ImgDrawResult
nsLayoutUtils::DrawImage(gfxContext& aContext,
nsStyleContext* aStyleContext,
nsPresContext* aPresContext,
imgIContainer* aImage,
const SamplingFilter aSamplingFilter,
const nsRect& aDest,
const nsRect& aFill,
const nsPoint& aAnchor,
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -151,17 +151,17 @@ class nsLayoutUtils
typedef mozilla::gfx::Float Float;
typedef mozilla::gfx::Point Point;
typedef mozilla::gfx::Rect Rect;
typedef mozilla::gfx::RectDouble RectDouble;
typedef mozilla::gfx::Size Size;
typedef mozilla::gfx::Matrix4x4 Matrix4x4;
typedef mozilla::gfx::RectCornerRadii RectCornerRadii;
typedef mozilla::gfx::StrokeOptions StrokeOptions;
- typedef mozilla::image::DrawResult DrawResult;
+ typedef mozilla::image::ImgDrawResult ImgDrawResult;
public:
typedef mozilla::layers::FrameMetrics FrameMetrics;
typedef mozilla::layers::ScrollMetadata ScrollMetadata;
typedef FrameMetrics::ViewID ViewID;
typedef mozilla::CSSPoint CSSPoint;
typedef mozilla::CSSSize CSSSize;
typedef mozilla::CSSIntSize CSSIntSize;
@@ -1801,17 +1801,17 @@ public:
* repeats of the image. Sizes larger than aDest.Size()
* create gaps between the images.
* @param aAnchor A point in aFill which we will ensure is
* pixel-aligned in the output.
* @param aDirty Pixels outside this area may be skipped.
* @param aImageFlags Image flags of the imgIContainer::FLAG_* variety.
* @param aExtendMode How to extend the image over the dest rect.
*/
- static DrawResult DrawBackgroundImage(gfxContext& aContext,
+ static ImgDrawResult DrawBackgroundImage(gfxContext& aContext,
nsIFrame* aForFrame,
nsPresContext* aPresContext,
imgIContainer* aImage,
const CSSIntSize& aImageSize,
SamplingFilter aSamplingFilter,
const nsRect& aDest,
const nsRect& aFill,
const nsSize& aRepeatSize,
@@ -1834,17 +1834,17 @@ public:
* @param aDest Where one copy of the image should mapped to.
* @param aFill The area to be filled with copies of the
* image.
* @param aAnchor A point in aFill which we will ensure is
* pixel-aligned in the output.
* @param aDirty Pixels outside this area may be skipped.
* @param aImageFlags Image flags of the imgIContainer::FLAG_* variety
*/
- static DrawResult DrawImage(gfxContext& aContext,
+ static ImgDrawResult DrawImage(gfxContext& aContext,
nsStyleContext* aStyleContext,
nsPresContext* aPresContext,
imgIContainer* aImage,
const SamplingFilter aSamplingFilter,
const nsRect& aDest,
const nsRect& aFill,
const nsPoint& aAnchor,
const nsRect& aDirty,
@@ -1862,17 +1862,17 @@ public:
* @param aDirty If non-null, then pixels outside this area may
* be skipped.
* @param aImageFlags Image flags of the imgIContainer::FLAG_* variety
* @param aSourceArea If non-null, this area is extracted from
* the image and drawn at aDest. It's
* in appunits. For best results it should
* be aligned with image pixels.
*/
- static DrawResult DrawSingleUnscaledImage(gfxContext& aContext,
+ static ImgDrawResult DrawSingleUnscaledImage(gfxContext& aContext,
nsPresContext* aPresContext,
imgIContainer* aImage,
const SamplingFilter aSamplingFilter,
const nsPoint& aDest,
const nsRect* aDirty,
uint32_t aImageFlags,
const nsRect* aSourceArea = nullptr);
@@ -1897,17 +1897,17 @@ public:
* variety.
* @param aAnchor If non-null, a point which we will ensure
* is pixel-aligned in the output.
* @param aSourceArea If non-null, this area is extracted from
* the image and drawn in aDest. It's
* in appunits. For best results it should
* be aligned with image pixels.
*/
- static DrawResult DrawSingleImage(gfxContext& aContext,
+ static ImgDrawResult DrawSingleImage(gfxContext& aContext,
nsPresContext* aPresContext,
imgIContainer* aImage,
const SamplingFilter aSamplingFilter,
const nsRect& aDest,
const nsRect& aDirty,
const mozilla::Maybe<SVGImageContext>& aSVGContext,
uint32_t aImageFlags,
const nsPoint* aAnchorPoint = nullptr,
--- a/layout/forms/nsButtonFrameRenderer.cpp
+++ b/layout/forms/nsButtonFrameRenderer.cpp
@@ -350,17 +350,17 @@ void
nsDisplayButtonBorder::Paint(nsDisplayListBuilder* aBuilder,
gfxContext* aCtx)
{
NS_ASSERTION(mFrame, "No frame?");
nsPresContext* pc = mFrame->PresContext();
nsRect r = nsRect(ToReferenceFrame(), mFrame->GetSize());
// draw the border and background inside the focus and outline borders
- DrawResult result =
+ ImgDrawResult result =
mBFR->PaintBorder(aBuilder, pc, *aCtx, mVisibleRect, r);
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
}
nsRect
nsDisplayButtonBorder::GetBounds(nsDisplayListBuilder* aBuilder,
bool* aSnap) const
@@ -430,17 +430,17 @@ void nsDisplayButtonForeground::Paint(ns
{
nsPresContext *presContext = mFrame->PresContext();
const nsStyleDisplay *disp = mFrame->StyleDisplay();
if (!mFrame->IsThemed(disp) ||
!presContext->GetTheme()->ThemeDrawsFocusForWidget(disp->mAppearance)) {
nsRect r = nsRect(ToReferenceFrame(), mFrame->GetSize());
// Draw the -moz-focus-inner border
- DrawResult result =
+ ImgDrawResult result =
mBFR->PaintInnerFocusBorder(aBuilder, presContext, *aCtx, mVisibleRect, r);
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
}
}
already_AddRefed<mozilla::layers::Layer>
nsDisplayButtonForeground::BuildLayer(nsDisplayListBuilder* aBuilder,
@@ -517,34 +517,34 @@ nsButtonFrameRenderer::GetButtonInnerFoc
nsMargin innerFocusPadding(0,0,0,0);
if (mInnerFocusStyle) {
mInnerFocusStyle->StylePadding()->GetPadding(innerFocusPadding);
}
aResult.Inflate(innerFocusPadding);
}
-DrawResult
+ImgDrawResult
nsButtonFrameRenderer::PaintInnerFocusBorder(
nsDisplayListBuilder* aBuilder,
nsPresContext* aPresContext,
gfxContext& aRenderingContext,
const nsRect& aDirtyRect,
const nsRect& aRect)
{
// we draw the -moz-focus-inner border just inside the button's
// normal border and padding, to match Windows themes.
nsRect rect;
PaintBorderFlags flags = aBuilder->ShouldSyncDecodeImages()
? PaintBorderFlags::SYNC_DECODE_IMAGES
: PaintBorderFlags();
- DrawResult result = DrawResult::SUCCESS;
+ ImgDrawResult result = ImgDrawResult::SUCCESS;
if (mInnerFocusStyle) {
GetButtonInnerFocusRect(aRect, rect);
result &=
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame,
aDirtyRect, rect, mInnerFocusStyle, flags);
}
@@ -573,17 +573,17 @@ nsButtonFrameRenderer::CreateInnerFocusB
rect,
mInnerFocusStyle,
aBorderIsEmpty);
}
return Nothing();
}
-DrawResult
+ImgDrawResult
nsButtonFrameRenderer::PaintBorder(
nsDisplayListBuilder* aBuilder,
nsPresContext* aPresContext,
gfxContext& aRenderingContext,
const nsRect& aDirtyRect,
const nsRect& aRect)
{
// get the button rect this is inside the focus and outline rects
@@ -592,17 +592,17 @@ nsButtonFrameRenderer::PaintBorder(
PaintBorderFlags borderFlags = aBuilder->ShouldSyncDecodeImages()
? PaintBorderFlags::SYNC_DECODE_IMAGES
: PaintBorderFlags();
nsCSSRendering::PaintBoxShadowInner(aPresContext, aRenderingContext,
mFrame, buttonRect);
- DrawResult result =
+ ImgDrawResult result =
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame,
aDirtyRect, buttonRect, context, borderFlags);
return result;
}
/**
* Call this when styles change
--- a/layout/forms/nsButtonFrameRenderer.h
+++ b/layout/forms/nsButtonFrameRenderer.h
@@ -20,44 +20,44 @@ class nsPresContext;
struct nsRect;
class nsStyleContext;
#define NS_BUTTON_RENDERER_FOCUS_INNER_CONTEXT_INDEX 0
#define NS_BUTTON_RENDERER_LAST_CONTEXT_INDEX NS_BUTTON_RENDERER_FOCUS_INNER_CONTEXT_INDEX
class nsButtonFrameRenderer {
- typedef mozilla::image::DrawResult DrawResult;
+ typedef mozilla::image::ImgDrawResult ImgDrawResult;
public:
nsButtonFrameRenderer();
~nsButtonFrameRenderer();
/**
* Create display list items for the button
*/
nsresult DisplayButton(nsDisplayListBuilder* aBuilder,
nsDisplayList* aBackground, nsDisplayList* aForeground);
- DrawResult PaintInnerFocusBorder(nsDisplayListBuilder* aBuilder,
+ ImgDrawResult PaintInnerFocusBorder(nsDisplayListBuilder* aBuilder,
nsPresContext* aPresContext,
gfxContext& aRenderingContext,
const nsRect& aDirtyRect,
const nsRect& aRect);
mozilla::Maybe<nsCSSBorderRenderer> CreateInnerFocusBorderRenderer(nsDisplayListBuilder* aBuilder,
nsPresContext* aPresContext,
gfxContext* aRenderingContext,
const nsRect& aDirtyRect,
const nsRect& aRect,
bool* aBorderIsEmpty);
- DrawResult PaintBorder(nsDisplayListBuilder* aBuilder,
+ ImgDrawResult PaintBorder(nsDisplayListBuilder* aBuilder,
nsPresContext* aPresContext,
gfxContext& aRenderingContext,
const nsRect& aDirtyRect,
const nsRect& aRect);
void SetFrame(nsFrame* aFrame, nsPresContext* aPresContext);
void SetDisabled(bool aDisabled, bool notify);
--- a/layout/forms/nsFieldSetFrame.cpp
+++ b/layout/forms/nsFieldSetFrame.cpp
@@ -106,17 +106,17 @@ public:
bool* aSnap) const override;
NS_DISPLAY_DECL_NAME("FieldSetBorder", TYPE_FIELDSET_BORDER_BACKGROUND)
};
void
nsDisplayFieldSetBorder::Paint(nsDisplayListBuilder* aBuilder,
gfxContext* aCtx)
{
- image::DrawResult result = static_cast<nsFieldSetFrame*>(mFrame)->
+ image::ImgDrawResult result = static_cast<nsFieldSetFrame*>(mFrame)->
PaintBorder(aBuilder, *aCtx, ToReferenceFrame(), mVisibleRect);
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
}
nsDisplayItemGeometry*
nsDisplayFieldSetBorder::AllocateGeometry(nsDisplayListBuilder* aBuilder)
{
@@ -235,17 +235,17 @@ nsFieldSetFrame::BuildDisplayList(nsDisp
}
// Put the inner frame's display items on the master list. Note that this
// moves its border/background display items to our BorderBackground() list,
// which isn't really correct, but it's OK because the inner frame is
// anonymous and can't have its own border and background.
contentDisplayItems.MoveTo(aLists);
}
-image::DrawResult
+image::ImgDrawResult
nsFieldSetFrame::PaintBorder(
nsDisplayListBuilder* aBuilder,
gfxContext& aRenderingContext,
nsPoint aPt,
const nsRect& aDirtyRect)
{
// If the border is smaller than the legend, move the border down
// to be centered on the legend. We call VisualBorderRectRelativeToSelf() to
@@ -254,17 +254,17 @@ nsFieldSetFrame::PaintBorder(
// override nsIFrame::GetBorderRadii.
nsRect rect = VisualBorderRectRelativeToSelf() + aPt;
nsPresContext* presContext = PresContext();
PaintBorderFlags borderFlags = aBuilder->ShouldSyncDecodeImages()
? PaintBorderFlags::SYNC_DECODE_IMAGES
: PaintBorderFlags();
- DrawResult result = DrawResult::SUCCESS;
+ ImgDrawResult result = ImgDrawResult::SUCCESS;
nsCSSRendering::PaintBoxShadowInner(presContext, aRenderingContext,
this, rect);
if (nsIFrame* legend = GetLegend()) {
// We want to avoid drawing our border under the legend, so clip out the
// legend while drawing our border. We don't want to use mLegendRect here,
// because we do want to draw our border under the legend's inline-start and
--- a/layout/forms/nsFieldSetFrame.h
+++ b/layout/forms/nsFieldSetFrame.h
@@ -3,22 +3,22 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsFieldSetFrame_h___
#define nsFieldSetFrame_h___
#include "mozilla/Attributes.h"
-#include "DrawResult.h"
+#include "ImgDrawResult.h"
#include "nsContainerFrame.h"
class nsFieldSetFrame final : public nsContainerFrame
{
- typedef mozilla::image::DrawResult DrawResult;
+ typedef mozilla::image::ImgDrawResult ImgDrawResult;
public:
NS_DECL_FRAMEARENA_HELPERS(nsFieldSetFrame)
explicit nsFieldSetFrame(nsStyleContext* aContext);
nscoord
GetIntrinsicISize(gfxContext* aRenderingContext,
@@ -42,17 +42,17 @@ public:
nscoord* aBaseline) const override;
bool GetNaturalBaselineBOffset(mozilla::WritingMode aWM,
BaselineSharingGroup aBaselineGroup,
nscoord* aBaseline) const override;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists) override;
- DrawResult PaintBorder(nsDisplayListBuilder* aBuilder,
+ ImgDrawResult PaintBorder(nsDisplayListBuilder* aBuilder,
gfxContext& aRenderingContext,
nsPoint aPt, const nsRect& aDirtyRect);
#ifdef DEBUG
virtual void SetInitialChildList(ChildListID aListID,
nsFrameList& aChildList) override;
virtual void AppendFrames(ChildListID aListID,
nsFrameList& aFrameList) override;
--- a/layout/forms/nsRangeFrame.cpp
+++ b/layout/forms/nsRangeFrame.cpp
@@ -241,17 +241,17 @@ nsDisplayRangeFocusRing::Paint(nsDisplay
nsStyleContext* styleContext =
static_cast<nsRangeFrame*>(mFrame)->mOuterFocusStyle;
MOZ_ASSERT(styleContext, "We only exist if mOuterFocusStyle is non-null");
PaintBorderFlags flags = aBuilder->ShouldSyncDecodeImages()
? PaintBorderFlags::SYNC_DECODE_IMAGES
: PaintBorderFlags();
- DrawResult result =
+ ImgDrawResult result =
nsCSSRendering::PaintBorder(mFrame->PresContext(), *aCtx, mFrame,
mVisibleRect, GetBounds(aBuilder, &unused),
styleContext, flags);
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
}
void
--- a/layout/generic/nsBulletFrame.cpp
+++ b/layout/generic/nsBulletFrame.cpp
@@ -241,17 +241,17 @@ public:
bool
CreateWebRenderCommands(nsDisplayItem* aItem,
wr::DisplayListBuilder& aBuilder,
wr::IpcResourceUpdateQueue& aResources,
const layers::StackingContextHelper& aSc,
mozilla::layers::WebRenderLayerManager* aManager,
nsDisplayListBuilder* aDisplayListBuilder);
- DrawResult
+ ImgDrawResult
Paint(gfxContext& aRenderingContext, nsPoint aPt,
const nsRect& aDirtyRect, uint32_t aFlags,
bool aDisableSubpixelAA, nsIFrame* aFrame);
bool
IsImageType() const
{
return mListStyleType == NS_STYLE_LIST_STYLE_NONE && mImage;
@@ -365,17 +365,17 @@ BulletRenderer::CreateWebRenderCommands(
aSc, aManager, aDisplayListBuilder);
} else {
MOZ_ASSERT(IsTextType());
return CreateWebRenderCommandsForText(aItem, aBuilder, aResources, aSc,
aManager, aDisplayListBuilder);
}
}
-DrawResult
+ImgDrawResult
BulletRenderer::Paint(gfxContext& aRenderingContext, nsPoint aPt,
const nsRect& aDirtyRect, uint32_t aFlags,
bool aDisableSubpixelAA, nsIFrame* aFrame)
{
if (IsImageType()) {
SamplingFilter filter = nsLayoutUtils::GetSamplingFilterForFrame(aFrame);
return nsLayoutUtils::DrawSingleImage(aRenderingContext,
aFrame->PresContext(), mImage, filter,
@@ -417,17 +417,17 @@ BulletRenderer::Paint(gfxContext& aRende
MOZ_CRASH("unreachable");
}
}
if (IsTextType()) {
PaintTextToContext(aFrame, &aRenderingContext, aDisableSubpixelAA);
}
- return DrawResult::SUCCESS;
+ return ImgDrawResult::SUCCESS;
}
bool
BulletRenderer::BuildGlyphForText(nsDisplayItem* aItem, bool disableSubpixelAA)
{
MOZ_ASSERT(IsTextType());
RefPtr<DrawTarget> screenTarget = gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget();
@@ -765,17 +765,17 @@ nsDisplayBullet::CreateWebRenderCommands
void nsDisplayBullet::Paint(nsDisplayListBuilder* aBuilder,
gfxContext* aCtx)
{
uint32_t flags = imgIContainer::FLAG_NONE;
if (aBuilder->ShouldSyncDecodeImages()) {
flags |= imgIContainer::FLAG_SYNC_DECODE;
}
- DrawResult result = static_cast<nsBulletFrame*>(mFrame)->
+ ImgDrawResult result = static_cast<nsBulletFrame*>(mFrame)->
PaintBullet(*aCtx, ToReferenceFrame(), mVisibleRect, flags,
mDisableSubpixelAA);
nsDisplayBulletGeometry::UpdateDrawResult(this, result);
}
void
nsBulletFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
@@ -934,25 +934,25 @@ nsBulletFrame::CreateBulletRenderer(gfxC
return Some(br);
}
}
MOZ_CRASH("unreachable");
return Nothing();
}
-DrawResult
+ImgDrawResult
nsBulletFrame::PaintBullet(gfxContext& aRenderingContext, nsPoint aPt,
const nsRect& aDirtyRect, uint32_t aFlags,
bool aDisableSubpixelAA)
{
Maybe<BulletRenderer> br = CreateBulletRenderer(aRenderingContext, aPt);
if (!br) {
- return DrawResult::SUCCESS;
+ return ImgDrawResult::SUCCESS;
}
return br->Paint(aRenderingContext, aPt, aDirtyRect,
aFlags, aDisableSubpixelAA, this);
}
int32_t
nsBulletFrame::SetListItemOrdinal(int32_t aNextOrdinal,
--- a/layout/generic/nsBulletFrame.h
+++ b/layout/generic/nsBulletFrame.h
@@ -37,17 +37,17 @@ private:
nsBulletFrame *mFrame;
};
/**
* A simple class that manages the layout and rendering of html bullets.
* This class also supports the CSS list-style properties.
*/
class nsBulletFrame final : public nsFrame {
- typedef mozilla::image::DrawResult DrawResult;
+ typedef mozilla::image::ImgDrawResult ImgDrawResult;
public:
NS_DECL_FRAMEARENA_HELPERS(nsBulletFrame)
#ifdef DEBUG
NS_DECL_QUERYFRAME
#endif
explicit nsBulletFrame(nsStyleContext* aContext)
@@ -96,17 +96,17 @@ public:
/* get list item text, with prefix & suffix */
void GetListItemText(nsAString& aResult);
void GetSpokenText(nsAString& aText);
Maybe<BulletRenderer>
CreateBulletRenderer(gfxContext& aRenderingContext, nsPoint aPt);
- DrawResult PaintBullet(gfxContext& aRenderingContext, nsPoint aPt,
+ ImgDrawResult PaintBullet(gfxContext& aRenderingContext, nsPoint aPt,
const nsRect& aDirtyRect, uint32_t aFlags,
bool aDisableSubpixelAA);
virtual bool IsEmpty() override;
virtual bool IsSelfEmpty() override;
virtual nscoord GetLogicalBaseline(mozilla::WritingMode aWritingMode) const override;
float GetFontSizeInflation() const;
--- a/layout/generic/nsColumnSetFrame.cpp
+++ b/layout/generic/nsColumnSetFrame.cpp
@@ -275,17 +275,17 @@ nsColumnSetFrame::CreateBorderRenderers(
skipSides |= mozilla::eSideBitsTopBottom;
skipSides |= mozilla::eSideBitsRight;
}
ForEachColumn([&]
(const nsRect& aLineRect)
{
// Assert that we're not drawing a border-image here; if we were, we
- // couldn't ignore the DrawResult that PaintBorderWithStyleBorder returns.
+ // couldn't ignore the ImgDrawResult that PaintBorderWithStyleBorder returns.
MOZ_ASSERT(border.mBorderImageSource.GetType() == eStyleImageType_Null);
gfx::DrawTarget* dt = aCtx ? aCtx->GetDrawTarget() : nullptr;
bool borderIsEmpty = false;
Maybe<nsCSSBorderRenderer> br =
nsCSSRendering::CreateBorderRendererWithStyleBorder(presContext, dt,
this, aDirtyRect,
aLineRect, border,
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -1337,29 +1337,29 @@ public:
virtual void Paint(nsDisplayListBuilder* aBuilder,
gfxContext* aCtx) override
{
// Always sync decode, because these icons are UI, and since they're not
// discardable we'll pay the price of sync decoding at most once.
uint32_t flags = imgIContainer::FLAG_SYNC_DECODE;
nsImageFrame* f = static_cast<nsImageFrame*>(mFrame);
- DrawResult result =
+ ImgDrawResult result =
f->DisplayAltFeedback(*aCtx,
mVisibleRect,
ToReferenceFrame(),
flags);
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
}
NS_DISPLAY_DECL_NAME("AltFeedback", TYPE_ALT_FEEDBACK)
};
-DrawResult
+ImgDrawResult
nsImageFrame::DisplayAltFeedback(gfxContext& aRenderingContext,
const nsRect& aDirtyRect,
nsPoint aPt,
uint32_t aFlags)
{
// We should definitely have a gIconLoad here.
MOZ_ASSERT(gIconLoad, "How did we succeed in Init then?");
@@ -1376,55 +1376,55 @@ nsImageFrame::DisplayAltFeedback(gfxCont
if (inner.IsEmpty()){
inner.SizeTo(2*(nsPresContext::CSSPixelsToAppUnits(ICON_SIZE+ICON_PADDING+ALT_BORDER_WIDTH)),
2*(nsPresContext::CSSPixelsToAppUnits(ICON_SIZE+ICON_PADDING+ALT_BORDER_WIDTH)));
}
// Make sure we have enough room to actually render the border within
// our frame bounds
if ((inner.width < 2 * borderEdgeWidth) || (inner.height < 2 * borderEdgeWidth)) {
- return DrawResult::SUCCESS;
+ return ImgDrawResult::SUCCESS;
}
// Paint the border
if (!isLoading || gIconLoad->mPrefShowLoadingPlaceholder) {
nsRecessedBorder recessedBorder(borderEdgeWidth, PresContext());
// Assert that we're not drawing a border-image here; if we were, we
- // couldn't ignore the DrawResult that PaintBorderWithStyleBorder returns.
+ // couldn't ignore the ImgDrawResult that PaintBorderWithStyleBorder returns.
MOZ_ASSERT(recessedBorder.mBorderImageSource.GetType() == eStyleImageType_Null);
Unused <<
nsCSSRendering::PaintBorderWithStyleBorder(PresContext(), aRenderingContext,
this, inner, inner,
recessedBorder, mStyleContext,
PaintBorderFlags::SYNC_DECODE_IMAGES);
}
// Adjust the inner rect to account for the one pixel recessed border,
// and a six pixel padding on each edge
inner.Deflate(nsPresContext::CSSPixelsToAppUnits(ICON_PADDING+ALT_BORDER_WIDTH),
nsPresContext::CSSPixelsToAppUnits(ICON_PADDING+ALT_BORDER_WIDTH));
if (inner.IsEmpty()) {
- return DrawResult::SUCCESS;
+ return ImgDrawResult::SUCCESS;
}
DrawTarget* drawTarget = aRenderingContext.GetDrawTarget();
// Clip so we don't render outside the inner rect
aRenderingContext.Save();
aRenderingContext.Clip(
NSRectToSnappedRect(inner, PresContext()->AppUnitsPerDevPixel(), *drawTarget));
- DrawResult result = DrawResult::NOT_READY;
+ ImgDrawResult result = ImgDrawResult::NOT_READY;
// Check if we should display image placeholders
if (!gIconLoad->mPrefShowPlaceholders ||
(isLoading && !gIconLoad->mPrefShowLoadingPlaceholder)) {
- result = DrawResult::SUCCESS;
+ result = ImgDrawResult::SUCCESS;
} else {
nscoord size = nsPresContext::CSSPixelsToAppUnits(ICON_SIZE);
imgIRequest* request = isLoading
? nsImageFrame::gIconLoad->mLoadingImage
: nsImageFrame::gIconLoad->mBrokenImage;
// If we weren't previously displaying an icon, register ourselves
@@ -1451,17 +1451,17 @@ nsImageFrame::DisplayAltFeedback(gfxCont
nsRect dest(flushRight ? inner.XMost() - size : inner.x,
inner.y, size, size);
result = nsLayoutUtils::DrawSingleImage(aRenderingContext, PresContext(), imgCon,
nsLayoutUtils::GetSamplingFilterForFrame(this), dest, aDirtyRect,
/* no SVGImageContext */ Nothing(), aFlags);
}
// If we could not draw the icon, just draw some graffiti in the mean time.
- if (result == DrawResult::NOT_READY) {
+ if (result == ImgDrawResult::NOT_READY) {
ColorPattern color(ToDeviceColor(Color(1.f, 0.f, 0.f, 1.f)));
nscoord iconXPos = flushRight ? inner.XMost() - size : inner.x;
// stroked rect:
nsRect rect(iconXPos, inner.y, size, size);
Rect devPxRect =
ToRect(nsLayoutUtils::RectToGfxRect(rect, PresContext()->AppUnitsPerDevPixel()));
@@ -1535,22 +1535,22 @@ nsDisplayImage::Paint(nsDisplayListBuild
uint32_t flags = imgIContainer::FLAG_NONE;
if (aBuilder->ShouldSyncDecodeImages()) {
flags |= imgIContainer::FLAG_SYNC_DECODE;
}
if (aBuilder->IsPaintingToWindow()) {
flags |= imgIContainer::FLAG_HIGH_QUALITY_SCALING;
}
- DrawResult result = static_cast<nsImageFrame*>(mFrame)->
+ ImgDrawResult result = static_cast<nsImageFrame*>(mFrame)->
PaintImage(*aCtx, ToReferenceFrame(), mVisibleRect, mImage, flags);
- if (result == DrawResult::NOT_READY ||
- result == DrawResult::INCOMPLETE ||
- result == DrawResult::TEMPORARY_ERROR) {
+ if (result == ImgDrawResult::NOT_READY ||
+ result == ImgDrawResult::INCOMPLETE ||
+ result == ImgDrawResult::TEMPORARY_ERROR) {
// If the current image failed to paint because it's still loading or
// decoding, try painting the previous image.
if (mPrevImage) {
result = static_cast<nsImageFrame*>(mFrame)->
PaintImage(*aCtx, ToReferenceFrame(), mVisibleRect, mPrevImage, flags);
}
}
@@ -1737,17 +1737,17 @@ nsDisplayImage::CreateWebRenderCommands(
mImage->GetImageContainerAtSize(aManager, decodeSize, svgContext, flags);
if (!container) {
return false;
}
return aManager->CommandBuilder().PushImage(this, container, aBuilder, aResources, aSc, destRect);
}
-DrawResult
+ImgDrawResult
nsImageFrame::PaintImage(gfxContext& aRenderingContext, nsPoint aPt,
const nsRect& aDirtyRect, imgIContainer* aImage,
uint32_t aFlags)
{
DrawTarget* drawTarget = aRenderingContext.GetDrawTarget();
// Render the image into our content area (the area inside
// the borders and padding)
@@ -1770,17 +1770,17 @@ nsImageFrame::PaintImage(gfxContext& aRe
uint32_t flags = aFlags;
if (mForceSyncDecoding) {
flags |= imgIContainer::FLAG_SYNC_DECODE;
}
Maybe<SVGImageContext> svgContext;
SVGImageContext::MaybeStoreContextPaint(svgContext, this, aImage);
- DrawResult result =
+ ImgDrawResult result =
nsLayoutUtils::DrawSingleImage(aRenderingContext,
PresContext(), aImage,
nsLayoutUtils::GetSamplingFilterForFrame(this), dest, aDirtyRect,
svgContext, flags, &anchorPoint);
if (nsImageMap* map = GetImageMap()) {
gfxPoint devPixelOffset =
nsLayoutUtils::PointToGfxPoint(dest.TopLeft(),
@@ -1795,19 +1795,19 @@ nsImageFrame::PaintImage(gfxContext& aRe
// then dashed black stroke over the top:
ColorPattern black(ToDeviceColor(Color(0.f, 0.f, 0.f, 1.f)));
StrokeOptions strokeOptions;
nsLayoutUtils::InitDashPattern(strokeOptions, NS_STYLE_BORDER_STYLE_DOTTED);
map->Draw(this, *drawTarget, black, strokeOptions);
}
- if (result == DrawResult::SUCCESS) {
+ if (result == ImgDrawResult::SUCCESS) {
mPrevImage = aImage;
- } else if (result == DrawResult::BAD_IMAGE) {
+ } else if (result == ImgDrawResult::BAD_IMAGE) {
mPrevImage = nullptr;
}
return result;
}
void
nsImageFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
--- a/layout/generic/nsImageFrame.h
+++ b/layout/generic/nsImageFrame.h
@@ -60,17 +60,17 @@ private:
class nsImageFrame : public nsAtomicContainerFrame
, public nsIReflowCallback {
public:
template <typename T> using Maybe = mozilla::Maybe<T>;
using Nothing = mozilla::Nothing;
using Visibility = mozilla::Visibility;
- typedef mozilla::image::DrawResult DrawResult;
+ typedef mozilla::image::ImgDrawResult ImgDrawResult;
typedef mozilla::layers::ImageContainer ImageContainer;
typedef mozilla::layers::ImageLayer ImageLayer;
typedef mozilla::layers::LayerManager LayerManager;
NS_DECL_FRAMEARENA_HELPERS(nsImageFrame)
NS_DECL_QUERYFRAME
virtual void DestroyFrom(nsIFrame* aDestructRoot, PostDestroyData& aPostDestroyData) override;
@@ -142,17 +142,17 @@ public:
/**
* Function to test whether aContent, which has aStyleContext as its style,
* should get an image frame. Note that this method is only used by the
* frame constructor; it's only here because it uses gIconLoad for now.
*/
static bool ShouldCreateImageFrameFor(mozilla::dom::Element* aElement,
nsStyleContext* aStyleContext);
- DrawResult DisplayAltFeedback(gfxContext& aRenderingContext,
+ ImgDrawResult DisplayAltFeedback(gfxContext& aRenderingContext,
const nsRect& aDirtyRect,
nsPoint aPt,
uint32_t aFlags);
nsRect GetInnerArea() const;
/**
* Return a map element associated with this image.
@@ -220,17 +220,17 @@ protected:
gfxContext& aContext,
nsFontMetrics& aFontMetrics);
void DisplayAltText(nsPresContext* aPresContext,
gfxContext& aRenderingContext,
const nsString& aAltText,
const nsRect& aRect);
- DrawResult PaintImage(gfxContext& aRenderingContext, nsPoint aPt,
+ ImgDrawResult PaintImage(gfxContext& aRenderingContext, nsPoint aPt,
const nsRect& aDirtyRect, imgIContainer* aImage,
uint32_t aFlags);
/**
* If we're ready to decode - that is, if our current request's image is
* available and our decoding heuristics are satisfied - then trigger a decode
* for our image at the size we predict it will be drawn next time it's
* painted.
--- a/layout/mathml/nsMathMLChar.cpp
+++ b/layout/mathml/nsMathMLChar.cpp
@@ -1948,17 +1948,17 @@ void nsDisplayMathMLCharDebug::Paint(nsD
nsStyleContext* styleContext = mFrame->StyleContext();
nsRect rect = mRect + ToReferenceFrame();
PaintBorderFlags flags = aBuilder->ShouldSyncDecodeImages()
? PaintBorderFlags::SYNC_DECODE_IMAGES
: PaintBorderFlags();
// Since this is used only for debugging, we don't need to worry about
- // tracking the DrawResult.
+ // tracking the ImgDrawResult.
Unused <<
nsCSSRendering::PaintBorder(presContext, *aCtx, mFrame, mVisibleRect,
rect, styleContext, flags, skipSides);
nsCSSRendering::PaintOutline(presContext, *aCtx, mFrame,
mVisibleRect, rect, styleContext);
}
#endif
--- a/layout/mathml/nsMathMLmtableFrame.cpp
+++ b/layout/mathml/nsMathMLmtableFrame.cpp
@@ -315,17 +315,17 @@ public:
nsRect bounds = nsRect(ToReferenceFrame(), mFrame->GetSize());
nsMargin overflow = ComputeBorderOverflow(frame, styleBorder);
bounds.Inflate(overflow);
PaintBorderFlags flags = aBuilder->ShouldSyncDecodeImages()
? PaintBorderFlags::SYNC_DECODE_IMAGES
: PaintBorderFlags();
- DrawResult result =
+ ImgDrawResult result =
nsCSSRendering::PaintBorderWithStyleBorder(mFrame->PresContext(), *aCtx,
mFrame, mVisibleRect,
bounds,
styleBorder,
mFrame->StyleContext(),
flags,
mFrame->GetSkipSides());
--- a/layout/painting/nsCSSRendering.cpp
+++ b/layout/painting/nsCSSRendering.cpp
@@ -621,17 +621,17 @@ nsCSSRendering::ComputePixelRadii(const
(*oBorderRadii)[C_TR] = Size(radii[eCornerTopRightX],
radii[eCornerTopRightY]);
(*oBorderRadii)[C_BR] = Size(radii[eCornerBottomRightX],
radii[eCornerBottomRightY]);
(*oBorderRadii)[C_BL] = Size(radii[eCornerBottomLeftX],
radii[eCornerBottomLeftY]);
}
-DrawResult
+ImgDrawResult
nsCSSRendering::PaintBorder(nsPresContext* aPresContext,
gfxContext& aRenderingContext,
nsIFrame* aForFrame,
const nsRect& aDirtyRect,
const nsRect& aBorderArea,
nsStyleContext* aStyleContext,
PaintBorderFlags aFlags,
Sides aSkipSides)
@@ -757,17 +757,17 @@ nsCSSRendering::CreateWebRenderCommandsF
}
uint32_t flags = 0;
if (aDisplayListBuilder->ShouldSyncDecodeImages()) {
flags |= nsImageRenderer::FLAG_SYNC_DECODE_IMAGES;
}
- image::DrawResult result;
+ image::ImgDrawResult result;
Maybe<nsCSSBorderImageRenderer> bir =
nsCSSBorderImageRenderer::CreateBorderImageRenderer(aForFrame->PresContext(),
aForFrame,
aBorderArea,
*styleBorder,
aItem->GetVisibleRect(),
aForFrame->GetSkipSides(),
flags,
@@ -881,17 +881,17 @@ ConstructBorderRenderer(nsPresContext* a
borderColors,
aStyleBorder.mBorderColors.get(),
bgColor,
!aForFrame->BackfaceIsHidden(),
*aNeedsClip ? Some(NSRectToRect(aBorderArea, oneDevPixel)) : Nothing());
}
-DrawResult
+ImgDrawResult
nsCSSRendering::PaintBorderWithStyleBorder(nsPresContext* aPresContext,
gfxContext& aRenderingContext,
nsIFrame* aForFrame,
const nsRect& aDirtyRect,
const nsRect& aBorderArea,
const nsStyleBorder& aStyleBorder,
nsStyleContext* aStyleContext,
PaintBorderFlags aFlags,
@@ -905,50 +905,50 @@ nsCSSRendering::PaintBorderWithStyleBord
// renderer draw the border. DO not get the data from aForFrame, since the passed in style context
// may be different! Always use |aStyleContext|!
const nsStyleDisplay* displayData = aStyleContext->StyleDisplay();
if (displayData->mAppearance) {
nsITheme *theme = aPresContext->GetTheme();
if (theme &&
theme->ThemeSupportsWidget(aPresContext, aForFrame,
displayData->mAppearance)) {
- return DrawResult::SUCCESS; // Let the theme handle it.
+ return ImgDrawResult::SUCCESS; // Let the theme handle it.
}
}
if (!aStyleBorder.mBorderImageSource.IsEmpty()) {
- DrawResult result = DrawResult::SUCCESS;
+ ImgDrawResult result = ImgDrawResult::SUCCESS;
uint32_t irFlags = 0;
if (aFlags & PaintBorderFlags::SYNC_DECODE_IMAGES) {
irFlags |= nsImageRenderer::FLAG_SYNC_DECODE_IMAGES;
}
// Creating the border image renderer will request a decode, and we rely on
// that happening.
Maybe<nsCSSBorderImageRenderer> renderer =
nsCSSBorderImageRenderer::CreateBorderImageRenderer(aPresContext, aForFrame, aBorderArea,
aStyleBorder, aDirtyRect, aSkipSides,
irFlags, &result);
// renderer was created successfully, which means border image is ready to
// be used.
if (renderer) {
- MOZ_ASSERT(result == DrawResult::SUCCESS);
+ MOZ_ASSERT(result == ImgDrawResult::SUCCESS);
return renderer->DrawBorderImage(aPresContext, aRenderingContext,
aForFrame, aDirtyRect);
}
}
- DrawResult result = DrawResult::SUCCESS;
+ ImgDrawResult result = ImgDrawResult::SUCCESS;
// If we had a border-image, but it wasn't loaded, then we should return
- // DrawResult::NOT_READY; we'll want to try again if we do a paint with sync
+ // ImgDrawResult::NOT_READY; we'll want to try again if we do a paint with sync
// decoding enabled.
if (aStyleBorder.mBorderImageSource.GetType() != eStyleImageType_Null) {
- result = DrawResult::NOT_READY;
+ result = ImgDrawResult::NOT_READY;
}
nsMargin border = aStyleBorder.GetComputedBorder();
if (0 == border.left && 0 == border.right &&
0 == border.top && 0 == border.bottom) {
// Empty border area
return result;
}
@@ -2013,39 +2013,39 @@ nsCSSRendering::PaintBGParams::ForSingle
PaintBGParams result(aPresCtx, aDirtyRect, aBorderArea,
aFrame, aPaintFlags, aLayer, aCompositionOp,
aOpacity);
return result;
}
-DrawResult
+ImgDrawResult
nsCSSRendering::PaintStyleImageLayer(const PaintBGParams& aParams,
gfxContext& aRenderingCtx)
{
AUTO_PROFILER_LABEL("nsCSSRendering::PaintStyleImageLayer", GRAPHICS);
NS_PRECONDITION(aParams.frame,
"Frame is expected to be provided to PaintStyleImageLayer");
nsStyleContext *sc;
if (!FindBackground(aParams.frame, &sc)) {
// We don't want to bail out if moz-appearance is set on a root
// node. If it has a parent content node, bail because it's not
// a root, otherwise keep going in order to let the theme stuff
// draw the background. The canvas really should be drawing the
// bg, but there's no way to hook that up via css.
if (!aParams.frame->StyleDisplay()->mAppearance) {
- return DrawResult::SUCCESS;
+ return ImgDrawResult::SUCCESS;
}
nsIContent* content = aParams.frame->GetContent();
if (!content || content->GetParent()) {
- return DrawResult::SUCCESS;
+ return ImgDrawResult::SUCCESS;
}
sc = aParams.frame->StyleContext();
}
return PaintStyleImageLayerWithSC(aParams, aRenderingCtx, sc, *aParams.frame->StyleBorder());
}
@@ -2098,17 +2098,17 @@ nsCSSRendering::CanBuildWebRenderDisplay
if (styleImage->GetType() == eStyleImageType_Gradient) {
return true;
}
return false;
}
-DrawResult
+ImgDrawResult
nsCSSRendering::BuildWebRenderDisplayItemsForStyleImageLayer(const PaintBGParams& aParams,
mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources,
const mozilla::layers::StackingContextHelper& aSc,
mozilla::layers::WebRenderLayerManager* aManager,
nsDisplayItem* aItem)
{
NS_PRECONDITION(aParams.frame,
@@ -2117,22 +2117,22 @@ nsCSSRendering::BuildWebRenderDisplayIte
nsStyleContext *sc;
if (!FindBackground(aParams.frame, &sc)) {
// We don't want to bail out if moz-appearance is set on a root
// node. If it has a parent content node, bail because it's not
// a root, otherwise keep going in order to let the theme stuff
// draw the background. The canvas really should be drawing the
// bg, but there's no way to hook that up via css.
if (!aParams.frame->StyleDisplay()->mAppearance) {
- return DrawResult::SUCCESS;
+ return ImgDrawResult::SUCCESS;
}
nsIContent* content = aParams.frame->GetContent();
if (!content || content->GetParent()) {
- return DrawResult::SUCCESS;
+ return ImgDrawResult::SUCCESS;
}
sc = aParams.frame->StyleContext();
}
return BuildWebRenderDisplayItemsForStyleImageLayerWithSC(aParams, aBuilder, aResources, aSc,
aManager, aItem,
sc, *aParams.frame->StyleBorder());
}
@@ -2607,17 +2607,17 @@ DetermineCompositionOp(const nsCSSRender
}
return nsCSSRendering::GetGFXCompositeMode(layer.mComposite);
}
return nsCSSRendering::GetGFXBlendMode(layer.mBlendMode);
}
-DrawResult
+ImgDrawResult
nsCSSRendering::PaintStyleImageLayerWithSC(const PaintBGParams& aParams,
gfxContext& aRenderingCtx,
nsStyleContext *aBackgroundSC,
const nsStyleBorder& aBorder)
{
NS_PRECONDITION(aParams.frame,
"Frame is expected to be provided to PaintStyleImageLayerWithSC");
@@ -2638,17 +2638,17 @@ nsCSSRendering::PaintStyleImageLayerWith
nsRect drawing(aParams.borderArea);
theme->GetWidgetOverflow(aParams.presCtx.DeviceContext(),
aParams.frame, displayData->mAppearance,
&drawing);
drawing.IntersectRect(drawing, aParams.dirtyRect);
theme->DrawWidgetBackground(&aRenderingCtx, aParams.frame,
displayData->mAppearance, aParams.borderArea,
drawing);
- return DrawResult::SUCCESS;
+ return ImgDrawResult::SUCCESS;
}
}
// For canvas frames (in the CSS sense) we draw the background color using
// a solid color item that gets added in nsLayoutUtils::PaintFrame,
// or nsSubDocumentFrame::BuildDisplayList (bug 488242). (The solid
// color may be moved into nsDisplayCanvasBackground by
// nsPresShell::AddCanvasBackgroundColorItem, and painted by
@@ -2676,17 +2676,17 @@ nsCSSRendering::PaintStyleImageLayerWith
if ((drawBackgroundColor && aParams.layer >= 0) || paintMask) {
drawBackgroundColor = false;
}
// At this point, drawBackgroundImage and drawBackgroundColor are
// true if and only if we are actually supposed to paint an image or
// color into aDirtyRect, respectively.
if (!drawBackgroundImage && !drawBackgroundColor)
- return DrawResult::SUCCESS;
+ return ImgDrawResult::SUCCESS;
// The 'bgClipArea' (used only by the image tiling logic, far below)
// is the caller-provided aParams.bgClipRect if any, or else the area
// determined by the value of 'background-clip' in
// SetupCurrentBackgroundClip. (Arguably it should be the
// intersection, but that breaks the table painter -- in particular,
// taking the intersection breaks reftests/bugs/403249-1[ab].)
nscoord appUnitsPerPixel = aParams.presCtx.AppUnitsPerDevPixel();
@@ -2714,23 +2714,23 @@ nsCSSRendering::PaintStyleImageLayerWith
// If there is no background image, draw a color. (If there is
// neither a background image nor a color, we wouldn't have gotten
// this far.)
if (!drawBackgroundImage) {
if (!isCanvasFrame) {
DrawBackgroundColor(clipState, &aRenderingCtx, appUnitsPerPixel);
}
- return DrawResult::SUCCESS;
+ return ImgDrawResult::SUCCESS;
}
if (layers.mImageCount < 1) {
// Return if there are no background layers, all work from this point
// onwards happens iteratively on these.
- return DrawResult::SUCCESS;
+ return ImgDrawResult::SUCCESS;
}
MOZ_ASSERT((aParams.layer < 0) ||
(layers.mImageCount > uint32_t(aParams.layer)));
bool drawAllLayers = (aParams.layer < 0);
// Ensure we get invalidated for loads of the image. We need to do
// this here because this might be the only code that knows about the
@@ -2757,17 +2757,17 @@ nsCSSRendering::PaintStyleImageLayerWith
Sides skipSides = aParams.frame->GetSkipSides();
nsRect paintBorderArea =
::BoxDecorationRectForBackground(aParams.frame, aParams.borderArea,
skipSides, &aBorder);
nsRect clipBorderArea =
::BoxDecorationRectForBorder(aParams.frame, aParams.borderArea,
skipSides, &aBorder);
- DrawResult result = DrawResult::SUCCESS;
+ ImgDrawResult result = ImgDrawResult::SUCCESS;
StyleGeometryBox currentBackgroundClip = StyleGeometryBox::BorderBox;
uint32_t count = drawAllLayers
? layers.mImageCount // iterate all image layers.
: layers.mImageCount - aParams.layer; // iterate from the bottom layer to
// the 'aParams.layer-th' layer.
NS_FOR_VISIBLE_IMAGE_LAYERS_BACK_TO_FRONT_WITH_RANGE(i, layers,
layers.mImageCount - 1,
count) {
@@ -2844,17 +2844,17 @@ nsCSSRendering::PaintStyleImageLayerWith
aRenderingCtx.SetOp(CompositionOp::OP_OVER);
}
}
}
return result;
}
-DrawResult
+ImgDrawResult
nsCSSRendering::BuildWebRenderDisplayItemsForStyleImageLayerWithSC(const PaintBGParams& aParams,
mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources,
const mozilla::layers::StackingContextHelper& aSc,
mozilla::layers::WebRenderLayerManager* aManager,
nsDisplayItem* aItem,
nsStyleContext *aBackgroundSC,
const nsStyleBorder& aBorder)
@@ -2879,20 +2879,20 @@ nsCSSRendering::BuildWebRenderDisplayIte
skipSides, &aBorder);
const nsStyleImageLayers& layers = aBackgroundSC->StyleBackground()->mImage;
const nsStyleImageLayers::Layer& layer = layers.mLayers[aParams.layer];
// Skip the following layer painting code if we found the dirty region is
// empty or the current layer is not selected for drawing.
if (clipState.mDirtyRectInDevPx.IsEmpty()) {
- return DrawResult::SUCCESS;
+ return ImgDrawResult::SUCCESS;
}
- DrawResult result = DrawResult::SUCCESS;
+ ImgDrawResult result = ImgDrawResult::SUCCESS;
nsBackgroundLayerState state =
PrepareImageLayer(&aParams.presCtx, aParams.frame,
aParams.paintFlags, paintBorderArea,
clipState.mBGClipArea, layer, nullptr);
result &= state.mImageRenderer.PrepareResult();
if (!state.mFillArea.IsEmpty()) {
return state.mImageRenderer.BuildWebRenderDisplayItemsForLayer(&aParams.presCtx,
aBuilder, aResources, aSc,
--- a/layout/painting/nsCSSRendering.h
+++ b/layout/painting/nsCSSRendering.h
@@ -102,17 +102,17 @@ struct nsCSSRendering {
typedef mozilla::gfx::CompositionOp CompositionOp;
typedef mozilla::gfx::DrawTarget DrawTarget;
typedef mozilla::gfx::Float Float;
typedef mozilla::gfx::Point Point;
typedef mozilla::gfx::Rect Rect;
typedef mozilla::gfx::Size Size;
typedef mozilla::gfx::RectCornerRadii RectCornerRadii;
typedef mozilla::layers::LayerManager LayerManager;
- typedef mozilla::image::DrawResult DrawResult;
+ typedef mozilla::image::ImgDrawResult ImgDrawResult;
typedef nsIFrame::Sides Sides;
/**
* Initialize any static variables used by nsCSSRendering.
*/
static void Init();
/**
@@ -157,31 +157,31 @@ struct nsCSSRendering {
nscoord aAppUnitsPerPixel,
RectCornerRadii *oBorderRadii);
/**
* Render the border for an element using css rendering rules
* for borders. aSkipSides says which sides to skip
* when rendering, the default is to skip none.
*/
- static DrawResult PaintBorder(nsPresContext* aPresContext,
+ static ImgDrawResult PaintBorder(nsPresContext* aPresContext,
gfxContext& aRenderingContext,
nsIFrame* aForFrame,
const nsRect& aDirtyRect,
const nsRect& aBorderArea,
nsStyleContext* aStyleContext,
mozilla::PaintBorderFlags aFlags,
Sides aSkipSides = Sides());
/**
* Like PaintBorder, but taking an nsStyleBorder argument instead of
* getting it from aStyleContext. aSkipSides says which sides to skip
* when rendering, the default is to skip none.
*/
- static DrawResult PaintBorderWithStyleBorder(nsPresContext* aPresContext,
+ static ImgDrawResult PaintBorderWithStyleBorder(nsPresContext* aPresContext,
gfxContext& aRenderingContext,
nsIFrame* aForFrame,
const nsRect& aDirtyRect,
const nsRect& aBorderArea,
const nsStyleBorder& aBorderStyle,
nsStyleContext* aStyleContext,
mozilla::PaintBorderFlags aFlags,
Sides aSkipSides = Sides());
@@ -489,50 +489,50 @@ struct nsCSSRendering {
borderArea(aBorderArea),
frame(aFrame),
paintFlags(aPaintFlags),
layer(aLayer),
compositionOp(aCompositionOp),
opacity(aOpacity) {}
};
- static DrawResult PaintStyleImageLayer(const PaintBGParams& aParams,
+ static ImgDrawResult PaintStyleImageLayer(const PaintBGParams& aParams,
gfxContext& aRenderingCtx);
/**
* Same as |PaintStyleImageLayer|, except using the provided style structs.
* This short-circuits the code that ensures that the root element's
* {background|mask} is drawn on the canvas.
* The aLayer parameter allows you to paint a single layer of the
* {background|mask}.
* The default value for aLayer, -1, means that all layers will be painted.
* The background color will only be painted if the back-most layer is also
* being painted and (aParams.paintFlags & PAINTBG_MASK_IMAGE) is false.
* aCompositionOp is only respected if a single layer is specified (aLayer != -1).
* If all layers are painted, the image layer's blend mode (or the mask
* layer's composition mode) will be used.
*/
- static DrawResult PaintStyleImageLayerWithSC(const PaintBGParams& aParams,
+ static ImgDrawResult PaintStyleImageLayerWithSC(const PaintBGParams& aParams,
gfxContext& aRenderingCtx,
nsStyleContext *mBackgroundSC,
const nsStyleBorder& aBorder);
static bool CanBuildWebRenderDisplayItemsForStyleImageLayer(LayerManager* aManager,
nsPresContext& aPresCtx,
nsIFrame *aFrame,
const nsStyleBackground* aBackgroundStyle,
int32_t aLayer);
- static DrawResult BuildWebRenderDisplayItemsForStyleImageLayer(const PaintBGParams& aParams,
+ static ImgDrawResult BuildWebRenderDisplayItemsForStyleImageLayer(const PaintBGParams& aParams,
mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources,
const mozilla::layers::StackingContextHelper& aSc,
mozilla::layers::WebRenderLayerManager* aManager,
nsDisplayItem* aItem);
- static DrawResult BuildWebRenderDisplayItemsForStyleImageLayerWithSC(const PaintBGParams& aParams,
+ static ImgDrawResult BuildWebRenderDisplayItemsForStyleImageLayerWithSC(const PaintBGParams& aParams,
mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources,
const mozilla::layers::StackingContextHelper& aSc,
mozilla::layers::WebRenderLayerManager* aManager,
nsDisplayItem* aItem,
nsStyleContext *mBackgroundSC,
const nsStyleBorder& aBorder);
--- a/layout/painting/nsCSSRenderingBorders.cpp
+++ b/layout/painting/nsCSSRenderingBorders.cpp
@@ -3640,22 +3640,22 @@ nsCSSBorderRenderer::CreateWebRenderComm
/* static */Maybe<nsCSSBorderImageRenderer>
nsCSSBorderImageRenderer::CreateBorderImageRenderer(nsPresContext* aPresContext,
nsIFrame* aForFrame,
const nsRect& aBorderArea,
const nsStyleBorder& aStyleBorder,
const nsRect& aDirtyRect,
Sides aSkipSides,
uint32_t aFlags,
- DrawResult* aDrawResult)
+ ImgDrawResult* aDrawResult)
{
MOZ_ASSERT(aDrawResult);
if (aDirtyRect.IsEmpty()) {
- *aDrawResult = DrawResult::SUCCESS;
+ *aDrawResult = ImgDrawResult::SUCCESS;
return Nothing();
}
nsImageRenderer imgRenderer(aForFrame, &aStyleBorder.mBorderImageSource, aFlags);
if (!imgRenderer.PrepareImage()) {
*aDrawResult = imgRenderer.PrepareResult();
return Nothing();
}
@@ -3665,21 +3665,21 @@ nsCSSBorderImageRenderer::CreateBorderIm
// knows about the association of the style data with the frame.
// XXX We shouldn't really... since if anybody is passing in a
// different style, they'll potentially have the wrong size for the
// border too.
aForFrame->AssociateImage(aStyleBorder.mBorderImageSource, aPresContext);
nsCSSBorderImageRenderer renderer(aForFrame, aBorderArea,
aStyleBorder, aSkipSides, imgRenderer);
- *aDrawResult = DrawResult::SUCCESS;
+ *aDrawResult = ImgDrawResult::SUCCESS;
return Some(renderer);
}
-DrawResult
+ImgDrawResult
nsCSSBorderImageRenderer::DrawBorderImage(nsPresContext* aPresContext,
gfxContext& aRenderingContext,
nsIFrame* aForFrame,
const nsRect& aDirtyRect)
{
// NOTE: no Save() yet, we do that later by calling autoSR.EnsureSaved()
// in case we need it.
gfxContextAutoSaveRestore autoSR;
@@ -3745,17 +3745,17 @@ nsCSSBorderImageRenderer::DrawBorderImag
mSlice.right,
};
const int32_t sliceHeight[3] = {
mSlice.top,
std::max(mImageSize.height - mSlice.top - mSlice.bottom, 0),
mSlice.bottom,
};
- DrawResult result = DrawResult::SUCCESS;
+ ImgDrawResult result = ImgDrawResult::SUCCESS;
for (int i = LEFT; i <= RIGHT; i++) {
for (int j = TOP; j <= BOTTOM; j++) {
uint8_t fillStyleH, fillStyleV;
nsSize unitSize;
if (i == MIDDLE && j == MIDDLE) {
// Discard the middle portion unless set to fill.
--- a/layout/painting/nsCSSRenderingBorders.h
+++ b/layout/painting/nsCSSRenderingBorders.h
@@ -298,19 +298,19 @@ public:
static mozilla::Maybe<nsCSSBorderImageRenderer>
CreateBorderImageRenderer(nsPresContext* aPresContext,
nsIFrame* aForFrame,
const nsRect& aBorderArea,
const nsStyleBorder& aStyleBorder,
const nsRect& aDirtyRect,
nsIFrame::Sides aSkipSides,
uint32_t aFlags,
- mozilla::image::DrawResult* aDrawResult);
+ mozilla::image::ImgDrawResult* aDrawResult);
- mozilla::image::DrawResult
+ mozilla::image::ImgDrawResult
DrawBorderImage(nsPresContext* aPresContext,
gfxContext& aRenderingContext,
nsIFrame* aForFrame,
const nsRect& aDirtyRect);
void
CreateWebRenderCommands(nsDisplayItem* aItem,
nsIFrame* aForFrame,
mozilla::wr::DisplayListBuilder& aBuilder,
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -4032,17 +4032,17 @@ nsDisplayBackgroundImage::CreateWebRende
}
CheckForBorderItem(this, mImageFlags);
nsCSSRendering::PaintBGParams params =
nsCSSRendering::PaintBGParams::ForSingleLayer(*StyleFrame()->PresContext(),
mVisibleRect, mBackgroundRect,
StyleFrame(), mImageFlags, mLayer,
CompositionOp::OP_OVER);
params.bgClipRect = &mBounds;
- DrawResult result =
+ ImgDrawResult result =
nsCSSRendering::BuildWebRenderDisplayItemsForStyleImageLayer(params, aBuilder, aResources, aSc, aManager, this);
nsDisplayBackgroundGeometry::UpdateDrawResult(this, result);
return true;
}
void
nsDisplayBackgroundImage::HitTest(nsDisplayListBuilder* aBuilder,
@@ -4195,17 +4195,17 @@ nsDisplayBackgroundImage::PaintInternal(
}
nsCSSRendering::PaintBGParams params =
nsCSSRendering::PaintBGParams::ForSingleLayer(*StyleFrame()->PresContext(),
aBounds, mBackgroundRect,
StyleFrame(), mImageFlags, mLayer,
CompositionOp::OP_OVER);
params.bgClipRect = aClipRect;
- DrawResult result = nsCSSRendering::PaintStyleImageLayer(params, *aCtx);
+ ImgDrawResult result = nsCSSRendering::PaintStyleImageLayer(params, *aCtx);
if (clip == StyleGeometryBox::Text) {
ctx->PopGroupAndBlend();
}
nsDisplayBackgroundGeometry::UpdateDrawResult(this, result);
}
@@ -4496,17 +4496,17 @@ nsDisplayImageContainer::ConfigureLayer(
int32_t imageHeight;
image->GetWidth(&imageWidth);
image->GetHeight(&imageHeight);
NS_ASSERTION(imageWidth != 0 && imageHeight != 0, "Invalid image size!");
if (imageWidth > 0 && imageHeight > 0) {
// We're actually using the ImageContainer. Let our frame know that it
// should consider itself to have painted successfully.
- nsDisplayBackgroundGeometry::UpdateDrawResult(this, DrawResult::SUCCESS);
+ nsDisplayBackgroundGeometry::UpdateDrawResult(this, ImgDrawResult::SUCCESS);
}
// XXX(seth): Right now we ignore aParameters.Scale() and
// aParameters.Offset(), because FrameLayerBuilder already applies
// aParameters.Scale() via the layer's post-transform, and
// aParameters.Offset() is always zero.
MOZ_ASSERT(aParameters.Offset() == LayerIntPoint(0,0));
@@ -5671,17 +5671,17 @@ void
nsDisplayBorder::Paint(nsDisplayListBuilder* aBuilder,
gfxContext* aCtx) {
nsPoint offset = ToReferenceFrame();
PaintBorderFlags flags = aBuilder->ShouldSyncDecodeImages()
? PaintBorderFlags::SYNC_DECODE_IMAGES
: PaintBorderFlags();
- DrawResult result =
+ ImgDrawResult result =
nsCSSRendering::PaintBorder(mFrame->PresContext(), *aCtx, mFrame,
mVisibleRect,
nsRect(offset, mFrame->GetSize()),
mFrame->StyleContext(),
flags,
mFrame->GetSkipSides());
nsDisplayBorderGeometry::UpdateDrawResult(this, result);
@@ -9578,17 +9578,17 @@ nsDisplayMask::PaintMask(nsDisplayListBu
borderArea, aBuilder,
nullptr,
mHandleOpacity, imgParmas);
ComputeMaskGeometry(params);
nsSVGIntegrationUtils::PaintMask(params);
nsDisplayMaskGeometry::UpdateDrawResult(this, imgParmas.result);
- return imgParmas.result == mozilla::image::DrawResult::SUCCESS;
+ return imgParmas.result == mozilla::image::ImgDrawResult::SUCCESS;
}
LayerState
nsDisplayMask::GetLayerState(nsDisplayListBuilder* aBuilder,
LayerManager* aManager,
const ContainerLayerParameters& aParameters)
{
if (CanPaintOnMaskLayer(aManager)) {
--- a/layout/painting/nsDisplayList.h
+++ b/layout/painting/nsDisplayList.h
@@ -1879,17 +1879,17 @@ public:
typedef mozilla::layers::FrameMetrics::ViewID ViewID;
typedef mozilla::layers::Layer Layer;
typedef mozilla::layers::LayerManager LayerManager;
typedef mozilla::layers::StackingContextHelper StackingContextHelper;
typedef mozilla::layers::WebRenderCommand WebRenderCommand;
typedef mozilla::layers::WebRenderParentCommand WebRenderParentCommand;
typedef mozilla::LayerState LayerState;
typedef mozilla::image::imgDrawingParams imgDrawingParams;
- typedef mozilla::image::DrawResult DrawResult;
+ typedef mozilla::image::ImgDrawResult ImgDrawResult;
typedef class mozilla::gfx::DrawTarget DrawTarget;
// This is never instantiated directly (it has pure virtual methods), so no
// need to count constructors and destructors.
nsDisplayItem(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame);
nsDisplayItem(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
const ActiveScrolledRoot* aActiveScrolledRoot);
--- a/layout/painting/nsDisplayListInvalidation.h
+++ b/layout/painting/nsDisplayListInvalidation.h
@@ -100,17 +100,17 @@ bool ShouldSyncDecodeImages(nsDisplayLis
* that is inheriting from it. See nsDisplayItemGenericImageGeometry for an
* example.
*/
template <typename T>
class nsImageGeometryMixin
{
public:
nsImageGeometryMixin(nsDisplayItem* aItem, nsDisplayListBuilder* aBuilder)
- : mLastDrawResult(mozilla::image::DrawResult::NOT_READY)
+ : mLastDrawResult(mozilla::image::ImgDrawResult::NOT_READY)
, mWaitingForPaint(false)
{
// Transfer state from the previous version of this geometry item.
auto lastGeometry =
static_cast<T*>(mozilla::FrameLayerBuilder::GetMostRecentGeometry(aItem));
if (lastGeometry) {
mLastDrawResult = lastGeometry->mLastDrawResult;
mWaitingForPaint = lastGeometry->mWaitingForPaint;
@@ -121,17 +121,17 @@ public:
// painted, UpdateDrawResult will get called, and we'll clear the flag.
if (ShouldSyncDecodeImages(aBuilder) &&
ShouldInvalidateToSyncDecodeImages()) {
mWaitingForPaint = true;
}
}
static void UpdateDrawResult(nsDisplayItem* aItem,
- mozilla::image::DrawResult aResult)
+ mozilla::image::ImgDrawResult aResult)
{
auto lastGeometry =
static_cast<T*>(mozilla::FrameLayerBuilder::GetMostRecentGeometry(aItem));
if (lastGeometry) {
lastGeometry->mLastDrawResult = aResult;
lastGeometry->mWaitingForPaint = false;
}
}
@@ -142,26 +142,26 @@ public:
// We previously invalidated for sync decoding and haven't gotten painted
// since them. This suggests that our display item is completely occluded
// and there's no point in invalidating again - and because the reftest
// harness takes a new snapshot every time we invalidate, doing so might
// lead to an invalidation loop if we're in a reftest.
return false;
}
- if (mLastDrawResult == mozilla::image::DrawResult::SUCCESS ||
- mLastDrawResult == mozilla::image::DrawResult::BAD_IMAGE) {
+ if (mLastDrawResult == mozilla::image::ImgDrawResult::SUCCESS ||
+ mLastDrawResult == mozilla::image::ImgDrawResult::BAD_IMAGE) {
return false;
}
return true;
}
private:
- mozilla::image::DrawResult mLastDrawResult;
+ mozilla::image::ImgDrawResult mLastDrawResult;
bool mWaitingForPaint;
};
/**
* nsDisplayItemGenericImageGeometry is a generic geometry item class that
* includes nsImageGeometryMixin.
*
* This should be sufficient for most display items that draw images.
--- a/layout/painting/nsImageRenderer.cpp
+++ b/layout/painting/nsImageRenderer.cpp
@@ -55,17 +55,17 @@ nsImageRenderer::nsImageRenderer(nsIFram
const nsStyleImage* aImage,
uint32_t aFlags)
: mForFrame(aForFrame)
, mImage(aImage)
, mType(aImage->GetType())
, mImageContainer(nullptr)
, mGradientData(nullptr)
, mPaintServerFrame(nullptr)
- , mPrepareResult(DrawResult::NOT_READY)
+ , mPrepareResult(ImgDrawResult::NOT_READY)
, mSize(0, 0)
, mFlags(aFlags)
, mExtendMode(ExtendMode::CLAMP)
, mMaskOp(NS_STYLE_MASK_MODE_MATCH_SOURCE)
{
}
nsImageRenderer::~nsImageRenderer()
@@ -110,31 +110,31 @@ ShouldTreatAsCompleteDueToSyncDecode(con
return true;
}
bool
nsImageRenderer::PrepareImage()
{
if (mImage->IsEmpty()) {
- mPrepareResult = DrawResult::BAD_IMAGE;
+ mPrepareResult = ImgDrawResult::BAD_IMAGE;
return false;
}
if (!mImage->IsComplete()) {
// Make sure the image is actually decoding.
bool frameComplete = mImage->StartDecoding();
// Check again to see if we finished.
// We cannot prepare the image for rendering if it is not fully loaded.
// Special case: If we requested a sync decode and the image has loaded, push
// on through because the Draw() will do a sync decode then.
if (!(frameComplete || mImage->IsComplete()) &&
!ShouldTreatAsCompleteDueToSyncDecode(mImage, mFlags)) {
- mPrepareResult = DrawResult::NOT_READY;
+ mPrepareResult = ImgDrawResult::NOT_READY;
return false;
}
}
switch (mType) {
case eStyleImageType_Image: {
MOZ_ASSERT(mImage->GetImageData(),
"must have image data, since we checked IsEmpty above");
@@ -149,71 +149,71 @@ nsImageRenderer::PrepareImage()
mImageContainer.swap(srcImage);
} else {
nsIntRect actualCropRect;
bool isEntireImage;
bool success =
mImage->ComputeActualCropRect(actualCropRect, &isEntireImage);
if (!success || actualCropRect.IsEmpty()) {
// The cropped image has zero size
- mPrepareResult = DrawResult::BAD_IMAGE;
+ mPrepareResult = ImgDrawResult::BAD_IMAGE;
return false;
}
if (isEntireImage) {
// The cropped image is identical to the source image
mImageContainer.swap(srcImage);
} else {
nsCOMPtr<imgIContainer> subImage = ImageOps::Clip(srcImage,
actualCropRect,
Nothing());
mImageContainer.swap(subImage);
}
}
- mPrepareResult = DrawResult::SUCCESS;
+ mPrepareResult = ImgDrawResult::SUCCESS;
break;
}
case eStyleImageType_Gradient:
mGradientData = mImage->GetGradientData();
- mPrepareResult = DrawResult::SUCCESS;
+ mPrepareResult = ImgDrawResult::SUCCESS;
break;
case eStyleImageType_Element:
{
nsAutoString elementId =
NS_LITERAL_STRING("#") + nsDependentAtomString(mImage->GetElementId());
nsCOMPtr<nsIURI> targetURI;
nsCOMPtr<nsIURI> base = mForFrame->GetContent()->GetBaseURI();
nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(targetURI), elementId,
mForFrame->GetContent()->GetUncomposedDoc(), base);
nsSVGPaintingProperty* property = SVGObserverUtils::GetPaintingPropertyForURI(
targetURI, mForFrame->FirstContinuation(),
SVGObserverUtils::BackgroundImageProperty());
if (!property) {
- mPrepareResult = DrawResult::BAD_IMAGE;
+ mPrepareResult = ImgDrawResult::BAD_IMAGE;
return false;
}
// If the referenced element is an <img>, <canvas>, or <video> element,
// prefer SurfaceFromElement as it's more reliable.
mImageElementSurface =
nsLayoutUtils::SurfaceFromElement(property->GetReferencedElement());
if (!mImageElementSurface.GetSourceSurface()) {
nsIFrame* paintServerFrame = property->GetReferencedFrame();
// If there's no referenced frame, or the referenced frame is
// non-displayable SVG, then we have nothing valid to paint.
if (!paintServerFrame ||
(paintServerFrame->IsFrameOfType(nsIFrame::eSVG) &&
!paintServerFrame->IsFrameOfType(nsIFrame::eSVGPaintServer) &&
!static_cast<nsSVGDisplayableFrame*>(do_QueryFrame(paintServerFrame)))) {
- mPrepareResult = DrawResult::BAD_IMAGE;
+ mPrepareResult = ImgDrawResult::BAD_IMAGE;
return false;
}
mPaintServerFrame = paintServerFrame;
}
- mPrepareResult = DrawResult::SUCCESS;
+ mPrepareResult = ImgDrawResult::SUCCESS;
break;
}
case eStyleImageType_Null:
default:
break;
}
return IsReady();
@@ -436,60 +436,60 @@ ConvertImageRendererToDrawFlags(uint32_t
drawFlags |= imgIContainer::FLAG_SYNC_DECODE;
}
if (aImageRendererFlags & nsImageRenderer::FLAG_PAINTING_TO_WINDOW) {
drawFlags |= imgIContainer::FLAG_HIGH_QUALITY_SCALING;
}
return drawFlags;
}
-DrawResult
+ImgDrawResult
nsImageRenderer::Draw(nsPresContext* aPresContext,
gfxContext& aRenderingContext,
const nsRect& aDirtyRect,
const nsRect& aDest,
const nsRect& aFill,
const nsPoint& aAnchor,
const nsSize& aRepeatSize,
const CSSIntRect& aSrc,
float aOpacity)
{
if (!IsReady()) {
NS_NOTREACHED("Ensure PrepareImage() has returned true before calling me");
- return DrawResult::TEMPORARY_ERROR;
+ return ImgDrawResult::TEMPORARY_ERROR;
}
if (aDest.IsEmpty() || aFill.IsEmpty() ||
mSize.width <= 0 || mSize.height <= 0) {
- return DrawResult::SUCCESS;
+ return ImgDrawResult::SUCCESS;
}
SamplingFilter samplingFilter = nsLayoutUtils::GetSamplingFilterForFrame(mForFrame);
- DrawResult result = DrawResult::SUCCESS;
+ ImgDrawResult result = ImgDrawResult::SUCCESS;
RefPtr<gfxContext> ctx = &aRenderingContext;
IntRect tmpDTRect;
if (ctx->CurrentOp() != CompositionOp::OP_OVER || mMaskOp == NS_STYLE_MASK_MODE_LUMINANCE) {
gfxRect clipRect = ctx->GetClipExtents(gfxContext::eDeviceSpace);
tmpDTRect = RoundedOut(ToRect(clipRect));
if (tmpDTRect.IsEmpty()) {
- return DrawResult::SUCCESS;
+ return ImgDrawResult::SUCCESS;
}
RefPtr<DrawTarget> tempDT =
gfxPlatform::GetPlatform()->CreateSimilarSoftwareDrawTarget(ctx->GetDrawTarget(),
tmpDTRect.Size(),
SurfaceFormat::B8G8R8A8);
if (!tempDT || !tempDT->IsValid()) {
gfxDevCrash(LogReason::InvalidContext) << "ImageRenderer::Draw problem " << gfx::hexa(tempDT);
- return DrawResult::TEMPORARY_ERROR;
+ return ImgDrawResult::TEMPORARY_ERROR;
}
tempDT->SetTransform(ctx->GetDrawTarget()->GetTransform() * Matrix::Translation(-tmpDTRect.TopLeft()));
ctx = gfxContext::CreatePreservingTransformOrNull(tempDT);
if (!ctx) {
gfxDevCrash(LogReason::InvalidContext) << "ImageRenderer::Draw problem " << gfx::hexa(tempDT);
- return DrawResult::TEMPORARY_ERROR;
+ return ImgDrawResult::TEMPORARY_ERROR;
}
}
switch (mType) {
case eStyleImageType_Image:
{
CSSIntSize imageSize(nsPresContext::AppUnitsToIntCSSPixels(mSize.width),
nsPresContext::AppUnitsToIntCSSPixels(mSize.height));
@@ -512,17 +512,17 @@ nsImageRenderer::Draw(nsPresContext*
renderer.Paint(*ctx, aDest, aFill, aRepeatSize, aSrc, aDirtyRect, aOpacity);
break;
}
case eStyleImageType_Element:
{
RefPtr<gfxDrawable> drawable = DrawableForElement(aDest, *ctx);
if (!drawable) {
NS_WARNING("Could not create drawable for element");
- return DrawResult::TEMPORARY_ERROR;
+ return ImgDrawResult::TEMPORARY_ERROR;
}
nsCOMPtr<imgIContainer> image(ImageOps::CreateFromDrawable(drawable));
result =
nsLayoutUtils::DrawImage(*ctx, mForFrame->StyleContext(),
aPresContext, image,
samplingFilter, aDest, aFill, aAnchor, aDirtyRect,
ConvertImageRendererToDrawFlags(mFlags),
@@ -551,38 +551,38 @@ nsImageRenderer::Draw(nsPresContext*
}
dt->SetTransform(oldTransform);
}
return result;
}
-DrawResult
+ImgDrawResult
nsImageRenderer::BuildWebRenderDisplayItems(nsPresContext* aPresContext,
mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources,
const mozilla::layers::StackingContextHelper& aSc,
mozilla::layers::WebRenderLayerManager* aManager,
nsDisplayItem* aItem,
const nsRect& aDirtyRect,
const nsRect& aDest,
const nsRect& aFill,
const nsPoint& aAnchor,
const nsSize& aRepeatSize,
const CSSIntRect& aSrc,
float aOpacity)
{
if (!IsReady()) {
NS_NOTREACHED("Ensure PrepareImage() has returned true before calling me");
- return DrawResult::NOT_READY;
+ return ImgDrawResult::NOT_READY;
}
if (aDest.IsEmpty() || aFill.IsEmpty() ||
mSize.width <= 0 || mSize.height <= 0) {
- return DrawResult::SUCCESS;
+ return ImgDrawResult::SUCCESS;
}
switch (mType) {
case eStyleImageType_Gradient:
{
nsCSSGradientRenderer renderer =
nsCSSGradientRenderer::Create(aPresContext, mGradientData, mSize);
@@ -606,25 +606,25 @@ nsImageRenderer::BuildWebRenderDisplayIt
Maybe<SVGImageContext> svgContext;
gfx::IntSize decodeSize =
nsLayoutUtils::ComputeImageContainerDrawingParameters(mImageContainer, mForFrame, destRect,
aSc, containerFlags, svgContext);
RefPtr<layers::ImageContainer> container =
mImageContainer->GetImageContainerAtSize(aManager, decodeSize, svgContext, containerFlags);
if (!container) {
NS_WARNING("Failed to get image container");
- return DrawResult::NOT_READY;
+ return ImgDrawResult::NOT_READY;
}
gfx::IntSize size;
Maybe<wr::ImageKey> key = aManager->CommandBuilder().CreateImageKey(aItem, container, aBuilder,
aResources, aSc, size, Nothing());
if (key.isNothing()) {
- return DrawResult::BAD_IMAGE;
+ return ImgDrawResult::BAD_IMAGE;
}
nsPoint firstTilePos = nsLayoutUtils::GetBackgroundFirstTilePos(aDest.TopLeft(),
aFill.TopLeft(),
aRepeatSize);
LayoutDeviceRect fillRect = LayoutDeviceRect::FromAppUnits(
nsRect(firstTilePos.x, firstTilePos.y,
aFill.XMost() - firstTilePos.x, aFill.YMost() - firstTilePos.y),
@@ -641,28 +641,28 @@ nsImageRenderer::BuildWebRenderDisplayIt
wr::ToLayoutSize(destRect.Size()), wr::ToLayoutSize(gapSize),
wr::ToImageRendering(samplingFilter), key.value());
break;
}
default:
break;
}
- return DrawResult::SUCCESS;
+ return ImgDrawResult::SUCCESS;
}
already_AddRefed<gfxDrawable>
nsImageRenderer::DrawableForElement(const nsRect& aImageRect,
gfxContext& aContext)
{
NS_ASSERTION(mType == eStyleImageType_Element,
"DrawableForElement only makes sense if backed by an element");
if (mPaintServerFrame) {
// XXX(seth): In order to not pass FLAG_SYNC_DECODE_IMAGES here,
- // DrawableFromPaintServer would have to return a DrawResult indicating
+ // DrawableFromPaintServer would have to return a ImgDrawResult indicating
// whether any images could not be painted because they weren't fully
// decoded. Even always passing FLAG_SYNC_DECODE_IMAGES won't eliminate all
// problems, as it won't help if there are image which haven't finished
// loading, but it's better than nothing.
int32_t appUnitsPerDevPixel = mForFrame->PresContext()->AppUnitsPerDevPixel();
nsRect destRect = aImageRect - aImageRect.TopLeft();
nsIntSize roundedOut = destRect.ToOutsidePixels(appUnitsPerDevPixel).Size();
IntSize imageSize(roundedOut.width, roundedOut.height);
@@ -677,44 +677,44 @@ nsImageRenderer::DrawableForElement(cons
}
NS_ASSERTION(mImageElementSurface.GetSourceSurface(), "Surface should be ready.");
RefPtr<gfxDrawable> drawable = new gfxSurfaceDrawable(
mImageElementSurface.GetSourceSurface().get(),
mImageElementSurface.mSize);
return drawable.forget();
}
-DrawResult
+ImgDrawResult
nsImageRenderer::DrawLayer(nsPresContext* aPresContext,
gfxContext& aRenderingContext,
const nsRect& aDest,
const nsRect& aFill,
const nsPoint& aAnchor,
const nsRect& aDirty,
const nsSize& aRepeatSize,
float aOpacity)
{
if (!IsReady()) {
NS_NOTREACHED("Ensure PrepareImage() has returned true before calling me");
- return DrawResult::TEMPORARY_ERROR;
+ return ImgDrawResult::TEMPORARY_ERROR;
}
if (aDest.IsEmpty() || aFill.IsEmpty() ||
mSize.width <= 0 || mSize.height <= 0) {
- return DrawResult::SUCCESS;
+ return ImgDrawResult::SUCCESS;
}
return Draw(aPresContext, aRenderingContext,
aDirty, aDest, aFill, aAnchor, aRepeatSize,
CSSIntRect(0, 0,
nsPresContext::AppUnitsToIntCSSPixels(mSize.width),
nsPresContext::AppUnitsToIntCSSPixels(mSize.height)),
aOpacity);
}
-DrawResult
+ImgDrawResult
nsImageRenderer::BuildWebRenderDisplayItemsForLayer(nsPresContext* aPresContext,
mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources,
const mozilla::layers::StackingContextHelper& aSc,
mozilla::layers::WebRenderLayerManager* aManager,
nsDisplayItem* aItem,
const nsRect& aDest,
const nsRect& aFill,
@@ -724,17 +724,17 @@ nsImageRenderer::BuildWebRenderDisplayIt
float aOpacity)
{
if (!IsReady()) {
NS_NOTREACHED("Ensure PrepareImage() has returned true before calling me");
return mPrepareResult;
}
if (aDest.IsEmpty() || aFill.IsEmpty() ||
mSize.width <= 0 || mSize.height <= 0) {
- return DrawResult::SUCCESS;
+ return ImgDrawResult::SUCCESS;
}
return BuildWebRenderDisplayItems(aPresContext, aBuilder, aResources, aSc,
aManager, aItem,
aDirty, aDest, aFill, aAnchor, aRepeatSize,
CSSIntRect(0, 0,
nsPresContext::AppUnitsToIntCSSPixels(mSize.width),
nsPresContext::AppUnitsToIntCSSPixels(mSize.height)),
aOpacity);
@@ -839,35 +839,35 @@ RequiresScaling(const nsRect& aFi
// If we have no tiling in either direction, we can skip the intermediate
// scaling step.
return (aHFill != NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH ||
aVFill != NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH) &&
(aUnitSize.width != aFill.width ||
aUnitSize.height != aFill.height);
}
-DrawResult
+ImgDrawResult
nsImageRenderer::DrawBorderImageComponent(nsPresContext* aPresContext,
gfxContext& aRenderingContext,
const nsRect& aDirtyRect,
const nsRect& aFill,
const CSSIntRect& aSrc,
uint8_t aHFill,
uint8_t aVFill,
const nsSize& aUnitSize,
uint8_t aIndex,
const Maybe<nsSize>& aSVGViewportSize,
const bool aHasIntrinsicRatio)
{
if (!IsReady()) {
NS_NOTREACHED("Ensure PrepareImage() has returned true before calling me");
- return DrawResult::BAD_ARGS;
+ return ImgDrawResult::BAD_ARGS;
}
if (aFill.IsEmpty() || aSrc.IsEmpty()) {
- return DrawResult::SUCCESS;
+ return ImgDrawResult::SUCCESS;
}
if (mType == eStyleImageType_Image || mType == eStyleImageType_Element) {
nsCOMPtr<imgIContainer> subImage;
// To draw one portion of an image into a border component, we stretch that
// portion to match the size of that border component and then draw onto.
// However, preserveAspectRatio attribute of a SVG image may break this rule.
@@ -898,17 +898,17 @@ nsImageRenderer::DrawBorderImageComponen
// invalidate that cache, and it's not clear that it's worth the trouble
// since using border-image with -moz-element is rare.
RefPtr<gfxDrawable> drawable =
DrawableForElement(nsRect(nsPoint(), mSize),
aRenderingContext);
if (!drawable) {
NS_WARNING("Could not create drawable for element");
- return DrawResult::TEMPORARY_ERROR;
+ return ImgDrawResult::TEMPORARY_ERROR;
}
nsCOMPtr<imgIContainer> image(ImageOps::CreateFromDrawable(drawable));
subImage = ImageOps::Clip(image, srcRect, aSVGViewportSize);
}
MOZ_ASSERT(!aSVGViewportSize ||
subImage->GetType() == imgIContainer::TYPE_VECTOR);
--- a/layout/painting/nsImageRenderer.h
+++ b/layout/painting/nsImageRenderer.h
@@ -96,17 +96,17 @@ struct CSSSizeOrRatio
* nsStyleImage image, which may internally be a real image, a sub image, or a
* CSS gradient.
*
* @note Always call the member functions in the order of PrepareImage(),
* SetSize(), and Draw*().
*/
class nsImageRenderer {
public:
- typedef mozilla::image::DrawResult DrawResult;
+ typedef mozilla::image::ImgDrawResult ImgDrawResult;
typedef mozilla::layers::LayerManager LayerManager;
typedef mozilla::layers::ImageContainer ImageContainer;
enum {
FLAG_SYNC_DECODE_IMAGES = 0x01,
FLAG_PAINTING_TO_WINDOW = 0x02
};
enum FitType
@@ -190,31 +190,31 @@ public:
void SetPreferredSize(const mozilla::CSSSizeOrRatio& aIntrinsicSize,
const nsSize& aDefaultSize);
/**
* Draws the image to the target rendering context using
* {background|mask}-specific arguments.
* @see nsLayoutUtils::DrawImage() for parameters.
*/
- DrawResult DrawLayer(nsPresContext* aPresContext,
+ ImgDrawResult DrawLayer(nsPresContext* aPresContext,
gfxContext& aRenderingContext,
const nsRect& aDest,
const nsRect& aFill,
const nsPoint& aAnchor,
const nsRect& aDirty,
const nsSize& aRepeatSize,
float aOpacity);
/**
* Builds WebRender DisplayItems for an image using
* {background|mask}-specific arguments.
* @see nsLayoutUtils::DrawImage() for parameters.
*/
- DrawResult BuildWebRenderDisplayItemsForLayer(nsPresContext* aPresContext,
+ ImgDrawResult BuildWebRenderDisplayItemsForLayer(nsPresContext* aPresContext,
mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResource,
const mozilla::layers::StackingContextHelper& aSc,
mozilla::layers::WebRenderLayerManager* aManager,
nsDisplayItem* aItem,
const nsRect& aDest,
const nsRect& aFill,
const nsPoint& aAnchor,
@@ -236,17 +236,17 @@ public:
* 6 7 8
* aSVGViewportSize The image size evaluated by default sizing algorithm.
* Pass Nothing() if we can read a valid viewport size or aspect-ratio from
* the drawing image directly, otherwise, pass Some() with viewport size
* evaluated from default sizing algorithm.
* aHasIntrinsicRatio is used to record if the source image has fixed
* intrinsic ratio.
*/
- DrawResult
+ ImgDrawResult
DrawBorderImageComponent(nsPresContext* aPresContext,
gfxContext& aRenderingContext,
const nsRect& aDirtyRect,
const nsRect& aFill,
const mozilla::CSSIntRect& aSrc,
uint8_t aHFill,
uint8_t aVFill,
const nsSize& aUnitSize,
@@ -256,51 +256,51 @@ public:
bool IsRasterImage();
bool IsAnimatedImage();
/// Retrieves the image associated with this nsImageRenderer, if there is one.
already_AddRefed<imgIContainer> GetImage();
bool IsImageContainerAvailable(layers::LayerManager* aManager, uint32_t aFlags);
- bool IsReady() const { return mPrepareResult == DrawResult::SUCCESS; }
- DrawResult PrepareResult() const { return mPrepareResult; }
+ bool IsReady() const { return mPrepareResult == ImgDrawResult::SUCCESS; }
+ ImgDrawResult PrepareResult() const { return mPrepareResult; }
void SetExtendMode(mozilla::gfx::ExtendMode aMode) { mExtendMode = aMode; }
void SetMaskOp(uint8_t aMaskOp) { mMaskOp = aMaskOp; }
void PurgeCacheForViewportChange(const mozilla::Maybe<nsSize>& aSVGViewportSize,
const bool aHasRatio);
nsStyleImageType GetType() const { return mType; }
already_AddRefed<nsStyleGradient> GetGradientData();
private:
/**
* Draws the image to the target rendering context.
* aSrc is a rect on the source image which will be mapped to aDest; it's
* currently only used for gradients.
*
* @see nsLayoutUtils::DrawImage() for other parameters.
*/
- DrawResult Draw(nsPresContext* aPresContext,
+ ImgDrawResult Draw(nsPresContext* aPresContext,
gfxContext& aRenderingContext,
const nsRect& aDirtyRect,
const nsRect& aDest,
const nsRect& aFill,
const nsPoint& aAnchor,
const nsSize& aRepeatSize,
const mozilla::CSSIntRect& aSrc,
float aOpacity = 1.0);
/**
* Builds WebRender DisplayItems for the image.
* aSrc is a rect on the source image which will be mapped to aDest; it's
* currently only used for gradients.
*
* @see nsLayoutUtils::DrawImage() for other parameters.
*/
- DrawResult BuildWebRenderDisplayItems(nsPresContext* aPresContext,
+ ImgDrawResult BuildWebRenderDisplayItems(nsPresContext* aPresContext,
mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources,
const mozilla::layers::StackingContextHelper& aSc,
mozilla::layers::WebRenderLayerManager* aManager,
nsDisplayItem* aItem,
const nsRect& aDirtyRect,
const nsRect& aDest,
const nsRect& aFill,
@@ -320,17 +320,17 @@ private:
nsIFrame* mForFrame;
const nsStyleImage* mImage;
nsStyleImageType mType;
nsCOMPtr<imgIContainer> mImageContainer;
RefPtr<nsStyleGradient> mGradientData;
nsIFrame* mPaintServerFrame;
nsLayoutUtils::SurfaceFromElementResult mImageElementSurface;
- DrawResult mPrepareResult;
+ ImgDrawResult mPrepareResult;
nsSize mSize; // unscaled size of the image, in app units
uint32_t mFlags;
mozilla::gfx::ExtendMode mExtendMode;
uint8_t mMaskOp;
};
} // namespace mozilla
--- a/layout/svg/SVGContextPaint.h
+++ b/layout/svg/SVGContextPaint.h
@@ -13,17 +13,17 @@
#include "gfxTypes.h"
#include "gfxUtils.h"
#include "mozilla/AlreadyAddRefed.h"
#include "mozilla/Assertions.h"
#include "mozilla/gfx/2D.h"
#include "nsColor.h"
#include "nsStyleStruct.h"
#include "nsTArray.h"
-#include "DrawResult.h"
+#include "ImgDrawResult.h"
class gfxContext;
class nsIDocument;
class nsSVGPaintServerFrame;
namespace mozilla {
/**
--- a/layout/svg/nsFilterInstance.cpp
+++ b/layout/svg/nsFilterInstance.cpp
@@ -6,17 +6,17 @@
// Main header first:
#include "nsFilterInstance.h"
// MFBT headers next:
#include "mozilla/UniquePtr.h"
// Keep others in (case-insensitive) order:
-#include "DrawResult.h"
+#include "ImgDrawResult.h"
#include "gfx2DGlue.h"
#include "gfxContext.h"
#include "gfxPlatform.h"
#include "gfxUtils.h"
#include "mozilla/gfx/Helpers.h"
#include "mozilla/gfx/PatternHelpers.h"
#include "nsSVGDisplayableFrame.h"
#include "nsCSSFilterInstance.h"
--- a/layout/svg/nsSVGClipPathFrame.cpp
+++ b/layout/svg/nsSVGClipPathFrame.cpp
@@ -4,17 +4,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Main header first:
#include "nsSVGClipPathFrame.h"
// Keep others in (case-insensitive) order:
#include "AutoReferenceChainGuard.h"
-#include "DrawResult.h"
+#include "ImgDrawResult.h"
#include "gfxContext.h"
#include "mozilla/dom/SVGClipPathElement.h"
#include "nsGkAtoms.h"
#include "SVGObserverUtils.h"
#include "SVGGeometryElement.h"
#include "SVGGeometryFrame.h"
#include "nsSVGUtils.h"
--- a/layout/svg/nsSVGContainerFrame.cpp
+++ b/layout/svg/nsSVGContainerFrame.cpp
@@ -3,17 +3,17 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Main header first:
#include "nsSVGContainerFrame.h"
// Keep others in (case-insensitive) order:
-#include "DrawResult.h"
+#include "ImgDrawResult.h"
#include "mozilla/RestyleManager.h"
#include "mozilla/RestyleManagerInlines.h"
#include "nsCSSFrameConstructor.h"
#include "SVGObserverUtils.h"
#include "nsSVGElement.h"
#include "nsSVGUtils.h"
#include "nsSVGAnimatedTransformList.h"
#include "SVGTextFrame.h"
--- a/layout/svg/nsSVGForeignObjectFrame.cpp
+++ b/layout/svg/nsSVGForeignObjectFrame.cpp
@@ -3,17 +3,17 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Main header first:
#include "nsSVGForeignObjectFrame.h"
// Keep others in (case-insensitive) order:
-#include "DrawResult.h"
+#include "ImgDrawResult.h"
#include "gfxContext.h"
#include "nsDisplayList.h"
#include "nsGkAtoms.h"
#include "nsNameSpaceManager.h"
#include "nsLayoutUtils.h"
#include "nsRegion.h"
#include "nsSVGContainerFrame.h"
#include "SVGObserverUtils.h"
--- a/layout/svg/nsSVGIntegrationUtils.cpp
+++ b/layout/svg/nsSVGIntegrationUtils.cpp
@@ -499,17 +499,17 @@ PaintMaskSurface(const PaintFramesParams
nsCSSRendering::PAINTBG_MASK_IMAGE,
i, compositionOp,
aOpacity);
aParams.imgParams.result &=
nsCSSRendering::PaintStyleImageLayerWithSC(params, *maskContext, aSC,
*aParams.frame->StyleBorder());
} else {
- aParams.imgParams.result &= DrawResult::NOT_READY;
+ aParams.imgParams.result &= ImgDrawResult::NOT_READY;
}
}
}
struct MaskPaintResult {
RefPtr<SourceSurface> maskSurface;
Matrix maskTransform;
bool transparentBlackMask;
@@ -576,17 +576,17 @@ CreateAndPaintMaskSurface(const PaintFra
Matrix maskSurfaceMatrix =
ctx.CurrentMatrix() * Matrix::Translation(-aParams.maskRect.TopLeft());
PaintMaskSurface(aParams, maskDT,
paintResult.opacityApplied ? aOpacity : 1.0,
aSC, aMaskFrames, maskSurfaceMatrix,
aOffsetToUserSpace);
- if (aParams.imgParams.result != DrawResult::SUCCESS) {
+ if (aParams.imgParams.result != ImgDrawResult::SUCCESS) {
// Now we know the status of mask resource since we used it while painting.
// According to the return value of PaintMaskSurface, we know whether mask
// resource is resolvable or not.
//
// For a HTML doc:
// According to css-masking spec, always create a mask surface when
// we have any item in maskFrame even if all of those items are
// non-resolvable <mask-sources> or <images>.
--- a/layout/svg/nsSVGIntegrationUtils.h
+++ b/layout/svg/nsSVGIntegrationUtils.h
@@ -2,17 +2,17 @@
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef NSSVGINTEGRATIONUTILS_H_
#define NSSVGINTEGRATIONUTILS_H_
-#include "DrawResult.h"
+#include "ImgDrawResult.h"
#include "gfxMatrix.h"
#include "gfxRect.h"
#include "nsRegionFwd.h"
#include "mozilla/gfx/Rect.h"
class gfxContext;
class gfxDrawable;
class nsDisplayList;
--- a/layout/svg/nsSVGMaskFrame.cpp
+++ b/layout/svg/nsSVGMaskFrame.cpp
@@ -68,17 +68,17 @@ nsSVGMaskFrame::GetMaskForMaskedFrame(Ma
maskSurfaceRect.RoundOut();
context->Restore();
bool resultOverflows;
IntSize maskSurfaceSize =
nsSVGUtils::ConvertToSurfaceSize(maskSurfaceRect.Size(), &resultOverflows);
if (resultOverflows || maskSurfaceSize.IsEmpty()) {
- // Return value other then DrawResult::SUCCESS, so the caller can skip
+ // Return value other then ImgDrawResult::SUCCESS, so the caller can skip
// painting the masked frame(aParams.maskedFrame).
return nullptr;
}
uint8_t maskType;
if (aParams.maskMode == NS_STYLE_MASK_MODE_MATCH_SOURCE) {
maskType = StyleSVGReset()->mMaskType;
} else {
--- a/layout/svg/nsSVGUtils.h
+++ b/layout/svg/nsSVGUtils.h
@@ -6,17 +6,17 @@
#ifndef NS_SVGUTILS_H
#define NS_SVGUTILS_H
// include math.h to pick up definition of M_ maths defines e.g. M_PI
#include <math.h>
#include "DrawMode.h"
-#include "DrawResult.h"
+#include "ImgDrawResult.h"
#include "gfx2DGlue.h"
#include "gfxMatrix.h"
#include "gfxPoint.h"
#include "gfxRect.h"
#include "mozilla/gfx/Rect.h"
#include "nsAlgorithm.h"
#include "nsChangeHint.h"
#include "nsColor.h"
--- a/layout/tables/nsTableCellFrame.cpp
+++ b/layout/tables/nsTableCellFrame.cpp
@@ -361,17 +361,17 @@ nsTableCellFrame::DecorateForSelection(D
StrokeLineWithSnapping(nsPoint(mRect.width - (2*onePixel), 2*onePixel),
nsPoint(mRect.width - (2*onePixel), mRect.height-onePixel),
appUnitsPerDevPixel, *aDrawTarget, color);
}
}
}
}
-DrawResult
+ImgDrawResult
nsTableCellFrame::PaintBackground(gfxContext& aRenderingContext,
const nsRect& aDirtyRect,
nsPoint aPt,
uint32_t aFlags)
{
nsRect rect(aPt, GetSize());
nsCSSRendering::PaintBGParams params =
nsCSSRendering::PaintBGParams::ForAllLayers(*PresContext(),
@@ -421,17 +421,17 @@ public:
virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder,
bool* aSnap) const override;
NS_DISPLAY_DECL_NAME("TableCellBackground", TYPE_TABLE_CELL_BACKGROUND)
};
void nsDisplayTableCellBackground::Paint(nsDisplayListBuilder* aBuilder,
gfxContext* aCtx)
{
- DrawResult result = static_cast<nsTableCellFrame*>(mFrame)->
+ ImgDrawResult result = static_cast<nsTableCellFrame*>(mFrame)->
PaintBackground(*aCtx, mVisibleRect, ToReferenceFrame(),
aBuilder->GetBackgroundPaintFlags());
nsDisplayTableItemGeometry::UpdateDrawResult(this, result);
}
nsRect
nsDisplayTableCellBackground::GetBounds(nsDisplayListBuilder* aBuilder,
@@ -1168,17 +1168,17 @@ nsBCTableCellFrame::GetBorderOverflow()
LogicalMargin halfBorder(wm,
BC_BORDER_START_HALF_COORD(d2a, mBStartBorder),
BC_BORDER_END_HALF_COORD(d2a, mIEndBorder),
BC_BORDER_END_HALF_COORD(d2a, mBEndBorder),
BC_BORDER_START_HALF_COORD(d2a, mIStartBorder));
return halfBorder.GetPhysicalMargin(wm);
}
-DrawResult
+ImgDrawResult
nsBCTableCellFrame::PaintBackground(gfxContext& aRenderingContext,
const nsRect& aDirtyRect,
nsPoint aPt,
uint32_t aFlags)
{
// make border-width reflect the half of the border-collapse
// assigned border that's inside the cell
WritingMode wm = GetWritingMode();
--- a/layout/tables/nsTableCellFrame.h
+++ b/layout/tables/nsTableCellFrame.h
@@ -30,17 +30,17 @@
*
* @author sclark
*/
class nsTableCellFrame : public nsContainerFrame,
public nsITableCellLayout,
public nsIPercentBSizeObserver
{
typedef mozilla::gfx::DrawTarget DrawTarget;
- typedef mozilla::image::DrawResult DrawResult;
+ typedef mozilla::image::ImgDrawResult ImgDrawResult;
friend nsTableCellFrame* NS_NewTableCellFrame(nsIPresShell* aPresShell,
nsStyleContext* aContext,
nsTableFrame* aTableFrame);
nsTableCellFrame(nsStyleContext* aContext, nsTableFrame* aTableFrame)
: nsTableCellFrame(aContext, aTableFrame, kClassID) {}
@@ -224,17 +224,17 @@ public:
MOZ_ASSERT(cellFrame, "How do we have a non-cell sibling?");
}
#endif // DEBUG
return static_cast<nsTableCellFrame*>(sibling);
}
virtual LogicalMargin GetBorderWidth(WritingMode aWM) const;
- virtual DrawResult PaintBackground(gfxContext& aRenderingContext,
+ virtual ImgDrawResult PaintBackground(gfxContext& aRenderingContext,
const nsRect& aDirtyRect,
nsPoint aPt,
uint32_t aFlags);
void DecorateForSelection(DrawTarget* aDrawTarget, nsPoint aPt);
virtual bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) override;
@@ -317,17 +317,17 @@ inline void nsTableCellFrame::SetHasPctO
} else {
RemoveStateBits(NS_TABLE_CELL_HAS_PCT_OVER_BSIZE);
}
}
// nsBCTableCellFrame
class nsBCTableCellFrame final : public nsTableCellFrame
{
- typedef mozilla::image::DrawResult DrawResult;
+ typedef mozilla::image::ImgDrawResult ImgDrawResult;
public:
NS_DECL_FRAMEARENA_HELPERS(nsBCTableCellFrame)
nsBCTableCellFrame(nsStyleContext* aContext, nsTableFrame* aTableFrame);
~nsBCTableCellFrame();
virtual nsMargin GetUsedBorder() const override;
@@ -342,17 +342,17 @@ public:
void SetBorderWidth(LogicalSide aSide, BCPixelSize aPixelValue);
virtual nsMargin GetBorderOverflow() override;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
- virtual DrawResult PaintBackground(gfxContext& aRenderingContext,
+ virtual ImgDrawResult PaintBackground(gfxContext& aRenderingContext,
const nsRect& aDirtyRect,
nsPoint aPt,
uint32_t aFlags) override;
private:
// These are the entire width of the border (the cell edge contains only
// the inner half, per the macros in nsTablePainter.h).
--- a/layout/tables/nsTableFrame.h
+++ b/layout/tables/nsTableFrame.h
@@ -118,17 +118,17 @@ enum nsTableColType {
* Used as a pseudo-frame within nsTableWrapperFrame, it may also be used
* stand-alone as the top-level frame.
*
* The principal child list contains row group frames. There is also an
* additional child list, kColGroupList, which contains the col group frames.
*/
class nsTableFrame : public nsContainerFrame
{
- typedef mozilla::image::DrawResult DrawResult;
+ typedef mozilla::image::ImgDrawResult ImgDrawResult;
typedef mozilla::WritingMode WritingMode;
typedef mozilla::LogicalMargin LogicalMargin;
typedef mozilla::TableReflowInput TableReflowInput;
public:
NS_DECL_FRAMEARENA_HELPERS(nsTableFrame)
typedef nsTArray<nsIFrame*> FrameTArray;
--- a/layout/xul/nsGroupBoxFrame.cpp
+++ b/layout/xul/nsGroupBoxFrame.cpp
@@ -35,17 +35,17 @@ public:
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override {
return MakeFrameName(NS_LITERAL_STRING("GroupBoxFrame"), aResult);
}
#endif
virtual bool HonorPrintBackgroundSettings() override { return false; }
- DrawResult PaintBorder(gfxContext& aRenderingContext,
+ ImgDrawResult PaintBorder(gfxContext& aRenderingContext,
nsPoint aPt,
const nsRect& aDirtyRect);
nsRect GetBackgroundRectRelativeToSelf(nscoord* aOutYOffset = nullptr, nsRect* aOutGroupRect = nullptr);
// make sure we our kids get our orient and align instead of us.
// our child box has no content node so it will search for a parent with one.
// that will be us.
virtual void GetInitialOrientation(bool& aHorizontal) override { aHorizontal = false; }
@@ -133,17 +133,17 @@ nsDisplayXULGroupBorder::ComputeInvalida
nsDisplayItem::ComputeInvalidationRegion(aBuilder, aGeometry, aInvalidRegion);
}
void
nsDisplayXULGroupBorder::Paint(nsDisplayListBuilder* aBuilder,
gfxContext* aCtx)
{
- DrawResult result = static_cast<nsGroupBoxFrame*>(mFrame)
+ ImgDrawResult result = static_cast<nsGroupBoxFrame*>(mFrame)
->PaintBorder(*aCtx, ToReferenceFrame(), mVisibleRect);
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
}
void
nsGroupBoxFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists)
@@ -188,17 +188,17 @@ nsGroupBoxFrame::GetBackgroundRectRelati
}
if (aOutGroupRect) {
*aOutGroupRect = groupRect;
}
return nsRect(0, yoff, mRect.width, mRect.height - yoff);
}
-DrawResult
+ImgDrawResult
nsGroupBoxFrame::PaintBorder(gfxContext& aRenderingContext,
nsPoint aPt, const nsRect& aDirtyRect) {
DrawTarget* drawTarget = aRenderingContext.GetDrawTarget();
Sides skipSides;
const nsStyleBorder* borderStyleData = StyleBorder();
const nsMargin& border = borderStyleData->GetComputedBorder();
@@ -206,17 +206,17 @@ nsGroupBoxFrame::PaintBorder(gfxContext&
nsRect groupRect;
nsIFrame* groupBox = GetCaptionBox(groupRect);
nscoord yoff = 0;
nsRect rect = GetBackgroundRectRelativeToSelf(&yoff, &groupRect) + aPt;
groupRect += aPt;
- DrawResult result = DrawResult::SUCCESS;
+ ImgDrawResult result = ImgDrawResult::SUCCESS;
if (groupBox) {
int32_t appUnitsPerDevPixel = PresContext()->AppUnitsPerDevPixel();
// we should probably use PaintBorderEdges to do this but for now just use clipping
// to achieve the same effect.
// draw left side
nsRect clipRect(rect);
--- a/layout/xul/nsImageBoxFrame.cpp
+++ b/layout/xul/nsImageBoxFrame.cpp
@@ -350,93 +350,93 @@ nsImageBoxFrame::BuildDisplayList(nsDisp
CreateOwnLayerIfNeeded(aBuilder, &list);
aLists.Content()->AppendToTop(&list);
}
already_AddRefed<imgIContainer>
nsImageBoxFrame::GetImageContainerForPainting(const nsPoint& aPt,
- DrawResult& aDrawResult,
+ ImgDrawResult& aDrawResult,
Maybe<nsPoint>& aAnchorPoint,
nsRect& aDest)
{
if (!mImageRequest) {
// This probably means we're drawn by a native theme.
- aDrawResult = DrawResult::SUCCESS;
+ aDrawResult = ImgDrawResult::SUCCESS;
return nullptr;
}
// Don't draw if the image's size isn't available.
uint32_t imgStatus;
if (!NS_SUCCEEDED(mImageRequest->GetImageStatus(&imgStatus)) ||
!(imgStatus & imgIRequest::STATUS_SIZE_AVAILABLE)) {
- aDrawResult = DrawResult::NOT_READY;
+ aDrawResult = ImgDrawResult::NOT_READY;
return nullptr;
}
nsCOMPtr<imgIContainer> imgCon;
mImageRequest->GetImage(getter_AddRefs(imgCon));
if (!imgCon) {
- aDrawResult = DrawResult::NOT_READY;
+ aDrawResult = ImgDrawResult::NOT_READY;
return nullptr;
}
aDest = GetDestRect(aPt, aAnchorPoint);
- aDrawResult = DrawResult::SUCCESS;
+ aDrawResult = ImgDrawResult::SUCCESS;
return imgCon.forget();
}
-DrawResult
+ImgDrawResult
nsImageBoxFrame::PaintImage(gfxContext& aRenderingContext,
const nsRect& aDirtyRect, nsPoint aPt,
uint32_t aFlags)
{
- DrawResult result;
+ ImgDrawResult result;
Maybe<nsPoint> anchorPoint;
nsRect dest;
nsCOMPtr<imgIContainer> imgCon = GetImageContainerForPainting(aPt, result,
anchorPoint,
dest);
if (!imgCon) {
return result;
}
// don't draw if the image is not dirty
// XXX(seth): Can this actually happen anymore?
nsRect dirty;
if (!dirty.IntersectRect(aDirtyRect, dest)) {
- return DrawResult::TEMPORARY_ERROR;
+ return ImgDrawResult::TEMPORARY_ERROR;
}
bool hasSubRect = !mUseSrcAttr && (mSubRect.width > 0 || mSubRect.height > 0);
Maybe<SVGImageContext> svgContext;
SVGImageContext::MaybeStoreContextPaint(svgContext, this, imgCon);
return nsLayoutUtils::DrawSingleImage(
aRenderingContext,
PresContext(), imgCon,
nsLayoutUtils::GetSamplingFilterForFrame(this),
dest, dirty,
svgContext, aFlags,
anchorPoint.ptrOr(nullptr),
hasSubRect ? &mSubRect : nullptr);
}
-DrawResult
+ImgDrawResult
nsImageBoxFrame::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources,
const StackingContextHelper& aSc,
mozilla::layers::WebRenderLayerManager* aManager,
nsDisplayItem* aItem,
nsPoint aPt,
uint32_t aFlags)
{
- DrawResult result;
+ ImgDrawResult result;
Maybe<nsPoint> anchorPoint;
nsRect dest;
nsCOMPtr<imgIContainer> imgCon = GetImageContainerForPainting(aPt, result,
anchorPoint,
dest);
if (!imgCon) {
return result;
}
@@ -455,35 +455,35 @@ nsImageBoxFrame::CreateWebRenderCommands
Maybe<SVGImageContext> svgContext;
gfx::IntSize decodeSize =
nsLayoutUtils::ComputeImageContainerDrawingParameters(imgCon, aItem->Frame(), fillRect,
aSc, containerFlags, svgContext);
RefPtr<layers::ImageContainer> container =
imgCon->GetImageContainerAtSize(aManager, decodeSize, svgContext, containerFlags);
if (!container) {
NS_WARNING("Failed to get image container");
- return DrawResult::NOT_READY;
+ return ImgDrawResult::NOT_READY;
}
gfx::IntSize size;
Maybe<wr::ImageKey> key = aManager->CommandBuilder().CreateImageKey(aItem, container,
aBuilder, aResources,
aSc, size, Nothing());
if (key.isNothing()) {
- return DrawResult::BAD_IMAGE;
+ return ImgDrawResult::BAD_IMAGE;
}
wr::LayoutRect fill = aSc.ToRelativeLayoutRect(fillRect);
LayoutDeviceSize gapSize(0, 0);
SamplingFilter sampleFilter = nsLayoutUtils::GetSamplingFilterForFrame(aItem->Frame());
aBuilder.PushImage(fill, fill, !BackfaceIsHidden(),
wr::ToLayoutSize(fillRect.Size()), wr::ToLayoutSize(gapSize),
wr::ToImageRendering(sampleFilter), key.value());
- return DrawResult::SUCCESS;
+ return ImgDrawResult::SUCCESS;
}
nsRect
nsImageBoxFrame::GetDestRect(const nsPoint& aOffset, Maybe<nsPoint>& aAnchorPoint)
{
nsCOMPtr<imgIContainer> imgCon;
mImageRequest->GetImage(getter_AddRefs(imgCon));
MOZ_ASSERT(imgCon);
@@ -534,17 +534,17 @@ void nsDisplayXULImage::Paint(nsDisplayL
// the intrinsic size of the image and we aren't likely to implement predictive
// decoding at the correct size for this class like nsImageFrame has.
uint32_t flags = imgIContainer::FLAG_SYNC_DECODE_IF_FAST;
if (aBuilder->ShouldSyncDecodeImages())
flags |= imgIContainer::FLAG_SYNC_DECODE;
if (aBuilder->IsPaintingToWindow())
flags |= imgIContainer::FLAG_HIGH_QUALITY_SCALING;
- DrawResult result = static_cast<nsImageBoxFrame*>(mFrame)->
+ ImgDrawResult result = static_cast<nsImageBoxFrame*>(mFrame)->
PaintImage(*aCtx, mVisibleRect, ToReferenceFrame(), flags);
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
}
LayerState
nsDisplayXULImage::GetLayerState(nsDisplayListBuilder* aBuilder,
LayerManager* aManager,
@@ -584,17 +584,17 @@ nsDisplayXULImage::CreateWebRenderComman
uint32_t flags = imgIContainer::FLAG_SYNC_DECODE_IF_FAST;
if (aDisplayListBuilder->ShouldSyncDecodeImages()) {
flags |= imgIContainer::FLAG_SYNC_DECODE;
}
if (aDisplayListBuilder->IsPaintingToWindow()) {
flags |= imgIContainer::FLAG_HIGH_QUALITY_SCALING;
}
- DrawResult result = imageFrame->
+ ImgDrawResult result = imageFrame->
CreateWebRenderCommands(aBuilder, aResources, aSc, aManager, this, ToReferenceFrame(), flags);
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
return true;
}
nsDisplayItemGeometry*
nsDisplayXULImage::AllocateGeometry(nsDisplayListBuilder* aBuilder)
--- a/layout/xul/nsImageBoxFrame.h
+++ b/layout/xul/nsImageBoxFrame.h
@@ -32,17 +32,17 @@ private:
virtual ~nsImageBoxListener();
nsImageBoxFrame *mFrame;
};
class nsImageBoxFrame final : public nsLeafBoxFrame
{
public:
- typedef mozilla::image::DrawResult DrawResult;
+ typedef mozilla::image::ImgDrawResult ImgDrawResult;
typedef mozilla::layers::ImageContainer ImageContainer;
typedef mozilla::layers::LayerManager LayerManager;
friend class nsDisplayXULImage;
NS_DECL_FRAMEARENA_HELPERS(nsImageBoxFrame)
virtual nsSize GetXULPrefSize(nsBoxLayoutState& aBoxLayoutState) override;
virtual nsSize GetXULMinSize(nsBoxLayoutState& aBoxLayoutState) override;
@@ -83,25 +83,25 @@ public:
void UpdateLoadFlags();
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists) override;
virtual ~nsImageBoxFrame();
already_AddRefed<imgIContainer> GetImageContainerForPainting(const nsPoint& aPt,
- DrawResult& aDrawResult,
+ ImgDrawResult& aDrawResult,
Maybe<nsPoint>& aAnchorPoint,
nsRect& aDest);
- DrawResult PaintImage(gfxContext& aRenderingContext,
+ ImgDrawResult PaintImage(gfxContext& aRenderingContext,
const nsRect& aDirtyRect,
nsPoint aPt, uint32_t aFlags);
- DrawResult CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
+ ImgDrawResult CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources,
const mozilla::layers::StackingContextHelper& aSc,
mozilla::layers::WebRenderLayerManager* aManager,
nsDisplayItem* aItem,
nsPoint aPt,
uint32_t aFlags);
bool CanOptimizeToImageLayer();
--- a/layout/xul/tree/nsTreeBodyFrame.cpp
+++ b/layout/xul/tree/nsTreeBodyFrame.cpp
@@ -2811,17 +2811,17 @@ public:
virtual void Paint(nsDisplayListBuilder* aBuilder,
gfxContext* aCtx) override
{
MOZ_ASSERT(aBuilder);
DrawTargetAutoDisableSubpixelAntialiasing disable(aCtx->GetDrawTarget(),
mDisableSubpixelAA);
- DrawResult result = static_cast<nsTreeBodyFrame*>(mFrame)
+ ImgDrawResult result = static_cast<nsTreeBodyFrame*>(mFrame)
->PaintTreeBody(*aCtx, mVisibleRect, ToReferenceFrame(), aBuilder);
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
}
NS_DISPLAY_DECL_NAME("XULTreeBody", TYPE_XUL_TREE_BODY)
virtual nsRect GetComponentAlphaBounds(nsDisplayListBuilder* aBuilder) const override
@@ -2894,17 +2894,17 @@ nsTreeBodyFrame::BuildDisplayList(nsDisp
}
}
}
}
}
#endif
}
-DrawResult
+ImgDrawResult
nsTreeBodyFrame::PaintTreeBody(gfxContext& aRenderingContext,
const nsRect& aDirtyRect, nsPoint aPt,
nsDisplayListBuilder* aBuilder)
{
// Update our available height and our page count.
CalcInnerBox();
DrawTarget* drawTarget = aRenderingContext.GetDrawTarget();
@@ -2923,17 +2923,17 @@ nsTreeBodyFrame::PaintTreeBody(gfxContex
NS_FRAME_IS_DIRTY);
}
#ifdef DEBUG
int32_t rowCount = mRowCount;
mView->GetRowCount(&rowCount);
NS_WARNING_ASSERTION(mRowCount == rowCount, "row count changed unexpectedly");
#endif
- DrawResult result = DrawResult::SUCCESS;
+ ImgDrawResult result = ImgDrawResult::SUCCESS;
// Loop through our columns and paint them (e.g., for sorting). This is only
// relevant when painting backgrounds, since columns contain no content. Content
// is contained in the rows.
for (nsTreeColumn* currCol = mColumns->GetFirstColumn(); currCol;
currCol = currCol->GetNext()) {
nsRect colRect;
nsresult rv = currCol->GetRect(this, mInnerBox.y, mInnerBox.height,
@@ -2978,17 +2978,17 @@ nsTreeBodyFrame::PaintTreeBody(gfxContex
}
aRenderingContext.Restore();
return result;
}
-DrawResult
+ImgDrawResult
nsTreeBodyFrame::PaintColumn(nsTreeColumn* aColumn,
const nsRect& aColumnRect,
nsPresContext* aPresContext,
gfxContext& aRenderingContext,
const nsRect& aDirtyRect)
{
NS_PRECONDITION(aColumn && aColumn->GetFrame(), "invalid column passed");
@@ -3008,31 +3008,31 @@ nsTreeBodyFrame::PaintColumn(nsTreeColum
nsMargin colMargin;
colContext->StyleMargin()->GetMargin(colMargin);
colRect.Deflate(colMargin);
return PaintBackgroundLayer(colContext, aPresContext, aRenderingContext,
colRect, aDirtyRect);
}
-DrawResult
+ImgDrawResult
nsTreeBodyFrame::PaintRow(int32_t aRowIndex,
const nsRect& aRowRect,
nsPresContext* aPresContext,
gfxContext& aRenderingContext,
const nsRect& aDirtyRect,
nsPoint aPt,
nsDisplayListBuilder* aBuilder)
{
// We have been given a rect for our row. We treat this row like a full-blown
// frame, meaning that it can have borders, margins, padding, and a background.
// Without a view, we have no data. Check for this up front.
if (!mView) {
- return DrawResult::SUCCESS;
+ return ImgDrawResult::SUCCESS;
}
nsresult rv;
// Now obtain the properties for our row.
// XXX Automatically fill in the following props: open, closed, container, leaf, selected, focused
PrefillPropertyArray(aRowIndex, nullptr);
@@ -3046,17 +3046,17 @@ nsTreeBodyFrame::PaintRow(int32_t
// Obtain the margins for the row and then deflate our rect by that
// amount. The row is assumed to be contained within the deflated rect.
nsRect rowRect(aRowRect);
nsMargin rowMargin;
rowContext->StyleMargin()->GetMargin(rowMargin);
rowRect.Deflate(rowMargin);
- DrawResult result = DrawResult::SUCCESS;
+ ImgDrawResult result = ImgDrawResult::SUCCESS;
// Paint our borders and background for our row rect.
nsITheme* theme = nullptr;
auto appearance = rowContext->StyleDisplay()->mAppearance;
if (appearance) {
theme = aPresContext->GetTheme();
}
@@ -3168,17 +3168,17 @@ nsTreeBodyFrame::PaintRow(int32_t
aBuilder);
}
}
}
return result;
}
-DrawResult
+ImgDrawResult
nsTreeBodyFrame::PaintSeparator(int32_t aRowIndex,
const nsRect& aSeparatorRect,
nsPresContext* aPresContext,
gfxContext& aRenderingContext,
const nsRect& aDirtyRect)
{
// Resolve style for the separator.
nsStyleContext* separatorContext = GetPseudoStyleContext(nsCSSAnonBoxes::mozTreeSeparator);
@@ -3186,17 +3186,17 @@ nsTreeBodyFrame::PaintSeparator(int32_t
nsITheme *theme = nullptr;
const nsStyleDisplay* displayData = separatorContext->StyleDisplay();
if ( displayData->mAppearance ) {
theme = aPresContext->GetTheme();
if (theme && theme->ThemeSupportsWidget(aPresContext, nullptr, displayData->mAppearance))
useTheme = true;
}
- DrawResult result = DrawResult::SUCCESS;
+ ImgDrawResult result = ImgDrawResult::SUCCESS;
// use -moz-appearance if provided.
if (useTheme) {
nsRect dirty;
dirty.IntersectRect(aSeparatorRect, aDirtyRect);
theme->DrawWidgetBackground(&aRenderingContext, this,
displayData->mAppearance, aSeparatorRect, dirty);
}
@@ -3225,17 +3225,17 @@ nsTreeBodyFrame::PaintSeparator(int32_t
result &= PaintBackgroundLayer(separatorContext, aPresContext,
aRenderingContext, separatorRect,
aDirtyRect);
}
return result;
}
-DrawResult
+ImgDrawResult
nsTreeBodyFrame::PaintCell(int32_t aRowIndex,
nsTreeColumn* aColumn,
const nsRect& aCellRect,
nsPresContext* aPresContext,
gfxContext& aRenderingContext,
const nsRect& aDirtyRect,
nscoord& aCurrX,
nsPoint aPt,
@@ -3259,17 +3259,17 @@ nsTreeBodyFrame::PaintCell(int32_t
// Obtain the margins for the cell and then deflate our rect by that
// amount. The cell is assumed to be contained within the deflated rect.
nsRect cellRect(aCellRect);
nsMargin cellMargin;
cellContext->StyleMargin()->GetMargin(cellMargin);
cellRect.Deflate(cellMargin);
// Paint our borders and background for our row rect.
- DrawResult result = PaintBackgroundLayer(cellContext, aPresContext,
+ ImgDrawResult result = PaintBackgroundLayer(cellContext, aPresContext,
aRenderingContext, cellRect,
aDirtyRect);
// Adjust the rect for its border and padding.
AdjustForBorderPadding(cellContext, cellRect);
nscoord currX = cellRect.x;
nscoord remainingWidth = cellRect.width;
@@ -3430,17 +3430,17 @@ nsTreeBodyFrame::PaintCell(int32_t
}
}
aCurrX = currX;
return result;
}
-DrawResult
+ImgDrawResult
nsTreeBodyFrame::PaintTwisty(int32_t aRowIndex,
nsTreeColumn* aColumn,
const nsRect& aTwistyRect,
nsPresContext* aPresContext,
gfxContext& aRenderingContext,
const nsRect& aDirtyRect,
nscoord& aRemainingWidth,
nscoord& aCurrX)
@@ -3477,17 +3477,17 @@ nsTreeBodyFrame::PaintTwisty(int32_t
// Subtract out the remaining width. This is done even when we don't actually paint a twisty in
// this cell, so that cells in different rows still line up.
nsRect copyRect(twistyRect);
copyRect.Inflate(twistyMargin);
aRemainingWidth -= copyRect.width;
if (!isRTL)
aCurrX += copyRect.width;
- DrawResult result = DrawResult::SUCCESS;
+ ImgDrawResult result = ImgDrawResult::SUCCESS;
if (shouldPaint) {
// Paint our borders and background for our image rect.
result &= PaintBackgroundLayer(twistyContext, aPresContext,
aRenderingContext, twistyRect,
aDirtyRect);
if (theme) {
@@ -3531,17 +3531,17 @@ nsTreeBodyFrame::PaintTwisty(int32_t
imgIContainer::FLAG_NONE, &imageSize);
}
}
}
return result;
}
-DrawResult
+ImgDrawResult
nsTreeBodyFrame::PaintImage(int32_t aRowIndex,
nsTreeColumn* aColumn,
const nsRect& aImageRect,
nsPresContext* aPresContext,
gfxContext& aRenderingContext,
const nsRect& aDirtyRect,
nscoord& aRemainingWidth,
nscoord& aCurrX,
@@ -3567,17 +3567,17 @@ nsTreeBodyFrame::PaintImage(int32_t
// Get the image.
bool useImageRegion = true;
nsCOMPtr<imgIContainer> image;
GetImage(aRowIndex, aColumn, false, imageContext, useImageRegion, getter_AddRefs(image));
// Get the image destination size.
nsSize imageDestSize = GetImageDestSize(imageContext, useImageRegion, image);
if (!imageDestSize.width || !imageDestSize.height) {
- return DrawResult::SUCCESS;
+ return ImgDrawResult::SUCCESS;
}
// Get the borders and padding.
nsMargin bp(0,0,0,0);
GetBorderPadding(imageContext, bp);
// destRect will be passed as the aDestRect argument in the DrawImage method.
// Start with the imageDestSize width and height.
@@ -3604,17 +3604,17 @@ nsTreeBodyFrame::PaintImage(int32_t
if (!aColumn->IsCycler()) {
// If this column is not a cycler, we won't center the image horizontally.
// We adjust the imageRect width so that the image is placed at the start
// of the cell.
imageRect.width = destRect.width;
}
}
- DrawResult result = DrawResult::SUCCESS;
+ ImgDrawResult result = ImgDrawResult::SUCCESS;
if (image) {
if (isRTL)
imageRect.x = rightEdge - imageRect.width;
// Paint our borders and background for our image rect
result &= PaintBackgroundLayer(imageContext, aPresContext,
aRenderingContext, imageRect,
aDirtyRect);
@@ -3715,17 +3715,17 @@ nsTreeBodyFrame::PaintImage(int32_t
// Disable PGO for PaintText because MSVC 2015 seems to have decided
// that it can null out the alreadyAddRefed<nsFontMetrics> used to
// initialize fontMet after storing fontMet on the stack in the same
// space, overwriting fontMet's stack storage with null.
#ifdef _MSC_VER
# pragma optimize("g", off)
#endif
-DrawResult
+ImgDrawResult
nsTreeBodyFrame::PaintText(int32_t aRowIndex,
nsTreeColumn* aColumn,
const nsRect& aTextRect,
nsPresContext* aPresContext,
gfxContext& aRenderingContext,
const nsRect& aDirtyRect,
nscoord& aCurrX)
{
@@ -3740,17 +3740,17 @@ nsTreeBodyFrame::PaintText(int32_t
if (aColumn->Type() == nsITreeColumn::TYPE_PASSWORD) {
TextEditRules::FillBufWithPWChars(&text, text.Length());
}
// We're going to paint this text so we need to ensure bidi is enabled if
// necessary
CheckTextForBidi(text);
- DrawResult result = DrawResult::SUCCESS;
+ ImgDrawResult result = ImgDrawResult::SUCCESS;
if (text.Length() == 0) {
// Don't paint an empty string. XXX What about background/borders? Still paint?
return result;
}
int32_t appUnitsPerDevPixel = PresContext()->AppUnitsPerDevPixel();
DrawTarget* drawTarget = aRenderingContext.GetDrawTarget();
@@ -3850,17 +3850,17 @@ nsTreeBodyFrame::PaintText(int32_t
}
return result;
}
#ifdef _MSC_VER
# pragma optimize("", on)
#endif
-DrawResult
+ImgDrawResult
nsTreeBodyFrame::PaintCheckbox(int32_t aRowIndex,
nsTreeColumn* aColumn,
const nsRect& aCheckboxRect,
nsPresContext* aPresContext,
gfxContext& aRenderingContext,
const nsRect& aDirtyRect)
{
NS_PRECONDITION(aColumn && aColumn->GetFrame(), "invalid column passed");
@@ -3883,17 +3883,17 @@ nsTreeBodyFrame::PaintCheckbox(int32_t
imageSize.height = checkboxRect.height;
if (imageSize.width > checkboxRect.width)
imageSize.width = checkboxRect.width;
if (StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL)
checkboxRect.x = rightEdge - checkboxRect.width;
// Paint our borders and background for our image rect.
- DrawResult result = PaintBackgroundLayer(checkboxContext, aPresContext,
+ ImgDrawResult result = PaintBackgroundLayer(checkboxContext, aPresContext,
aRenderingContext, checkboxRect,
aDirtyRect);
// Time to paint the checkbox.
// Adjust the rect for its border and padding.
nsMargin bp(0,0,0,0);
GetBorderPadding(checkboxContext, bp);
checkboxRect.Deflate(bp);
@@ -3919,17 +3919,17 @@ nsTreeBodyFrame::PaintCheckbox(int32_t
aPresContext,
image, SamplingFilter::POINT, pt, &aDirtyRect,
imgIContainer::FLAG_NONE, &imageSize);
}
return result;
}
-DrawResult
+ImgDrawResult
nsTreeBodyFrame::PaintProgressMeter(int32_t aRowIndex,
nsTreeColumn* aColumn,
const nsRect& aProgressMeterRect,
nsPresContext* aPresContext,
gfxContext& aRenderingContext,
const nsRect& aDirtyRect,
nsDisplayListBuilder* aBuilder)
{
@@ -3943,17 +3943,17 @@ nsTreeBodyFrame::PaintProgressMeter(int3
// amount. The progress meter is assumed to be contained within the deflated
// rect.
nsRect meterRect(aProgressMeterRect);
nsMargin meterMargin;
meterContext->StyleMargin()->GetMargin(meterMargin);
meterRect.Deflate(meterMargin);
// Paint our borders and background for our progress meter rect.
- DrawResult result = PaintBackgroundLayer(meterContext, aPresContext,
+ ImgDrawResult result = PaintBackgroundLayer(meterContext, aPresContext,
aRenderingContext, meterRect,
aDirtyRect);
// Time to paint our progress.
int32_t state;
mView->GetProgressMode(aRowIndex, aColumn, &state);
if (state == nsITreeView::PROGRESS_NORMAL) {
// Adjust the rect for its border and padding.
@@ -4023,17 +4023,17 @@ nsTreeBodyFrame::PaintProgressMeter(int3
aDirtyRect, drawFlags);
}
}
return result;
}
-DrawResult
+ImgDrawResult
nsTreeBodyFrame::PaintDropFeedback(const nsRect& aDropFeedbackRect,
nsPresContext* aPresContext,
gfxContext& aRenderingContext,
const nsRect& aDirtyRect,
nsPoint aPt)
{
// Paint the drop feedback in between rows.
@@ -4054,17 +4054,17 @@ nsTreeBodyFrame::PaintDropFeedback(const
currX = aDropFeedbackRect.x;
}
PrefillPropertyArray(mSlots->mDropRow, primaryCol);
// Resolve the style to use for the drop feedback.
nsStyleContext* feedbackContext = GetPseudoStyleContext(nsCSSAnonBoxes::mozTreeDropFeedback);
- DrawResult result = DrawResult::SUCCESS;
+ ImgDrawResult result = ImgDrawResult::SUCCESS;
// Paint only if it is visible.
if (feedbackContext->StyleVisibility()->IsVisibleOrCollapsed()) {
int32_t level;
mView->GetLevel(mSlots->mDropRow, &level);
// If our previous or next row has greater level use that for
// correct visual indentation.
@@ -4132,29 +4132,29 @@ nsTreeBodyFrame::PaintDropFeedback(const
result &= PaintBackgroundLayer(feedbackContext, aPresContext,
aRenderingContext, feedbackRect,
aDirtyRect);
}
return result;
}
-DrawResult
+ImgDrawResult
nsTreeBodyFrame::PaintBackgroundLayer(nsStyleContext* aStyleContext,
nsPresContext* aPresContext,
gfxContext& aRenderingContext,
const nsRect& aRect,
const nsRect& aDirtyRect)
{
const nsStyleBorder* myBorder = aStyleContext->StyleBorder();
nsCSSRendering::PaintBGParams params =
nsCSSRendering::PaintBGParams::ForAllLayers(*aPresContext,
aDirtyRect, aRect, this,
nsCSSRendering::PAINTBG_SYNC_DECODE_IMAGES);
- DrawResult result =
+ ImgDrawResult result =
nsCSSRendering::PaintStyleImageLayerWithSC(params, aRenderingContext, aStyleContext,
*myBorder);
result &=
nsCSSRendering::PaintBorderWithStyleBorder(aPresContext, aRenderingContext,
this, aDirtyRect, aRect,
*myBorder, mStyleContext,
PaintBorderFlags::SYNC_DECODE_IMAGES);
--- a/layout/xul/tree/nsTreeBodyFrame.h
+++ b/layout/xul/tree/nsTreeBodyFrame.h
@@ -48,17 +48,17 @@ struct nsTreeImageCacheEntry
// The actual frame that paints the cells and rows.
class nsTreeBodyFrame final
: public nsLeafBoxFrame
, public nsIScrollbarMediator
, public nsIReflowCallback
{
typedef mozilla::layout::ScrollbarActivity ScrollbarActivity;
- typedef mozilla::image::DrawResult DrawResult;
+ typedef mozilla::image::ImgDrawResult ImgDrawResult;
public:
explicit nsTreeBodyFrame(nsStyleContext* aContext);
~nsTreeBodyFrame();
NS_DECL_QUERYFRAME
NS_DECL_FRAMEARENA_HELPERS(nsTreeBodyFrame)
@@ -185,122 +185,122 @@ public:
nsScrollbarFrame* mVScrollbar;
nsCOMPtr<nsIContent> mVScrollbarContent;
nsScrollbarFrame* mHScrollbar;
nsCOMPtr<nsIContent> mHScrollbarContent;
nsIFrame* mColumnsFrame;
nsIScrollableFrame* mColumnsScrollFrame;
};
- DrawResult PaintTreeBody(gfxContext& aRenderingContext,
+ ImgDrawResult PaintTreeBody(gfxContext& aRenderingContext,
const nsRect& aDirtyRect, nsPoint aPt,
nsDisplayListBuilder* aBuilder);
nsITreeBoxObject* GetTreeBoxObject() const { return mTreeBoxObject; }
// Get the base element, <tree> or <select>
nsIContent* GetBaseElement();
bool GetVerticalOverflow() const { return mVerticalOverflow; }
bool GetHorizontalOverflow() const {return mHorizontalOverflow; }
protected:
friend class nsOverflowChecker;
// This method paints a specific column background of the tree.
- DrawResult PaintColumn(nsTreeColumn* aColumn,
+ ImgDrawResult PaintColumn(nsTreeColumn* aColumn,
const nsRect& aColumnRect,
nsPresContext* aPresContext,
gfxContext& aRenderingContext,
const nsRect& aDirtyRect);
// This method paints a single row in the tree.
- DrawResult PaintRow(int32_t aRowIndex,
+ ImgDrawResult PaintRow(int32_t aRowIndex,
const nsRect& aRowRect,
nsPresContext* aPresContext,
gfxContext& aRenderingContext,
const nsRect& aDirtyRect,
nsPoint aPt,
nsDisplayListBuilder* aBuilder);
// This method paints a single separator in the tree.
- DrawResult PaintSeparator(int32_t aRowIndex,
+ ImgDrawResult PaintSeparator(int32_t aRowIndex,
const nsRect& aSeparatorRect,
nsPresContext* aPresContext,
gfxContext& aRenderingContext,
const nsRect& aDirtyRect);
// This method paints a specific cell in a given row of the tree.
- DrawResult PaintCell(int32_t aRowIndex,
+ ImgDrawResult PaintCell(int32_t aRowIndex,
nsTreeColumn* aColumn,
const nsRect& aCellRect,
nsPresContext* aPresContext,
gfxContext& aRenderingContext,
const nsRect& aDirtyRect,
nscoord& aCurrX,
nsPoint aPt,
nsDisplayListBuilder* aBuilder);
// This method paints the twisty inside a cell in the primary column of an tree.
- DrawResult PaintTwisty(int32_t aRowIndex,
+ ImgDrawResult PaintTwisty(int32_t aRowIndex,
nsTreeColumn* aColumn,
const nsRect& aTwistyRect,
nsPresContext* aPresContext,
gfxContext& aRenderingContext,
const nsRect& aDirtyRect,
nscoord& aRemainingWidth,
nscoord& aCurrX);
// This method paints the image inside the cell of an tree.
- DrawResult PaintImage(int32_t aRowIndex,
+ ImgDrawResult PaintImage(int32_t aRowIndex,
nsTreeColumn* aColumn,
const nsRect& aImageRect,
nsPresContext* aPresContext,
gfxContext& aRenderingContext,
const nsRect& aDirtyRect,
nscoord& aRemainingWidth,
nscoord& aCurrX,
nsDisplayListBuilder* aBuilder);
// This method paints the text string inside a particular cell of the tree.
- DrawResult PaintText(int32_t aRowIndex,
+ ImgDrawResult PaintText(int32_t aRowIndex,
nsTreeColumn* aColumn,
const nsRect& aTextRect,
nsPresContext* aPresContext,
gfxContext& aRenderingContext,
const nsRect& aDirtyRect,
nscoord& aCurrX);
// This method paints the checkbox inside a particular cell of the tree.
- DrawResult PaintCheckbox(int32_t aRowIndex,
+ ImgDrawResult PaintCheckbox(int32_t aRowIndex,
nsTreeColumn* aColumn,
const nsRect& aCheckboxRect,
nsPresContext* aPresContext,
gfxContext& aRenderingContext,
const nsRect& aDirtyRect);
// This method paints the progress meter inside a particular cell of the tree.
- DrawResult PaintProgressMeter(int32_t aRowIndex,
+ ImgDrawResult PaintProgressMeter(int32_t aRowIndex,
nsTreeColumn* aColumn,
const nsRect& aProgressMeterRect,
nsPresContext* aPresContext,
gfxContext& aRenderingContext,
const nsRect& aDirtyRect,
nsDisplayListBuilder* aBuilder);
// This method paints a drop feedback of the tree.
- DrawResult PaintDropFeedback(const nsRect& aDropFeedbackRect,
+ ImgDrawResult PaintDropFeedback(const nsRect& aDropFeedbackRect,
nsPresContext* aPresContext,
gfxContext& aRenderingContext,
const nsRect& aDirtyRect,
nsPoint aPt);
// This method is called with a specific style context and rect to
// paint the background rect as if it were a full-blown frame.
- DrawResult PaintBackgroundLayer(nsStyleContext* aStyleContext,
+ ImgDrawResult PaintBackgroundLayer(nsStyleContext* aStyleContext,
nsPresContext* aPresContext,
gfxContext& aRenderingContext,
const nsRect& aRect,
const nsRect& aDirtyRect);
// An internal hit test. aX and aY are expected to be in twips in the
// coordinate system of this frame.
--- a/widget/cocoa/nsCocoaUtils.mm
+++ b/widget/cocoa/nsCocoaUtils.mm
@@ -484,23 +484,23 @@ nsresult nsCocoaUtils::CreateNSImageFrom
if (!drawTarget || !drawTarget->IsValid()) {
NS_ERROR("Failed to create valid DrawTarget");
return NS_ERROR_FAILURE;
}
RefPtr<gfxContext> context = gfxContext::CreateOrNull(drawTarget);
MOZ_ASSERT(context);
- mozilla::image::DrawResult res =
+ mozilla::image::ImgDrawResult res =
aImage->Draw(context, scaledSize, ImageRegion::Create(scaledSize),
aWhichFrame, SamplingFilter::POINT,
/* no SVGImageContext */ Nothing(),
imgIContainer::FLAG_SYNC_DECODE, 1.0);
- if (res != mozilla::image::DrawResult::SUCCESS) {
+ if (res != mozilla::image::ImgDrawResult::SUCCESS) {
return NS_ERROR_FAILURE;
}
surface = drawTarget->Snapshot();
} else {
surface = aImage->GetFrame(aWhichFrame, imgIContainer::FLAG_SYNC_DECODE);
}
--- a/widget/nsBaseDragService.cpp
+++ b/widget/nsBaseDragService.cpp
@@ -754,22 +754,22 @@ nsBaseDragService::DrawDragForImage(nsPr
SurfaceFormat::B8G8R8A8);
if (!dt || !dt->IsValid())
return NS_ERROR_FAILURE;
RefPtr<gfxContext> ctx = gfxContext::CreateOrNull(dt);
if (!ctx)
return NS_ERROR_FAILURE;
- DrawResult res =
+ ImgDrawResult res =
imgContainer->Draw(ctx, destSize, ImageRegion::Create(destSize),
imgIContainer::FRAME_CURRENT,
SamplingFilter::GOOD, /* no SVGImageContext */ Nothing(),
imgIContainer::FLAG_SYNC_DECODE, 1.0);
- if (res == DrawResult::BAD_IMAGE || res == DrawResult::BAD_ARGS) {
+ if (res == ImgDrawResult::BAD_IMAGE || res == ImgDrawResult::BAD_ARGS) {
return NS_ERROR_FAILURE;
}
*aSurface = dt->Snapshot();
} else {
*aSurface = aCanvas->GetSurfaceSnapshot();
}
return result;