Bug 641858 - text does not reflect dynamic gradient/pattern changes r=jwatt
authorRobert Longson <longsonr@gmail.com>
Sun, 03 Apr 2011 13:23:40 +0100
changeset 67578 9de34ccb71ee2967797998227f57849c510c3ea2
parent 67577 f4faa30ceddc42f5ddc50e017715e2e6d5bc99d4
child 67579 70cedf3a3327ce6cbb671a061dad6d94b2723b4e
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwatt
bugs641858
milestone2.2a1pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 641858 - text does not reflect dynamic gradient/pattern changes r=jwatt
layout/reftests/svg/gradient-live-01-ref.svg
layout/reftests/svg/gradient-live-01a.svg
layout/reftests/svg/gradient-live-01b.svg
layout/reftests/svg/gradient-live-01c.svg
layout/reftests/svg/gradient-live-01d.svg
layout/svg/base/src/nsSVGGeometryFrame.cpp
--- a/layout/reftests/svg/gradient-live-01-ref.svg
+++ b/layout/reftests/svg/gradient-live-01-ref.svg
@@ -1,14 +1,16 @@
 <svg xmlns="http://www.w3.org/2000/svg" 
-     xmlns:xlink="http://www.w3.org/1999/xlink">
+     xmlns:xlink="http://www.w3.org/1999/xlink" font-size="80">
 
 <linearGradient id="grad1" gradientUnits="objectBoundingBox" x1="0" y1="0" x2="1" y2="0">
   <stop id="green"   stop-color="#00dd00"   offset="0"/>
   <stop id="blue"    stop-color="#0000dd"   offset="0.5"/>
   <stop id="magenta" stop-color="magenta"   offset="1"/>
 </linearGradient>
 <rect x="20" y="20" width="440" height="80" fill="url(#grad1)" />
 
 <linearGradient id="grad2" xlink:href="#grad1"/>
 <rect x="20" y="150" width="440" height="80" fill="url(#grad2)" />
+<text x="20" y="300" width="440" height="80" fill="url(#grad1)">gradiation</text>
+<text x="20" y="400" width="440" height="80" fill="url(#grad2)">gradiation</text>
 
 </svg>
--- a/layout/reftests/svg/gradient-live-01a.svg
+++ b/layout/reftests/svg/gradient-live-01a.svg
@@ -1,11 +1,11 @@
 <svg xmlns="http://www.w3.org/2000/svg" 
      xmlns:xlink="http://www.w3.org/1999/xlink"
-     class="reftest-wait">
+     class="reftest-wait" font-size="80">
 
 <script type="application/javascript">
   document.addEventListener("MozReftestInvalidate", doTest, false);
   
   function doTest() {
     document.getElementById('grad1').removeChild(document.getElementById('red'));
     document.documentElement.removeAttribute('class');
   }
@@ -19,10 +19,12 @@
   <stop id="blue"    stop-color="#0000dd"   offset="0.5"/>
   <stop id="red"     stop-color="red"       offset="0.6"/>
   <stop id="magenta" stop-color="magenta"   offset="1"/>
 </linearGradient>
 <rect x="20" y="20" width="440" height="80" fill="url(#grad1)" />
 
 <linearGradient id="grad2" xlink:href="#grad1"/>
 <rect x="20" y="150" width="440" height="80" fill="url(#grad2)" />
+<text x="20" y="300" width="440" height="80" fill="url(#grad1)">gradiation</text>
+<text x="20" y="400" width="440" height="80" fill="url(#grad2)">gradiation</text>
 
 </svg>
--- a/layout/reftests/svg/gradient-live-01b.svg
+++ b/layout/reftests/svg/gradient-live-01b.svg
@@ -1,11 +1,11 @@
 <svg xmlns="http://www.w3.org/2000/svg" 
      xmlns:xlink="http://www.w3.org/1999/xlink"
-     class="reftest-wait">
+     class="reftest-wait" font-size="80">
 
 <script type="application/javascript">
   document.addEventListener("MozReftestInvalidate", doTest, false);
 
   function doTest() {
     document.getElementById('blue').setAttribute('offset', '0.5');
     document.documentElement.removeAttribute('class');
   }
@@ -17,10 +17,12 @@
   <stop id="green"   stop-color="#00dd00"   offset="0"/>
   <stop id="blue"    stop-color="#0000dd"   offset="0.9"/>
   <stop id="magenta" stop-color="magenta"   offset="1"/>
 </linearGradient>
 <rect x="20" y="20" width="440" height="80" fill="url(#grad1)" />
 
 <linearGradient id="grad2" xlink:href="#grad1"/>
 <rect x="20" y="150" width="440" height="80" fill="url(#grad2)" />
