Bug 621210 - Clear cached ctm when painting mask children; r=jwatt; a=roc
authorRobert Longson <longsonr@gmail.com>
Fri, 24 Dec 2010 09:30:01 +0000
changeset 59650 907d7744deb8b24a1d2e3b1129815c832c411b64
parent 59649 8d588d1f53c21ccc62a9618a1ded9553f1af008d
child 59651 f7a6e3530d998f4f557b78902c8ca6eb5beb2a09
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewersjwatt, roc
bugs621210
milestone2.0b9pre
Bug 621210 - Clear cached ctm when painting mask children; r=jwatt; a=roc
layout/reftests/svg/objectBoundingBox-and-mask-02.svg
layout/reftests/svg/reftest.list
layout/svg/base/src/nsSVGMaskFrame.cpp
new file mode 100644
--- /dev/null
+++ b/layout/reftests/svg/objectBoundingBox-and-mask-02.svg
@@ -0,0 +1,17 @@
+<!--
+     Any copyright is dedicated to the Public Domain.
+     http://creativecommons.org/licenses/publicdomain/
+-->
+<!-- From https://bugzilla.mozilla.org/show_bug.cgi?id=621210 -->
+
+<svg xmlns="http://www.w3.org/2000/svg">
+  <title>Testcase for re-using an objectBoundingBox mask with a &lt;g&gt; child</title>
+  <mask id="mask" maskUnits="objectBoundingBox" maskContentUnits="objectBoundingBox">
+    <g>
+      <rect width="1" height="1" fill="white"/>
+    </g>
+  </mask>
+  <rect width="100%" height="100%" fill="red"/>
+  <rect mask="url(#mask)" width="1" height="1" fill="red"/>
+  <rect mask="url(#mask)" width="100%" height="100%" fill="lime"/>
+</svg>
--- a/layout/reftests/svg/reftest.list
+++ b/layout/reftests/svg/reftest.list
@@ -130,16 +130,17 @@ fails == inline-in-xul-basic-01.xul pass
 # Bug 456323
 # == mask-transformed-01.svg mask-transformed-01-ref.svg
 == nested-viewBox-01.svg pass.svg
 == nesting-invalid-01.svg nesting-invalid-01-ref.svg
 == objectBoundingBox-and-clipPath.svg pass.svg
 # Bug 588684
 random-if(gtk2Widget) == objectBoundingBox-and-fePointLight-01.svg objectBoundingBox-and-fePointLight-01-ref.svg
 == objectBoundingBox-and-mask.svg pass.svg
+== objectBoundingBox-and-mask-02.svg pass.svg
 == objectBoundingBox-and-pattern-01a.svg objectBoundingBox-and-pattern-01-ref.svg
 == objectBoundingBox-and-pattern-01b.svg objectBoundingBox-and-pattern-01-ref.svg
 == objectBoundingBox-and-pattern-01c.svg objectBoundingBox-and-pattern-01-ref.svg
 == objectBoundingBox-and-pattern-02.svg pass.svg
 == objectBoundingBox-and-pattern-03.svg objectBoundingBox-and-pattern-03-ref.svg
 == opacity-and-gradient-01.svg pass.svg
 == opacity-and-gradient-02.svg opacity-and-gradient-02-ref.svg
 == opacity-and-pattern-01.svg pass.svg
--- a/layout/svg/base/src/nsSVGMaskFrame.cpp
+++ b/layout/svg/base/src/nsSVGMaskFrame.cpp
@@ -116,16 +116,22 @@ nsSVGMaskFrame::ComputeMaskAlpha(nsSVGRe
 
   nsSVGRenderState tmpState(image);
 
   mMaskParent = aParent;
   mMaskParentMatrix = NS_NewSVGMatrix(aMatrix);
 
   for (nsIFrame* kid = mFrames.FirstChild(); kid;
        kid = kid->GetNextSibling()) {
+    // The CTM of each frame referencing us can be different
+    nsISVGChildFrame* SVGFrame = do_QueryFrame(kid);
+    if (SVGFrame) {
+      SVGFrame->NotifySVGChanged(nsISVGChildFrame::SUPPRESS_INVALIDATION |
+                                 nsISVGChildFrame::TRANSFORM_CHANGED);
+    }
     nsSVGUtils::PaintFrameWithEffects(&tmpState, nsnull, kid);
   }
 
   PRUint8 *data   = image->Data();
   PRInt32  stride = image->Stride();
 
   nsIntRect rect(0, 0, surfaceSize.width, surfaceSize.height);
   nsSVGUtils::UnPremultiplyImageDataAlpha(data, stride, rect);