tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 7c1d966586aab3632fc595fdd42404c44d3ed9b7
parent 7d9b5c0eb0015fccc627897d8cfbc1005dde90e7
Author: longsonr <longsonr@gmail.com>
Date:   Thu,  8 Jan 2026 09:21:22 +0000

Bug 2009041 - Convert FLAG_SYNC_DECODE_IMAGES to an enum class r=dholbert

Differential Revision: https://phabricator.services.mozilla.com/D278201

Diffstat:
Mlayout/painting/nsImageRenderer.cpp | 2+-
Mlayout/svg/SVGIntegrationUtils.cpp | 11++++++-----
Mlayout/svg/SVGIntegrationUtils.h | 8++++----
3 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/layout/painting/nsImageRenderer.cpp b/layout/painting/nsImageRenderer.cpp @@ -783,7 +783,7 @@ already_AddRefed<gfxDrawable> nsImageRenderer::DrawableForElement( drawable = SVGIntegrationUtils::DrawableFromPaintServer( mPaintServerFrame, mForFrame, mSize, imageSize, aContext.GetDrawTarget(), aContext.CurrentMatrixDouble(), - SVGIntegrationUtils::FLAG_SYNC_DECODE_IMAGES); + SVGIntegrationUtils::DecodeFlags::SyncDecodeImages); } return drawable.forget(); diff --git a/layout/svg/SVGIntegrationUtils.cpp b/layout/svg/SVGIntegrationUtils.cpp @@ -1079,7 +1079,8 @@ bool SVGIntegrationUtils::UsesSVGEffectsNotSupportedInCompositor( class PaintFrameCallback : public gfxDrawingCallback { public: PaintFrameCallback(nsIFrame* aFrame, const nsSize aPaintServerSize, - const IntSize aRenderSize, uint32_t aFlags) + const IntSize aRenderSize, + EnumSet<SVGIntegrationUtils::DecodeFlags> aFlags) : mFrame(aFrame), mPaintServerSize(aPaintServerSize), mRenderSize(aRenderSize), @@ -1092,7 +1093,7 @@ class PaintFrameCallback : public gfxDrawingCallback { nsIFrame* mFrame; nsSize mPaintServerSize; IntSize mRenderSize; - uint32_t mFlags; + EnumSet<SVGIntegrationUtils::DecodeFlags> mFlags; }; bool PaintFrameCallback::operator()(gfxContext* aContext, @@ -1140,7 +1141,7 @@ bool PaintFrameCallback::operator()(gfxContext* aContext, using PaintFrameFlags = nsLayoutUtils::PaintFrameFlags; PaintFrameFlags flags = PaintFrameFlags::InTransform; - if (mFlags & SVGIntegrationUtils::FLAG_SYNC_DECODE_IMAGES) { + if (mFlags.contains(SVGIntegrationUtils::DecodeFlags::SyncDecodeImages)) { flags |= PaintFrameFlags::SyncDecodeImages; } nsLayoutUtils::PaintFrame(aContext, mFrame, dirty, NS_RGBA(0, 0, 0, 0), @@ -1172,7 +1173,7 @@ bool PaintFrameCallback::operator()(gfxContext* aContext, already_AddRefed<gfxDrawable> SVGIntegrationUtils::DrawableFromPaintServer( nsIFrame* aFrame, nsIFrame* aTarget, const nsSize& aPaintServerSize, const IntSize& aRenderSize, const DrawTarget* aDrawTarget, - const gfxMatrix& aContextMatrix, uint32_t aFlags) { + const gfxMatrix& aContextMatrix, EnumSet<DecodeFlags> aFlags) { // aPaintServerSize is the size that would be filled when using // background-repeat:no-repeat and background-size:auto. For normal background // images, this would be the intrinsic size of the image; for gradients and @@ -1187,7 +1188,7 @@ already_AddRefed<gfxDrawable> SVGIntegrationUtils::DrawableFromPaintServer( aPaintServerSize.height); overrideBounds.Scale(1.0 / aFrame->PresContext()->AppUnitsPerDevPixel()); uint32_t imgFlags = imgIContainer::FLAG_ASYNC_NOTIFY; - if (aFlags & SVGIntegrationUtils::FLAG_SYNC_DECODE_IMAGES) { + if (aFlags.contains(DecodeFlags::SyncDecodeImages)) { imgFlags |= imgIContainer::FLAG_SYNC_DECODE; } imgDrawingParams imgParams(imgFlags); diff --git a/layout/svg/SVGIntegrationUtils.h b/layout/svg/SVGIntegrationUtils.h @@ -255,17 +255,17 @@ class SVGIntegrationUtils final { * background-repeat:no-repeat and background-size:auto. For normal background * images, this would be the intrinsic size of the image; for gradients and * patterns this would be the whole target frame fill area. - * @param aFlags pass FLAG_SYNC_DECODE_IMAGES and any images in the paint + * @param aFlags pass SyncDecodeImages and any images in the paint * server will be decoding synchronously if they are not decoded already. */ - enum { - FLAG_SYNC_DECODE_IMAGES = 0x01, + enum class DecodeFlags { + SyncDecodeImages, }; static already_AddRefed<gfxDrawable> DrawableFromPaintServer( nsIFrame* aFrame, nsIFrame* aTarget, const nsSize& aPaintServerSize, const gfx::IntSize& aRenderSize, const DrawTarget* aDrawTarget, - const gfxMatrix& aContextMatrix, uint32_t aFlags); + const gfxMatrix& aContextMatrix, EnumSet<DecodeFlags> aFlags); /** * For non-SVG frames, this gives the offset to the frame's "user space".