Bug 1314001 - Part 2. Draw mask by single opaque green. r=mstange
authorcku <cku@mozilla.com>
Fri, 04 Nov 2016 12:25:33 +0800
changeset 351863 19fabb7bf063302bce9416656785ebe77f0f3748
parent 351862 db9d20ea9e05bdbface569d66557c30ada5e5f8c
child 351864 c0d2974a85377ed9a30092153978696dc9049ea1
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1314001
milestone52.0a1
Bug 1314001 - Part 2. Draw mask by single opaque green. r=mstange MozReview-Commit-ID: 12S5vBGYRpb
layout/base/nsDisplayList.cpp
layout/svg/nsSVGIntegrationUtils.cpp
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -7113,16 +7113,20 @@ bool nsDisplayMask::ShouldPaintOnMaskLay
   nsTArray<nsSVGMaskFrame *> maskFrames = effectProperties.GetMaskFrames();
   for (size_t i = 0; i < maskFrames.Length() ; i++) {
     nsSVGMaskFrame *maskFrame = maskFrames[i];
     if (maskFrame) {
       return false; // Found SVG mask.
     }
   }
 
+  if (gfxPrefs::DrawMaskLayer()) {
+    return false;
+  }
+
   return true;
 }
 
 bool nsDisplayMask::ComputeVisibility(nsDisplayListBuilder* aBuilder,
                                       nsRegion* aVisibleRegion)
 {
   // Our children may be made translucent or arbitrarily deformed so we should
   // not allow them to subtract area from aVisibleRegion.
--- a/layout/svg/nsSVGIntegrationUtils.cpp
+++ b/layout/svg/nsSVGIntegrationUtils.cpp
@@ -966,16 +966,28 @@ nsSVGIntegrationUtils::PaintMaskAndClipP
   context.SetMatrix(matrixAutoSaveRestore.Matrix());
   BasicLayerManager* basic = aParams.layerManager->AsBasicLayerManager();
   RefPtr<gfxContext> oldCtx = basic->GetTarget();
   basic->SetTarget(&context);
   aParams.layerManager->EndTransaction(FrameLayerBuilder::DrawPaintedLayer,
                                        aParams.builder);
   basic->SetTarget(oldCtx);
 
+  if (gfxPrefs::DrawMaskLayer()) {
+    gfxContextAutoSaveRestore saver(&context);
+
+    context.NewPath();
+    gfxRect drawingRect =
+      nsLayoutUtils::RectToGfxRect(aParams.borderArea,
+                                   frame->PresContext()->AppUnitsPerDevPixel());
+    context.Rectangle(drawingRect, true);
+    context.SetColor(Color(0.0, 1.0, 0.0, 1.0));
+    context.Fill();
+  }
+
   if (maskUsage.shouldApplyClipPath || maskUsage.shouldApplyBasicShape) {
     context.PopClip();
   }
 
   if (shouldGenerateMask) {
     context.PopGroupAndBlend();
   }