Bug 1275451: Part 1. Respect mask-composite while composing a SVG mask layer r=mstange
authorCJKu <cku@mozilla.com>
Thu, 26 May 2016 16:07:43 +0800
changeset 299122 30d2b746df172e3397aef149273838a34901e3dc
parent 299121 b8adc67d8f4a5ddef0e021cff33b64d20508204f
child 299123 581a44c822aa0140a74bbf803b5b3801404d2e22
push id77446
push usercku@mozilla.com
push dateThu, 26 May 2016 10:48:57 +0000
treeherdermozilla-inbound@581a44c822aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1275451
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1275451: Part 1. Respect mask-composite while composing a SVG mask layer r=mstange MozReview-Commit-ID: 8m2xR4P30hq
layout/svg/nsSVGIntegrationUtils.cpp
--- a/layout/svg/nsSVGIntegrationUtils.cpp
+++ b/layout/svg/nsSVGIntegrationUtils.cpp
@@ -477,38 +477,41 @@ GenerateMaskSurface(const nsSVGIntegrati
     ctx.CurrentMatrix() * gfxMatrix::Translation(-maskSurfaceRect.TopLeft());
   maskContext->SetMatrix(maskSurfaceMatrix);
 
   // Multiple SVG masks interleave with image mask. Paint each layer onto maskDT
   // one at a time.
   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) {
       Matrix svgMaskMatrix;
       RefPtr<SourceSurface> svgMask =
         maskFrame->GetMaskForMaskedFrame(maskContext, aParams.frame,
                                          cssPxToDevPxMatrix, aOpacity,
                                          &svgMaskMatrix,
                                          svgReset->mMask.mLayers[i].mMaskMode);
       if (svgMask) {
         gfxContextMatrixAutoSaveRestore matRestore(maskContext);
 
         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(),
                                                       rc, aParams.dirtyRect,
                                                       aParams.borderArea,
                                                       aParams.frame,
                                                       aParams.builder->GetBackgroundPaintFlags() |
                                                       nsCSSRendering::PAINTBG_MASK_IMAGE,