Bug 680035 - Filter elements do not react to color-interpolation-filters attribute changes. r=roc
authorRobert Longson <longsonr@gmail.com>
Sat, 20 Aug 2011 14:02:41 +0100
changeset 75602 4d3de57cf81321d04014c64e11b0e7f2e5ab9941
parent 75601 279d6114667df516015ee497b16004f8ee5284fd
child 75604 955f83dc4372d50ab24ff685d462f036b68aae1e
push id21040
push userbmo@edmorley.co.uk
push dateSun, 21 Aug 2011 18:16:59 +0000
treeherdermozilla-central@482742e6fff7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs680035
milestone9.0a1
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 680035 - Filter elements do not react to color-interpolation-filters attribute changes. r=roc
content/svg/content/src/nsSVGFilters.cpp
content/svg/content/src/nsSVGFilters.h
layout/reftests/svg/dynamic-filter-contents-01.svg
layout/reftests/svg/dynamic-filter-contents-01a.svg
layout/reftests/svg/dynamic-filter-contents-01b.svg
layout/reftests/svg/reftest.list
--- a/content/svg/content/src/nsSVGFilters.cpp
+++ b/content/svg/content/src/nsSVGFilters.cpp
@@ -283,16 +283,30 @@ NS_IMETHODIMP nsSVGFE::GetHeight(nsIDOMS
 
 /* readonly attribute nsIDOMSVGAnimatedString result; */
 NS_IMETHODIMP nsSVGFE::GetResult(nsIDOMSVGAnimatedString * *aResult)
 {
   return GetResultImageName().ToDOMAnimatedString(aResult, this);
 }
 
 //----------------------------------------------------------------------
+// nsIContent methods
+
+NS_IMETHODIMP_(PRBool)
+nsSVGFE::IsAttributeMapped(const nsIAtom* name) const
+{
+  static const MappedAttributeEntry* const map[] = {
+    sFiltersMap
+  };
+  
+  return FindAttributeDependence(name, map, NS_ARRAY_LENGTH(map)) ||
+    nsSVGFEBase::IsAttributeMapped(name);
+}
+
+//----------------------------------------------------------------------
 // nsSVGElement methods
 
 nsSVGElement::LengthAttributesInfo
 nsSVGFE::GetLengthInfo()
 {
   return LengthAttributesInfo(mLengthAttributes, sLengthInfo,
                               NS_ARRAY_LENGTH(sLengthInfo));
 }
@@ -2746,18 +2760,17 @@ nsSVGFEFloodElement::ComputeTargetBBox(c
 
 //----------------------------------------------------------------------
 // nsIContent methods
 
 NS_IMETHODIMP_(PRBool)
 nsSVGFEFloodElement::IsAttributeMapped(const nsIAtom* name) const
 {
   static const MappedAttributeEntry* const map[] = {
-    sFEFloodMap,
-    sFiltersMap
+    sFEFloodMap
   };
   
   return FindAttributeDependence(name, map, NS_ARRAY_LENGTH(map)) ||
     nsSVGFEFloodElementBase::IsAttributeMapped(name);
 }
 
 //----------------------------------------------------------------------
 // nsSVGElement methods
--- a/content/svg/content/src/nsSVGFilters.h
+++ b/content/svg/content/src/nsSVGFilters.h
@@ -142,16 +142,19 @@ public:
   virtual PRBool SubregionIsUnionOfRegions() { return PR_TRUE; }
 
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_SVG_FE_CID)
   
   // interfaces:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIDOMSVGFILTERPRIMITIVESTANDARDATTRIBUTES
 
+  // nsIContent interface
+  NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
+
   virtual nsSVGString& GetResultImageName() = 0;
   // Return a list of all image names used as sources. Default is to
   // return no sources.
   virtual void GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources);
   // Compute the bounding box of the filter output. The default is just the
   // union of the source bounding boxes. The caller is
   // responsible for clipping this to the filter primitive subregion, so
   // if the filter fills its filter primitive subregion, it can just
rename from layout/reftests/svg/dynamic-filter-contents-01.svg
rename to layout/reftests/svg/dynamic-filter-contents-01a.svg
new file mode 100644
--- /dev/null
+++ b/layout/reftests/svg/dynamic-filter-contents-01b.svg
@@ -0,0 +1,28 @@
+<!--
+     Any copyright is dedicated to the Public Domain.
+     http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<svg class="reftest-wait" xmlns="http://www.w3.org/2000/svg" onload="startTest()">
+  <defs>
+    <filter id="f" filterUnits="objectBoundingBox" primitiveUnits="objectBoundingBox" 
+            x="0" y="0" width="1" height="1">
+      <feFlood flood-color="#ff0000" flood-opacity="0.5" result="flood"/>
+      <feComposite id="comp" width="1" height="1" in="flood" operator="over" in2="SourceGraphic"/>
+    </filter>
+  </defs>
+
+  <rect width="100" height="100" fill="lime" filter="url(#f)"/>
+
+  <script>
+  function startTest() {
+    document.addEventListener("MozReftestInvalidate", doTest, false);
+    // in case we're not gecko
+    setTimeout(doTest, 5000);
+  }
+
+  function doTest() {
+    document.getElementById("comp").setAttribute("color-interpolation-filters", "sRGB");
+    document.documentElement.removeAttribute('class');
+  }
+  </script>
+</svg>
--- a/layout/reftests/svg/reftest.list
+++ b/layout/reftests/svg/reftest.list
@@ -59,17 +59,18 @@ fails-if(Android) == dynamic-conditions-
 == dynamic-conditions-09.svg about:blank
 == dynamic-conditions-10.svg about:blank
 == dynamic-conditions-11.svg pass.svg
 == dynamic-conditions-12.svg pass.svg
 == dynamic-conditions-13.svg about:blank
 == dynamic-clipPath-01.svg pass.svg
 == dynamic-feFlood-01.svg pass.svg
 == dynamic-feImage-01.svg pass.svg
-== dynamic-filter-contents-01.svg dynamic-filter-contents-01-ref.svg
+== dynamic-filter-contents-01a.svg dynamic-filter-contents-01-ref.svg
+== dynamic-filter-contents-01b.svg dynamic-filter-contents-01-ref.svg
 == dynamic-gradient-contents-01.svg pass.svg
 == dynamic-gradient-contents-02.svg pass.svg
 == dynamic-inner-svg-01.svg pass.svg
 == dynamic-link-style-01.svg pass.svg
 == dynamic-marker-01.svg pass.svg
 == dynamic-marker-02.svg dynamic-marker-02-ref.svg
 == dynamic-mask-contents-01.svg pass.svg
 == dynamic-pattern-01.svg pass.svg