Bug 687445 - Do not round mask size till after the CTM transform has been applied. r=roc
authorRobert Longson <longsonr@gmail.com>
Wed, 21 Sep 2011 12:30:38 +0100
changeset 77265 c0070ea57a4eea55d3ab2b05bd8d3daed6c2fa7a
parent 77250 a3d4a447c8fc8512b169b9d5679f6ab198d5fab6
child 77266 c7233b484b951611b466b024e172bb09066f3627
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
reviewersroc
bugs687445
milestone9.0a1
Bug 687445 - Do not round mask size till after the CTM transform has been applied. r=roc
layout/reftests/svg/dynamic-clipPath-02.svg
layout/reftests/svg/dynamic-marker-03.svg
layout/reftests/svg/dynamic-mask-01.svg
layout/reftests/svg/reftest.list
layout/svg/base/src/nsSVGMaskFrame.cpp
--- a/layout/reftests/svg/dynamic-clipPath-02.svg
+++ b/layout/reftests/svg/dynamic-clipPath-02.svg
@@ -24,14 +24,14 @@
     function startTest() {
       document.addEventListener("MozReftestInvalidate", doTest, false);
       // in case we're not gecko
       setTimeout(doTest, 5000);
     }
 
     function doTest() {
       var clip1 = document.getElementById("clip1");
-      clip1.setAttribute("clipPathUnits", "userSpaceOnUse");
+      clip1.clipPathUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE;
 
       document.documentElement.removeAttribute("class");
     }
   </script>
 </svg>
--- a/layout/reftests/svg/dynamic-marker-03.svg
+++ b/layout/reftests/svg/dynamic-marker-03.svg
@@ -1,9 +1,8 @@
-<?xml version="1.0" encoding="Windows-1252"?>
 <!--
      Any copyright is dedicated to the Public Domain.
      http://creativecommons.org/publicdomain/zero/1.0/
 -->
 <svg xmlns="http://www.w3.org/2000/svg" class="reftest-wait"
   onload="startTest()">
 
   <title>Testing that dynamic changes to preserveAspectRatio are reflected in the marker</title>
--- a/layout/reftests/svg/dynamic-mask-01.svg
+++ b/layout/reftests/svg/dynamic-mask-01.svg
@@ -1,38 +1,49 @@
-<?xml version="1.0" encoding="Windows-1252"?>
 <!--
      Any copyright is dedicated to the Public Domain.
      http://creativecommons.org/publicdomain/zero/1.0/
 -->
 <svg xmlns="http://www.w3.org/2000/svg" version="1.1"
      class="reftest-wait"
      onload="startTest()"
      xmlns:xlink="http://www.w3.org/1999/xlink">
   <title>Testing that dynamic changes to mask attributes are reflected in the mask</title>
 
   <defs>
     <mask id="mask1" width="1" height="1">
       <rect width="1" height="1" fill="white"/>
     </mask>
+    <mask id="mask2" width="1" height="1">
+      <rect width="1" height="1" fill="white"/>
+    </mask>
+    <mask id="mask3" width="1" height="1">
+      <rect width="1" height="1" fill="white"/>
+    </mask>
   </defs>
 
   <rect width="100%" height="100%" fill="lime"/>
 
   <g transform="scale(500)">
     <rect x=".2" y=".2" width=".2" height=".2" fill="red" mask="url(#mask1)"/>
+    <rect x=".4" y=".2" width=".2" height=".2" fill="red" mask="url(#mask2)"/>
+    <rect x=".2" y=".4" width=".2" height=".2" fill="red" mask="url(#mask3)" />
   </g>
 
   <script>
     function startTest() {
       document.addEventListener("MozReftestInvalidate", doTest, false);
       // in case we're not gecko
       setTimeout(doTest, 5000);
     }
 
     function doTest() {
       var mask1 = document.getElementById("mask1");
-      mask1.maskUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE;
+      mask1.width.baseVal.value = 0;
+      var mask2 = document.getElementById("mask2");
+      mask2.height.baseVal.value = 0;
+      var mask3 = document.getElementById("mask3");
+      mask3.maskUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE;
 
       document.documentElement.removeAttribute("class");
     }
   </script>
 </svg>
--- a/layout/reftests/svg/reftest.list
+++ b/layout/reftests/svg/reftest.list
@@ -139,18 +139,17 @@ fails == inline-in-xul-basic-01.xul pass
 == invalid-text-01.svg pass.svg
 == linearGradient-basic-01.svg pass.svg
 == linearGradient-basic-02.svg pass.svg
 == markers-and-group-opacity-01.svg markers-and-group-opacity-01-ref.svg
 == marker-attribute-01.svg pass.svg
 == marker-viewBox-01.svg marker-viewBox-01-ref.svg
 == mask-basic-01.svg pass.svg
 == mask-containing-masked-content-01.svg pass.svg
-# Bug 456323
-# == mask-transformed-01.svg mask-transformed-01-ref.svg
+== 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
 random-if(gtk2Widget) == objectBoundingBox-and-fePointLight-02.svg objectBoundingBox-and-fePointLight-02-ref.svg
 == objectBoundingBox-and-mask.svg pass.svg
 == objectBoundingBox-and-mask-02.svg pass.svg
--- a/layout/svg/base/src/nsSVGMaskFrame.cpp
+++ b/layout/svg/base/src/nsSVGMaskFrame.cpp
@@ -76,23 +76,23 @@ nsSVGMaskFrame::ComputeMaskAlpha(nsSVGRe
     mask->mEnumAttributes[nsSVGMaskElement::MASKUNITS].GetAnimValue();
   gfxRect bbox;
   if (units == nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
     bbox = nsSVGUtils::GetBBox(aParent);
   }
 
   gfxRect maskArea = nsSVGUtils::GetRelativeRect(units,
     &mask->mLengthAttributes[nsSVGMaskElement::X], bbox, aParent);
-  maskArea.RoundOut();
 
   gfxContext *gfx = aContext->GetGfxContext();
 
   gfx->Save();
   nsSVGUtils::SetClipRect(gfx, aMatrix, maskArea);
   gfxRect clipExtents = gfx->GetClipExtents();
+  clipExtents.RoundOut();
   gfx->Restore();
 
 #ifdef DEBUG_tor
   fprintf(stderr, "clip extent: %f,%f %fx%f\n",
           clipExtents.X(), clipExtents.Y(),
           clipExtents.Width(), clipExtents.Height());
 #endif