Bug 1348430 - Part 1. (Main) Correct value pass to nsFilterInstance::PaintFilteredFrame in nsSVGUtil. r=mstange a=gchang
authorcku <cku@mozilla.com>
Mon, 20 Mar 2017 01:30:32 +0800
changeset 375418 cfd92edead41beaf527208dd34527c1ee96830a4
parent 375417 1bff0c493536f68a1850c435409495c45c91daf5
child 375419 da3f77e480c7e990ab08e9842610d220b75deab6
push id10942
push usercbook@mozilla.com
push dateFri, 24 Mar 2017 09:26:58 +0000
treeherdermozilla-aurora@d6b911d8d677 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange, gchang
bugs1348430, 1224207
milestone54.0a2
Bug 1348430 - Part 1. (Main) Correct value pass to nsFilterInstance::PaintFilteredFrame in nsSVGUtil. r=mstange a=gchang There are two places that use nsFilterInstance::PaintFilteredFrame. One is nsSVGIntegrationUtil::PaintFilter, we do take care of it in bug 1224207. Another path is at nsSVGUtils::PaintFrameWithEffects, apparently I missed that path while working on bug 1224207. MozReview-Commit-ID: K4MjKa4ZpCR
layout/svg/nsSVGUtils.cpp
--- a/layout/svg/nsSVGUtils.cpp
+++ b/layout/svg/nsSVGUtils.cpp
@@ -477,17 +477,19 @@ public:
       gfxRect dirtyBounds = userToDeviceSpace.TransformBounds(
         gfxRect(aDirtyRect->x, aDirtyRect->y, aDirtyRect->width, aDirtyRect->height));
       dirtyBounds.RoundOut();
       if (gfxUtils::GfxRectToIntRect(dirtyBounds, &tmpDirtyRect)) {
         dirtyRect = &tmpDirtyRect;
       }
     }
 
-    return svgChildFrame->PaintSVG(aContext, aTransform, dirtyRect);
+    return svgChildFrame->PaintSVG(aContext,
+                                   nsSVGUtils::GetCSSPxToDevPxMatrix(aTarget),
+                                   dirtyRect);
   }
 };
 
 float
 nsSVGUtils::ComputeOpacity(nsIFrame* aFrame, bool aHandleOpacity)
 {
   float opacity = aFrame->StyleEffects()->mOpacity;
 
@@ -853,16 +855,23 @@ nsSVGUtils::PaintFrameWithEffects(nsIFra
                               gfxRect(aDirtyRect->x, aDirtyRect->y,
                                       aDirtyRect->width, aDirtyRect->height));
       tmpDirtyRegion =
         nsLayoutUtils::RoundGfxRectToAppRect(
           dirtyBounds, aFrame->PresContext()->AppUnitsPerCSSPixel()) -
         aFrame->GetPosition();
       dirtyRegion = &tmpDirtyRegion;
     }
+
+    gfxContextMatrixAutoSaveRestore saver(target);
+    gfxMatrix devPxToCssPxTM = nsSVGUtils::GetCSSPxToDevPxMatrix(aFrame);
+    DebugOnly<bool> invertible = devPxToCssPxTM.Invert();
+    MOZ_ASSERT(invertible);
+    target->SetMatrix(aTransform * devPxToCssPxTM);
+
     SVGPaintCallback paintCallback;
     result =
       nsFilterInstance::PaintFilteredFrame(aFrame, target->GetDrawTarget(),
                                            aTransform, &paintCallback,
                                            dirtyRegion);
   } else {
     result = svgChildFrame->PaintSVG(*target, aTransform, aDirtyRect);
   }