Bug 1305259 - Use PushGroupAndCopyBackground for the masked group so that we can have subpixel AA inside the mask / clip-path. r?cjku, r?Bas draft
authorMarkus Stange <mstange@themasta.com>
Fri, 30 Sep 2016 21:22:30 -0400
changeset 419799 5cab64fc4a16a0db0ae3fdb9bdee0ea2adc82717
parent 419507 5ffed033557e5b6f9694123f1948f867f913ede3
child 532659 a74db2c5a08f23a61e6c6cdfe85693f74cc12665
push id31022
push userbmo:mstange@themasta.com
push dateSat, 01 Oct 2016 01:25:55 +0000
reviewerscjku, Bas
bugs1305259
milestone52.0a1
Bug 1305259 - Use PushGroupAndCopyBackground for the masked group so that we can have subpixel AA inside the mask / clip-path. r?cjku, r?Bas MozReview-Commit-ID: 3J9ncPn9sij
layout/svg/nsSVGIntegrationUtils.cpp
--- a/layout/svg/nsSVGIntegrationUtils.cpp
+++ b/layout/svg/nsSVGIntegrationUtils.cpp
@@ -874,19 +874,25 @@ nsSVGIntegrationUtils::PaintMaskAndClipP
     if (!shouldGenerateClipMaskLayer && !shouldGenerateMaskLayer) {
       MOZ_ASSERT(opacity != 1.0f);
 
       matSR.SetContext(&context);
       SetupContextMatrix(firstFrame, aParams, offsetToBoundingBox,
                          offsetToUserSpace, true);
     }
 
-    context.PushGroupForBlendBack(gfxContentType::COLOR_ALPHA,
-                                  opacityApplied ?  1.0 : opacity,
-                                  maskSurface, maskTransform);
+    if (aParams.layerManager->GetRoot()->GetContentFlags() & Layer::CONTENT_COMPONENT_ALPHA) {
+      context.PushGroupAndCopyBackground(gfxContentType::COLOR_ALPHA,
+                                         opacityApplied ?  1.0 : opacity,
+                                         maskSurface, maskTransform);
+    } else {
+      context.PushGroupForBlendBack(gfxContentType::COLOR_ALPHA,
+                                    opacityApplied ?  1.0 : opacity,
+                                    maskSurface, maskTransform);
+    }
   }
 
   /* If this frame has only a trivial clipPath, set up cairo's clipping now so
    * we can just do normal painting and get it clipped appropriately.
    */
   if (shouldApplyClipPath || shouldApplyBasicShape) {
     context.Save();
     SetupContextMatrix(firstFrame, aParams, offsetToBoundingBox,