Bug 1275451: Part 1. Respect mask-composite while composing a SVG mask layer r=mstange

MozReview-Commit-ID: 8m2xR4P30hq

--HG--
extra : rebase_source : ea2becbc6c4eb06237eede0e99857c1d4a132fcb
This commit is contained in:
CJKu 2016-05-26 16:07:43 +08:00
parent 55f6e9461b
commit 7bbf7cb277

View File

@ -482,6 +482,10 @@ GenerateMaskSurface(const nsSVGIntegrationUtils::PaintFramesParams& aParams,
for (int i = svgMaskFrames.Length() - 1; i >= 0 ; i--) {
nsSVGMaskFrame *maskFrame = svgMaskFrames[i];
CompositionOp compositionOp = (i == int(svgMaskFrames.Length() - 1))
? CompositionOp::OP_OVER
: nsCSSRendering::GetGFXCompositeMode(svgReset->mMask.mLayers[i].mComposite);
// maskFrame != nullptr means we get a SVG mask.
// maskFrame == nullptr means we get an image mask.
if (maskFrame) {
@ -496,14 +500,13 @@ GenerateMaskSurface(const nsSVGIntegrationUtils::PaintFramesParams& aParams,
maskContext->Multiply(ThebesMatrix(svgMaskMatrix));
Rect drawRect = IntRectToRect(IntRect(IntPoint(0, 0), svgMask->GetSize()));
maskDT->DrawSurface(svgMask, drawRect, drawRect);
maskDT->DrawSurface(svgMask, drawRect, drawRect, DrawSurfaceOptions(),
DrawOptions(1.0f, compositionOp));
}
} else {
gfxContextMatrixAutoSaveRestore matRestore(maskContext);
maskContext->Multiply(gfxMatrix::Translation(-aOffest));
CompositionOp compositionOp =
nsCSSRendering::GetGFXCompositeMode(svgReset->mMask.mLayers[i].mComposite);
nsRenderingContext rc(maskContext);
nsCSSRendering::PaintBGParams params =
nsCSSRendering::PaintBGParams::ForSingleLayer(*aParams.frame->PresContext(),