+<text x="20" y="300" width="440" height="80" fill="url(#grad1)">gradiation</text>
+<text x="20" y="400" width="440" height="80" fill="url(#grad2)">gradiation</text>
 
 </svg>
--- a/layout/reftests/svg/gradient-live-01c.svg
+++ b/layout/reftests/svg/gradient-live-01c.svg
@@ -1,11 +1,11 @@
 <svg xmlns="http://www.w3.org/2000/svg" 
      xmlns:xlink="http://www.w3.org/1999/xlink"
-     class="reftest-wait">
+     class="reftest-wait" font-size="80">
 
  <script type="application/javascript">
    document.addEventListener("MozReftestInvalidate", doTest, false);
 
    function doTest() {
      document.getElementById('blue').setAttribute('stop-color', '#0000dd');
      document.documentElement.removeAttribute('class');
    }
@@ -18,10 +18,12 @@
   <stop id="green"   stop-color="#00dd00"   offset="0"/>
   <stop id="blue"    stop-color="red"       offset="0.5"/>
   <stop id="magenta" stop-color="magenta"   offset="1"/>
 </linearGradient>
 <rect x="20" y="20" width="440" height="80" fill="url(#grad1)" />
 
 <linearGradient id="grad2" xlink:href="#grad1"/>
 <rect x="20" y="150" width="440" height="80" fill="url(#grad2)" />
+<text x="20" y="300" width="440" height="80" fill="url(#grad1)">gradiation</text>
+<text x="20" y="400" width="440" height="80" fill="url(#grad2)">gradiation</text>
 
 </svg>
--- a/layout/reftests/svg/gradient-live-01d.svg
+++ b/layout/reftests/svg/gradient-live-01d.svg
@@ -1,11 +1,11 @@
 <svg xmlns="http://www.w3.org/2000/svg" 
      xmlns:xlink="http://www.w3.org/1999/xlink"
-     class="reftest-wait">
+     class="reftest-wait" font-size="80">
      
 <!-- Tests that gradients are live to stop addition. -->
 
 <script>
 document.addEventListener("MozReftestInvalidate", addBlueStop, false);
 
 function addBlueStop()
 {
@@ -21,10 +21,12 @@ function addBlueStop()
 <linearGradient id="grad1" gradientUnits="objectBoundingBox" x1="0" y1="0" x2="1" y2="0">
   <stop id="green"   stop-color="#00dd00"   offset="0"/>
   <stop id="magenta" stop-color="magenta"   offset="1"/>
 </linearGradient>
 <rect x="20" y="20" width="440" height="80" fill="url(#grad1)" />
 
 <linearGradient id="grad2" xlink:href="#grad1"/>
 <rect x="20" y="150" width="440" height="80" fill="url(#grad2)" />
+<text x="20" y="300" width="440" height="80" fill="url(#grad1)">gradiation</text>
+<text x="20" y="400" width="440" height="80" fill="url(#grad2)">gradiation</text>
 
 </svg>
--- a/layout/svg/base/src/nsSVGGeometryFrame.cpp
+++ b/layout/svg/base/src/nsSVGGeometryFrame.cpp
@@ -63,18 +63,20 @@ nsSVGGeometryFrame::Init(nsIContent* aCo
 
 nsSVGPaintServerFrame *
 nsSVGGeometryFrame::GetPaintServer(const nsStyleSVGPaint *aPaint,
                                    const FramePropertyDescriptor *aType)
 {
   if (aPaint->mType != eStyleSVGPaintType_Server)
     return nsnull;
 
+  nsIFrame *frame = mContent->IsNodeOfType(nsINode::eTEXT) ?
+                      GetParent() : this;
   nsSVGPaintingProperty *property =
-    nsSVGEffects::GetPaintingProperty(aPaint->mPaint.mPaintServer, this, aType);
+    nsSVGEffects::GetPaintingProperty(aPaint->mPaint.mPaintServer, frame, aType);
   if (!property)
     return nsnull;
   nsIFrame *result = property->GetReferencedFrame();
   if (!result)
     return nsnull;
 
   nsIAtom *type = result->GetType();
   if (type != nsGkAtoms::svgLinearGradientFrame &&