diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp index 03d5eeea80a1..39076e262864 100644 --- a/layout/painting/nsDisplayList.cpp +++ b/layout/painting/nsDisplayList.cpp @@ -7351,9 +7351,11 @@ bool nsDisplayMask::ShouldPaintOnMaskLayer(LayerManager* aManager) nsSVGUtils::MaskUsage maskUsage; nsSVGUtils::DetermineMaskUsage(mFrame, mHandleOpacity, maskUsage); + // XXX Bug 1323912. nsSVGIntegrationUtils::PaintMask can not handle opacity + // correctly. Turn it off before bug fixed. // XXX Temporary disable paint clip-path onto mask before figure out // performance regression(bug 1325550). - if (maskUsage.shouldApplyClipPath) { + if (maskUsage.opacity != 1.0 || maskUsage.shouldApplyClipPath) { return false; } diff --git a/layout/svg/nsSVGIntegrationUtils.cpp b/layout/svg/nsSVGIntegrationUtils.cpp index 3e8309f2aa14..a19f72de70fe 100644 --- a/layout/svg/nsSVGIntegrationUtils.cpp +++ b/layout/svg/nsSVGIntegrationUtils.cpp @@ -725,25 +725,6 @@ nsSVGIntegrationUtils::IsMaskResourceReady(nsIFrame* aFrame) return true; } -class AutoPopGroup -{ -public: - AutoPopGroup() : mContext(nullptr) { } - - ~AutoPopGroup() { - if (mContext) { - mContext->PopGroupAndBlend(); - } - } - - void SetContext(gfxContext* aContext) { - mContext = aContext; - } - -private: - gfxContext* mContext; -}; - DrawResult nsSVGIntegrationUtils::PaintMask(const PaintFramesParams& aParams) { @@ -756,6 +737,10 @@ nsSVGIntegrationUtils::PaintMask(const PaintFramesParams& aParams) return DrawResult::SUCCESS; } + // XXX Bug 1323912. + MOZ_ASSERT(maskUsage.opacity == 1.0, + "nsSVGIntegrationUtils::PaintMask can not handle opacity now."); + gfxContext& ctx = aParams.ctx; nsIFrame* firstFrame = nsLayoutUtils::FirstContinuationOrIBSplitSibling(frame); @@ -777,15 +762,6 @@ nsSVGIntegrationUtils::PaintMask(const PaintFramesParams& aParams) SurfaceFormat::A8); } - nsTArray maskFrames = effectProperties.GetMaskFrames(); - AutoPopGroup autoPop; - bool shouldPushOpacity = (maskUsage.opacity != 1.0) && - (maskFrames.Length() != 1); - if (shouldPushOpacity) { - ctx.PushGroupForBlendBack(gfxContentType::COLOR_ALPHA, maskUsage.opacity); - autoPop.SetContext(&ctx); - } - gfxContextMatrixAutoSaveRestore matSR; nsPoint offsetToBoundingBox; nsPoint offsetToUserSpace; @@ -817,8 +793,9 @@ nsSVGIntegrationUtils::PaintMask(const PaintFramesParams& aParams) SetupContextMatrix(frame, aParams, offsetToBoundingBox, offsetToUserSpace); - result = PaintMaskSurface(aParams, maskTarget, - shouldPushOpacity ? 1.0 : maskUsage.opacity, + nsTArray maskFrames = effectProperties.GetMaskFrames(); + + result = PaintMaskSurface(aParams, maskTarget, 1.0, firstFrame->StyleContext(), maskFrames, ctx.CurrentMatrix(), offsetToUserSpace); if (result != DrawResult::SUCCESS) {