Backed out changeset a2f133998adf (bug 1323912)

This commit is contained in:
Iris Hsiao 2017-01-04 21:47:05 -05:00
parent d569188dd7
commit 6989ec2d7a

View File

@ -420,6 +420,22 @@ private:
nsPoint mOffset;
};
/**
* Returns true if any of the masks is an image mask (and not an SVG mask).
*/
static bool
HasNonSVGMask(const nsTArray<nsSVGMaskFrame*>& aMaskFrames)
{
for (size_t i = 0; i < aMaskFrames.Length() ; i++) {
nsSVGMaskFrame *maskFrame = aMaskFrames[i];
if (!maskFrame) {
return true;
}
}
return false;
}
typedef nsSVGIntegrationUtils::PaintFramesParams PaintFramesParams;
/**
@ -434,7 +450,6 @@ PaintMaskSurface(const PaintFramesParams& aParams,
{
MOZ_ASSERT(aMaskFrames.Length() > 0);
MOZ_ASSERT(aMaskDT->GetFormat() == SurfaceFormat::A8);
MOZ_ASSERT(aOpacity == 1.0 || aMaskFrames.Length() == 1);
const nsStyleSVGReset *svgReset = aSC->StyleSVGReset();
gfxMatrix cssPxToDevPxMatrix =
@ -494,8 +509,7 @@ PaintMaskSurface(const PaintFramesParams& aParams,
aParams.frame,
aParams.builder->GetBackgroundPaintFlags() |
nsCSSRendering::PAINTBG_MASK_IMAGE,
i, compositionOp,
aOpacity);
i, compositionOp);
result =
nsCSSRendering::PaintStyleImageLayerWithSC(params, aSC,
@ -566,11 +580,10 @@ CreateAndPaintMaskSurface(const PaintFramesParams& aParams,
return paintResult;
}
// We can paint mask along with opacity only if
// 1. There is only one mask, or
// 2. No overlap among masks.
// Collision detect in #2 is not that trivial, we only accept #1 here.
paintResult.opacityApplied = (aMaskFrames.Length() == 1);
// Set aAppliedOpacity as true only if all mask layers are svg mask.
// In this case, we will apply opacity into the final mask surface, so the
// caller does not need to apply it again.
paintResult.opacityApplied = !HasNonSVGMask(aMaskFrames);
// Set context's matrix on maskContext, offset by the maskSurfaceRect's
// position. This makes sure that we combine the masks in device space.