[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

zherczeg at webkit.org zherczeg at webkit.org
Mon Feb 21 00:30:48 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit fddf5fbac3e2efb95f26e0ea016fe408032ada04
Author: zherczeg at webkit.org <zherczeg at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Feb 1 10:48:02 2011 +0000

    LightElement changes does not require relayout.
    https://bugs.webkit.org/show_bug.cgi?id=53232
    
    Reviewed by Dirk Schulze.
    
    When an attribute of a LightElement changes, it
    send an update message to the lighting filters
    to update its corresponding LightSource objects,
    and repaint the filters.
    
    Duplicated 'id' attributes removed from svg-filter-animation.svg.
    
    Existing dynamic-update tests covers this feature.
    
    5x speedup on manual-tests/svg-filter-animation.svg
    
    * manual-tests/svg-filter-animation.svg:
    * platform/graphics/filters/DistantLightSource.h:
    * platform/graphics/filters/FEDiffuseLighting.cpp:
    (WebCore::FEDiffuseLighting::setLightingColor):
    (WebCore::FEDiffuseLighting::setSurfaceScale):
    (WebCore::FEDiffuseLighting::setDiffuseConstant):
    (WebCore::FEDiffuseLighting::setKernelUnitLengthX):
    (WebCore::FEDiffuseLighting::setKernelUnitLengthY):
    * platform/graphics/filters/FEDiffuseLighting.h:
    * platform/graphics/filters/LightSource.cpp:
    (WebCore::PointLightSource::setX):
    (WebCore::PointLightSource::setY):
    (WebCore::PointLightSource::setZ):
    (WebCore::SpotLightSource::setX):
    (WebCore::SpotLightSource::setY):
    (WebCore::SpotLightSource::setZ):
    (WebCore::SpotLightSource::setPointsAtX):
    (WebCore::SpotLightSource::setPointsAtY):
    (WebCore::SpotLightSource::setPointsAtZ):
    (WebCore::SpotLightSource::setSpecularExponent):
    (WebCore::SpotLightSource::setLimitingConeAngle):
    (WebCore::DistantLightSource::setAzimuth):
    (WebCore::DistantLightSource::setElevation):
    (WebCore::LightSource::setAzimuth):
    (WebCore::LightSource::setElevation):
    (WebCore::LightSource::setX):
    (WebCore::LightSource::setY):
    (WebCore::LightSource::setZ):
    (WebCore::LightSource::setPointsAtX):
    (WebCore::LightSource::setPointsAtY):
    (WebCore::LightSource::setPointsAtZ):
    (WebCore::LightSource::setSpecularExponent):
    (WebCore::LightSource::setLimitingConeAngle):
    * platform/graphics/filters/LightSource.h:
    * platform/graphics/filters/PointLightSource.h:
    * platform/graphics/filters/SpotLightSource.h:
    * rendering/svg/RenderSVGResourceFilter.cpp:
    (WebCore::RenderSVGResourceFilter::primitiveAttributeChanged):
    * svg/SVGFEDiffuseLightingElement.cpp:
    (WebCore::SVGFEDiffuseLightingElement::setFilterEffectAttribute):
    (WebCore::SVGFEDiffuseLightingElement::lightElementAttributeChanged):
    (WebCore::SVGFEDiffuseLightingElement::build):
    (WebCore::SVGFEDiffuseLightingElement::findLightElement):
    (WebCore::SVGFEDiffuseLightingElement::findLight):
    * svg/SVGFEDiffuseLightingElement.h:
    * svg/SVGFELightElement.cpp:
    (WebCore::SVGFELightElement::svgAttributeChanged):
    * svg/SVGFilterPrimitiveStandardAttributes.cpp:
    (WebCore::SVGFilterPrimitiveStandardAttributes::setFilterEffectAttribute):
    * svg/SVGFilterPrimitiveStandardAttributes.h:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77240 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index b41f26e..9896800 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,72 @@
+2011-02-01  Zoltan Herczeg  <zherczeg at webkit.org>
+
+        Reviewed by Dirk Schulze.
+
+        LightElement changes does not require relayout.
+        https://bugs.webkit.org/show_bug.cgi?id=53232
+
+        When an attribute of a LightElement changes, it
+        send an update message to the lighting filters
+        to update its corresponding LightSource objects,
+        and repaint the filters.
+
+        Duplicated 'id' attributes removed from svg-filter-animation.svg.
+
+        Existing dynamic-update tests covers this feature.
+
+        5x speedup on manual-tests/svg-filter-animation.svg
+
+        * manual-tests/svg-filter-animation.svg:
+        * platform/graphics/filters/DistantLightSource.h:
+        * platform/graphics/filters/FEDiffuseLighting.cpp:
+        (WebCore::FEDiffuseLighting::setLightingColor):
+        (WebCore::FEDiffuseLighting::setSurfaceScale):
+        (WebCore::FEDiffuseLighting::setDiffuseConstant):
+        (WebCore::FEDiffuseLighting::setKernelUnitLengthX):
+        (WebCore::FEDiffuseLighting::setKernelUnitLengthY):
+        * platform/graphics/filters/FEDiffuseLighting.h:
+        * platform/graphics/filters/LightSource.cpp:
+        (WebCore::PointLightSource::setX):
+        (WebCore::PointLightSource::setY):
+        (WebCore::PointLightSource::setZ):
+        (WebCore::SpotLightSource::setX):
+        (WebCore::SpotLightSource::setY):
+        (WebCore::SpotLightSource::setZ):
+        (WebCore::SpotLightSource::setPointsAtX):
+        (WebCore::SpotLightSource::setPointsAtY):
+        (WebCore::SpotLightSource::setPointsAtZ):
+        (WebCore::SpotLightSource::setSpecularExponent):
+        (WebCore::SpotLightSource::setLimitingConeAngle):
+        (WebCore::DistantLightSource::setAzimuth):
+        (WebCore::DistantLightSource::setElevation):
+        (WebCore::LightSource::setAzimuth):
+        (WebCore::LightSource::setElevation):
+        (WebCore::LightSource::setX):
+        (WebCore::LightSource::setY):
+        (WebCore::LightSource::setZ):
+        (WebCore::LightSource::setPointsAtX):
+        (WebCore::LightSource::setPointsAtY):
+        (WebCore::LightSource::setPointsAtZ):
+        (WebCore::LightSource::setSpecularExponent):
+        (WebCore::LightSource::setLimitingConeAngle):
+        * platform/graphics/filters/LightSource.h:
+        * platform/graphics/filters/PointLightSource.h:
+        * platform/graphics/filters/SpotLightSource.h:
+        * rendering/svg/RenderSVGResourceFilter.cpp:
+        (WebCore::RenderSVGResourceFilter::primitiveAttributeChanged):
+        * svg/SVGFEDiffuseLightingElement.cpp:
+        (WebCore::SVGFEDiffuseLightingElement::setFilterEffectAttribute):
+        (WebCore::SVGFEDiffuseLightingElement::lightElementAttributeChanged):
+        (WebCore::SVGFEDiffuseLightingElement::build):
+        (WebCore::SVGFEDiffuseLightingElement::findLightElement):
+        (WebCore::SVGFEDiffuseLightingElement::findLight):
+        * svg/SVGFEDiffuseLightingElement.h:
+        * svg/SVGFELightElement.cpp:
+        (WebCore::SVGFELightElement::svgAttributeChanged):
+        * svg/SVGFilterPrimitiveStandardAttributes.cpp:
+        (WebCore::SVGFilterPrimitiveStandardAttributes::setFilterEffectAttribute):
+        * svg/SVGFilterPrimitiveStandardAttributes.h:
+
 2011-02-01  Roland Steiner  <rolandsteiner at chromium.org>
 
         Reviewed by Dimitri Glazkov.
diff --git a/Source/WebCore/manual-tests/svg-filter-animation.svg b/Source/WebCore/manual-tests/svg-filter-animation.svg
index 5b7c9cc..4bca5e2 100644
--- a/Source/WebCore/manual-tests/svg-filter-animation.svg
+++ b/Source/WebCore/manual-tests/svg-filter-animation.svg
@@ -34,16 +34,16 @@
 
 <defs>
 <filter id="filt" filterUnits="objectBoundingBox" x="0" y="0" width="100%" height="100%">
-    <feTurbulence id="turb" baseFrequency="0.03" numOctaves="4" seed="67" result="turb"/>
-    <feGaussianBlur in="SourceGraphic" primitiveUnits="objectBoundingBox" id="blur" stdDeviation="1" result="blur"/>
+    <feTurbulence baseFrequency="0.03" numOctaves="4" seed="67" result="turb"/>
+    <feGaussianBlur in="SourceGraphic" primitiveUnits="objectBoundingBox" stdDeviation="1" result="blur"/>
     <feComposite in="turb" in2="blur" operator="arithmetic" k2="0.3" k3="1" result="comp"/>
-    <feDiffuseLighting in="comp" primitiveUnits="objectBoundingBox" id="diff" diffuseConstant="1" lighting-color="white" surfaceScale="10" result="light" >
+    <feDiffuseLighting in="comp" primitiveUnits="objectBoundingBox" diffuseConstant="1" lighting-color="white" surfaceScale="10" result="light" >
         <feSpotLight id="light" x="0" y="300" z="200" pointsAtX="-200" pointsAtY="100" pointsAtZ="0" limitingConeAngle="90" specularExponent="20" />
     </feDiffuseLighting>
-    <feSpecularLighting in="comp" primitiveUnits="objectBoundingBox" id="diff" diffuseConstant="1" lighting-color="#A66102" surfaceScale="10" result="ambient" >
-        <feDistantLight id="light" azimuth="0" elevation="90" />
+    <feSpecularLighting in="comp" primitiveUnits="objectBoundingBox" diffuseConstant="1" lighting-color="#A66102" surfaceScale="10" result="ambient" >
+        <feDistantLight azimuth="0" elevation="90" />
     </feSpecularLighting>
-        <feComposite in="light" in2="ambient" operator="arithmetic" k2="1.2" k3=".8"/>
+    <feComposite in="light" in2="ambient" operator="arithmetic" k2="1.2" k3=".8"/>
 </filter>
 </defs>
 
diff --git a/Source/WebCore/platform/graphics/filters/DistantLightSource.h b/Source/WebCore/platform/graphics/filters/DistantLightSource.h
index d5d474f..1e19c62 100644
--- a/Source/WebCore/platform/graphics/filters/DistantLightSource.h
+++ b/Source/WebCore/platform/graphics/filters/DistantLightSource.h
@@ -36,7 +36,9 @@ public:
     }
 
     float azimuth() const { return m_azimuth; }
+    bool setAzimuth(float);
     float elevation() const { return m_elevation; }
+    bool setElevation(float);
 
     virtual void initPaintingData(PaintingData&);
     virtual void updatePaintingData(PaintingData&, int x, int y, float z);
diff --git a/Source/WebCore/platform/graphics/filters/FEDiffuseLighting.cpp b/Source/WebCore/platform/graphics/filters/FEDiffuseLighting.cpp
index a8a825a..5f9d049 100644
--- a/Source/WebCore/platform/graphics/filters/FEDiffuseLighting.cpp
+++ b/Source/WebCore/platform/graphics/filters/FEDiffuseLighting.cpp
@@ -52,9 +52,12 @@ Color FEDiffuseLighting::lightingColor() const
     return m_lightingColor;
 }
 
-void FEDiffuseLighting::setLightingColor(const Color& lightingColor)
+bool FEDiffuseLighting::setLightingColor(const Color& lightingColor)
 {
+    if (m_lightingColor == lightingColor)
+        return false;
     m_lightingColor = lightingColor;
+    return true;
 }
 
 float FEDiffuseLighting::surfaceScale() const 
@@ -62,9 +65,12 @@ float FEDiffuseLighting::surfaceScale() const
     return m_surfaceScale;
 }
 
-void FEDiffuseLighting::setSurfaceScale(float surfaceScale)
+bool FEDiffuseLighting::setSurfaceScale(float surfaceScale)
 {
+    if (m_surfaceScale == surfaceScale)
+        return false;
     m_surfaceScale = surfaceScale;
+    return true;
 }
 
 float FEDiffuseLighting::diffuseConstant() const
@@ -72,9 +78,12 @@ float FEDiffuseLighting::diffuseConstant() const
     return m_diffuseConstant;
 }
 
-void FEDiffuseLighting::setDiffuseConstant(float diffuseConstant)
+bool FEDiffuseLighting::setDiffuseConstant(float diffuseConstant)
 {
+    if (m_diffuseConstant == diffuseConstant)
+        return false;
     m_diffuseConstant = diffuseConstant;
+    return true;
 }
 
 float FEDiffuseLighting::kernelUnitLengthX() const
@@ -82,9 +91,12 @@ float FEDiffuseLighting::kernelUnitLengthX() const
     return m_kernelUnitLengthX;
 }
 
-void FEDiffuseLighting::setKernelUnitLengthX(float kernelUnitLengthX)
+bool FEDiffuseLighting::setKernelUnitLengthX(float kernelUnitLengthX)
 {
+    if (m_kernelUnitLengthX == kernelUnitLengthX)
+        return false;
     m_kernelUnitLengthX = kernelUnitLengthX;
+    return true;
 }
 
 float FEDiffuseLighting::kernelUnitLengthY() const
@@ -92,9 +104,12 @@ float FEDiffuseLighting::kernelUnitLengthY() const
     return m_kernelUnitLengthY;
 }
 
-void FEDiffuseLighting::setKernelUnitLengthY(float kernelUnitLengthY)
+bool FEDiffuseLighting::setKernelUnitLengthY(float kernelUnitLengthY)
 {
+    if (m_kernelUnitLengthY == kernelUnitLengthY)
+        return false;
     m_kernelUnitLengthY = kernelUnitLengthY;
+    return true;
 }
 
 const LightSource* FEDiffuseLighting::lightSource() const
diff --git a/Source/WebCore/platform/graphics/filters/FEDiffuseLighting.h b/Source/WebCore/platform/graphics/filters/FEDiffuseLighting.h
index b58b47a..5f20651 100644
--- a/Source/WebCore/platform/graphics/filters/FEDiffuseLighting.h
+++ b/Source/WebCore/platform/graphics/filters/FEDiffuseLighting.h
@@ -36,19 +36,19 @@ public:
     virtual ~FEDiffuseLighting();
 
     Color lightingColor() const;
-    void setLightingColor(const Color&);
+    bool setLightingColor(const Color&);
 
     float surfaceScale() const;
-    void setSurfaceScale(float);
+    bool setSurfaceScale(float);
 
     float diffuseConstant() const;
-    void setDiffuseConstant(float);
+    bool setDiffuseConstant(float);
 
     float kernelUnitLengthX() const;
-    void setKernelUnitLengthX(float);
+    bool setKernelUnitLengthX(float);
 
     float kernelUnitLengthY() const;
-    void setKernelUnitLengthY(float);
+    bool setKernelUnitLengthY(float);
 
     const LightSource* lightSource() const;
     void setLightSource(PassRefPtr<LightSource>);
diff --git a/Source/WebCore/platform/graphics/filters/LightSource.cpp b/Source/WebCore/platform/graphics/filters/LightSource.cpp
index de0691e..e50e62d 100644
--- a/Source/WebCore/platform/graphics/filters/LightSource.cpp
+++ b/Source/WebCore/platform/graphics/filters/LightSource.cpp
@@ -45,6 +45,30 @@ void PointLightSource::updatePaintingData(PaintingData& paintingData, int x, int
     paintingData.lightVectorLength = paintingData.lightVector.length();
 }
 
+bool PointLightSource::setX(float x)
+{
+    if (m_position.x() == x)
+        return false;
+    m_position.setX(x);
+    return true;
+}
+
+bool PointLightSource::setY(float y)
+{
+    if (m_position.y() == y)
+        return false;
+    m_position.setY(y);
+    return true;
+}
+
+bool PointLightSource::setZ(float z)
+{
+    if (m_position.z() == z)
+        return false;
+    m_position.setZ(z);
+    return true;
+}
+
 // spot-light edge darkening depends on an absolute treshold
 // according to the SVG 1.1 SE light regression tests
 static const float antiAliasTreshold = 0.016f;
@@ -120,6 +144,70 @@ void SpotLightSource::updatePaintingData(PaintingData& paintingData, int x, int
     paintingData.colorVector.setZ(paintingData.privateColorVector.z() * lightStrength);
 }
 
+bool SpotLightSource::setX(float x)
+{
+    if (m_position.x() == x)
+        return false;
+    m_position.setX(x);
+    return true;
+}
+
+bool SpotLightSource::setY(float y)
+{
+    if (m_position.y() == y)
+        return false;
+    m_position.setY(y);
+    return true;
+}
+
+bool SpotLightSource::setZ(float z)
+{
+    if (m_position.z() == z)
+        return false;
+    m_position.setZ(z);
+    return true;
+}
+
+bool SpotLightSource::setPointsAtX(float pointsAtX)
+{
+    if (m_direction.x() == pointsAtX)
+        return false;
+    m_direction.setX(pointsAtX);
+    return true;
+}
+
+bool SpotLightSource::setPointsAtY(float pointsAtY)
+{
+    if (m_direction.y() == pointsAtY)
+        return false;
+    m_direction.setY(pointsAtY);
+    return true;
+}
+
+bool SpotLightSource::setPointsAtZ(float pointsAtZ)
+{
+    if (m_direction.z() == pointsAtZ)
+        return false;
+    m_direction.setZ(pointsAtZ);
+    return true;
+}
+
+bool SpotLightSource::setSpecularExponent(float specularExponent)
+{
+    if (m_specularExponent == specularExponent)
+        return false;
+    m_specularExponent = specularExponent;
+    return true;
+}
+
+bool SpotLightSource::setLimitingConeAngle(float limitingConeAngle)
+{
+    if (m_limitingConeAngle == limitingConeAngle)
+        return false;
+    m_limitingConeAngle = limitingConeAngle;
+    return true;
+}
+
 void DistantLightSource::initPaintingData(PaintingData& paintingData)
 {
     float azimuth = deg2rad(m_azimuth);
@@ -134,6 +222,98 @@ void DistantLightSource::updatePaintingData(PaintingData&, int, int, float)
 {
 }
 
+bool DistantLightSource::setAzimuth(float azimuth)
+{
+    if (m_azimuth == azimuth)
+        return false;
+    m_azimuth = azimuth;
+    return true;
+}
+
+bool DistantLightSource::setElevation(float elevation)
+{
+    if (m_elevation == elevation)
+        return false;
+    m_elevation = elevation;
+    return true;
+}
+
+bool LightSource::setAzimuth(float azimuth)
+{
+    if (m_type == LS_DISTANT)
+        return static_cast<DistantLightSource*>(this)->setAzimuth(azimuth);
+    return false;
+}
+
+bool LightSource::setElevation(float elevation)
+{
+    if (m_type == LS_DISTANT)
+        return static_cast<DistantLightSource*>(this)->setElevation(elevation);
+    return false;
+}
+
+bool LightSource::setX(float x)
+{
+    if (m_type == LS_SPOT)
+        return static_cast<SpotLightSource*>(this)->setX(x);
+    if (m_type == LS_POINT)
+        return static_cast<PointLightSource*>(this)->setX(x);
+    return false;
+}
+
+bool LightSource::setY(float y)
+{
+    if (m_type == LS_SPOT)
+        return static_cast<SpotLightSource*>(this)->setY(y);
+    if (m_type == LS_POINT)
+        return static_cast<PointLightSource*>(this)->setY(y);
+    return false;
+}
+
+bool LightSource::setZ(float z)
+{
+    if (m_type == LS_SPOT)
+        return static_cast<SpotLightSource*>(this)->setZ(z);
+    if (m_type == LS_POINT)
+        return static_cast<PointLightSource*>(this)->setZ(z);
+    return false;
+}
+
+bool LightSource::setPointsAtX(float pointsAtX)
+{
+    if (m_type == LS_SPOT)
+        return static_cast<SpotLightSource*>(this)->setPointsAtX(pointsAtX);
+    return false;
+}
+
+bool LightSource::setPointsAtY(float pointsAtY)
+{
+    if (m_type == LS_SPOT)
+        return static_cast<SpotLightSource*>(this)->setPointsAtY(pointsAtY);
+    return false;
+}
+
+bool LightSource::setPointsAtZ(float pointsAtZ)
+{
+    if (m_type == LS_SPOT)
+        return static_cast<SpotLightSource*>(this)->setPointsAtZ(pointsAtZ);
+    return false;
+}
+
+bool LightSource::setSpecularExponent(float specularExponent)
+{
+    if (m_type == LS_SPOT)
+        return static_cast<SpotLightSource*>(this)->setSpecularExponent(specularExponent);
+    return false;
+}
+
+bool LightSource::setLimitingConeAngle(float limitingConeAngle)
+{
+    if (m_type == LS_SPOT)
+        return static_cast<SpotLightSource*>(this)->setLimitingConeAngle(limitingConeAngle);
+    return false;
+}
+
 static TextStream& operator<<(TextStream& ts, const FloatPoint3D& p)
 {
     ts << "x=" << p.x() << " y=" << p.y() << " z=" << p.z();
diff --git a/Source/WebCore/platform/graphics/filters/LightSource.h b/Source/WebCore/platform/graphics/filters/LightSource.h
index 013e910..24c319a 100644
--- a/Source/WebCore/platform/graphics/filters/LightSource.h
+++ b/Source/WebCore/platform/graphics/filters/LightSource.h
@@ -74,6 +74,17 @@ public:
     // specified "surfaceScale" constant, which type is <number> in the SVG standard
     virtual void updatePaintingData(PaintingData&, int x, int y, float z) = 0;
 
+    bool setAzimuth(float);
+    bool setElevation(float);
+    bool setX(float);
+    bool setY(float);
+    bool setZ(float);
+    bool setPointsAtX(float);
+    bool setPointsAtY(float);
+    bool setPointsAtZ(float);
+    bool setSpecularExponent(float);
+    bool setLimitingConeAngle(float);
+
 private:
     LightType m_type;
 };
diff --git a/Source/WebCore/platform/graphics/filters/PointLightSource.h b/Source/WebCore/platform/graphics/filters/PointLightSource.h
index 163c829..a93bf2c 100644
--- a/Source/WebCore/platform/graphics/filters/PointLightSource.h
+++ b/Source/WebCore/platform/graphics/filters/PointLightSource.h
@@ -36,6 +36,9 @@ public:
     }
 
     const FloatPoint3D& position() const { return m_position; }
+    bool setX(float);
+    bool setY(float);
+    bool setZ(float);
 
     virtual void initPaintingData(PaintingData&);
     virtual void updatePaintingData(PaintingData&, int x, int y, float z);
diff --git a/Source/WebCore/platform/graphics/filters/SpotLightSource.h b/Source/WebCore/platform/graphics/filters/SpotLightSource.h
index cd6a614..b4f1b61 100644
--- a/Source/WebCore/platform/graphics/filters/SpotLightSource.h
+++ b/Source/WebCore/platform/graphics/filters/SpotLightSource.h
@@ -37,10 +37,18 @@ public:
     }
 
     const FloatPoint3D& position() const { return m_position; }
+    bool setX(float);
+    bool setY(float);
+    bool setZ(float);
     const FloatPoint3D& direction() const { return m_direction; }
+    bool setPointsAtX(float);
+    bool setPointsAtY(float);
+    bool setPointsAtZ(float);
 
     float specularExponent() const { return m_specularExponent; }
+    bool setSpecularExponent(float);
     float limitingConeAngle() const { return m_limitingConeAngle; }
+    bool setLimitingConeAngle(float);
 
     virtual void initPaintingData(PaintingData&);
     virtual void updatePaintingData(PaintingData&, int x, int y, float z);
diff --git a/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp b/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp
index ce95891..96514af 100644
--- a/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp
+++ b/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp
@@ -342,7 +342,10 @@ void RenderSVGResourceFilter::primitiveAttributeChanged(RenderObject* object, co
         FilterEffect* effect = builder->effectByRenderer(object);
         if (!effect)
             continue;
-        primitve->setFilterEffectAttribute(effect, attribute);
+        // Since all effects shares the same attribute value, all
+        // or none of them will be changed.
+        if (!primitve->setFilterEffectAttribute(effect, attribute))
+            return;
         builder->clearResultsRecursive(effect);
 
         // Repaint the image on the screen.
diff --git a/Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp b/Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp
index 10f7439..eb407f1 100644
--- a/Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp
+++ b/Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp
@@ -84,17 +84,44 @@ void SVGFEDiffuseLightingElement::parseMappedAttribute(Attribute* attr)
         SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr);
 }
 
-void SVGFEDiffuseLightingElement::setFilterEffectAttribute(FilterEffect* effect, const QualifiedName& attrName)
+bool SVGFEDiffuseLightingElement::setFilterEffectAttribute(FilterEffect* effect, const QualifiedName& attrName)
 {
     FEDiffuseLighting* diffuseLighting = static_cast<FEDiffuseLighting*>(effect);
     if (attrName == SVGNames::surfaceScaleAttr)
-        diffuseLighting->setSurfaceScale(surfaceScale());
-    else if (attrName == SVGNames::diffuseConstantAttr)
-        diffuseLighting->setDiffuseConstant(diffuseConstant());
-    else if (attrName == SVGNames::lighting_colorAttr) {
+        return diffuseLighting->setSurfaceScale(surfaceScale());
+    if (attrName == SVGNames::diffuseConstantAttr)
+        return diffuseLighting->setDiffuseConstant(diffuseConstant());
+    if (attrName == SVGNames::lighting_colorAttr) {
         RefPtr<RenderStyle> filterStyle = styleForRenderer();
-        diffuseLighting->setLightingColor(filterStyle->svgStyle()->lightingColor());
+        return diffuseLighting->setLightingColor(filterStyle->svgStyle()->lightingColor());
     }
+
+    LightSource* lightSource = const_cast<LightSource*>(diffuseLighting->lightSource());
+    const SVGFELightElement* lightElement = findLightElement();
+
+    if (attrName == SVGNames::azimuthAttr)
+        return lightSource->setAzimuth(lightElement->azimuth());
+    if (attrName == SVGNames::elevationAttr)
+        return lightSource->setElevation(lightElement->elevation());
+    if (attrName == SVGNames::xAttr)
+        return lightSource->setX(lightElement->x());
+    if (attrName == SVGNames::yAttr)
+        return lightSource->setY(lightElement->y());
+    if (attrName == SVGNames::zAttr)
+        return lightSource->setZ(lightElement->z());
+    if (attrName == SVGNames::pointsAtXAttr)
+        return lightSource->setPointsAtX(lightElement->pointsAtX());
+    if (attrName == SVGNames::pointsAtYAttr)
+        return lightSource->setPointsAtY(lightElement->pointsAtY());
+    if (attrName == SVGNames::pointsAtZAttr)
+        return lightSource->setPointsAtZ(lightElement->pointsAtZ());
+    if (attrName == SVGNames::specularExponentAttr)
+        return lightSource->setSpecularExponent(lightElement->specularExponent());
+    if (attrName == SVGNames::limitingConeAngleAttr)
+        return lightSource->setLimitingConeAngle(lightElement->limitingConeAngle());
+
+    ASSERT_NOT_REACHED();
+    return false;
 }
 
 void SVGFEDiffuseLightingElement::svgAttributeChanged(const QualifiedName& attrName)
@@ -111,6 +138,15 @@ void SVGFEDiffuseLightingElement::svgAttributeChanged(const QualifiedName& attrN
         invalidate();
 }
 
+void SVGFEDiffuseLightingElement::lightElementAttributeChanged(const SVGFELightElement* lightElement, const QualifiedName& attrName)
+{
+    if (findLightElement() != lightElement)
+        return;
+
+    // The light element has different attribute names.
+    primitiveAttributeChanged(attrName);
+}
+
 void SVGFEDiffuseLightingElement::synchronizeProperty(const QualifiedName& attrName)
 {
     SVGFilterPrimitiveStandardAttributes::synchronizeProperty(attrName);
@@ -147,25 +183,31 @@ PassRefPtr<FilterEffect> SVGFEDiffuseLightingElement::build(SVGFilterBuilder* fi
     Color color = filterStyle->svgStyle()->lightingColor();
     
     RefPtr<FilterEffect> effect = FEDiffuseLighting::create(filter, color, surfaceScale(), diffuseConstant(), 
-                                                                kernelUnitLengthX(), kernelUnitLengthY(), findLights());
+                                                                kernelUnitLengthX(), kernelUnitLengthY(), findLight());
     effect->inputEffects().append(input1);
     return effect.release();
 }
 
-PassRefPtr<LightSource> SVGFEDiffuseLightingElement::findLights() const
+SVGFELightElement* SVGFEDiffuseLightingElement::findLightElement() const
 {
     for (Node* node = firstChild(); node; node = node->nextSibling()) {
         if (node->hasTagName(SVGNames::feDistantLightTag)
             || node->hasTagName(SVGNames::fePointLightTag)
             || node->hasTagName(SVGNames::feSpotLightTag)) {
-            SVGFELightElement* lightNode = static_cast<SVGFELightElement*>(node); 
-            return lightNode->lightSource();
+            return static_cast<SVGFELightElement*>(node);
         }
     }
-
     return 0;
 }
 
+PassRefPtr<LightSource> SVGFEDiffuseLightingElement::findLight() const
+{
+    SVGFELightElement* lightNode = findLightElement();
+    if (!lightNode)
+        return 0;
+    return lightNode->lightSource();
+}
+
 }
 
 #endif // ENABLE(SVG)
diff --git a/Source/WebCore/svg/SVGFEDiffuseLightingElement.h b/Source/WebCore/svg/SVGFEDiffuseLightingElement.h
index e502831..4bfcbd1 100644
--- a/Source/WebCore/svg/SVGFEDiffuseLightingElement.h
+++ b/Source/WebCore/svg/SVGFEDiffuseLightingElement.h
@@ -34,12 +34,13 @@ class SVGColor;
 class SVGFEDiffuseLightingElement : public SVGFilterPrimitiveStandardAttributes {
 public:
     static PassRefPtr<SVGFEDiffuseLightingElement> create(const QualifiedName&, Document*);
+    void lightElementAttributeChanged(const SVGFELightElement*, const QualifiedName&);
 
 private:
     SVGFEDiffuseLightingElement(const QualifiedName&, Document*);
 
     virtual void parseMappedAttribute(Attribute*);
-    virtual void setFilterEffectAttribute(FilterEffect*, const QualifiedName&);
+    virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&);
     virtual void svgAttributeChanged(const QualifiedName&);
     virtual void synchronizeProperty(const QualifiedName&);
     virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*);
@@ -54,7 +55,8 @@ private:
     DECLARE_ANIMATED_NUMBER(KernelUnitLengthX, kernelUnitLengthX)
     DECLARE_ANIMATED_NUMBER(KernelUnitLengthY, kernelUnitLengthY)
 
-    PassRefPtr<LightSource> findLights() const;
+    SVGFELightElement* findLightElement() const;
+    PassRefPtr<LightSource> findLight() const;
 };
 
 } // namespace WebCore
diff --git a/Source/WebCore/svg/SVGFELightElement.cpp b/Source/WebCore/svg/SVGFELightElement.cpp
index 8ff8eb1..3abb7ce 100644
--- a/Source/WebCore/svg/SVGFELightElement.cpp
+++ b/Source/WebCore/svg/SVGFELightElement.cpp
@@ -27,7 +27,9 @@
 #include "Attribute.h"
 #include "RenderObject.h"
 #include "RenderSVGResource.h"
+#include "SVGFEDiffuseLightingElement.h"
 #include "SVGFilterElement.h"
+#include "SVGFilterPrimitiveStandardAttributes.h"
 #include "SVGNames.h"
 
 namespace WebCore {
@@ -91,11 +93,21 @@ void SVGFELightElement::svgAttributeChanged(const QualifiedName& attrName)
         || attrName == SVGNames::pointsAtZAttr
         || attrName == SVGNames::specularExponentAttr
         || attrName == SVGNames::limitingConeAngleAttr) {
-        if (ContainerNode* parent = parentNode()) {
-            RenderObject* renderer = parent->renderer();
-            if (renderer && renderer->isSVGResourceFilterPrimitive())
-                RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
+        ContainerNode* parent = parentNode();
+        if (!parent)
+            return;
+
+        RenderObject* renderer = parent->renderer();
+        if (!renderer || !renderer->isSVGResourceFilterPrimitive())
+            return;
+
+        if (parent->hasTagName(SVGNames::feDiffuseLightingTag)) {
+            SVGFEDiffuseLightingElement* diffuseLighting = static_cast<SVGFEDiffuseLightingElement*>(parent);
+            diffuseLighting->lightElementAttributeChanged(this, attrName);
+            return;
         }
+        // Handler for SpecularLighting has not implemented yet.
+        RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
     }
 }
 
diff --git a/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp b/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp
index 1030b5b..f3389ed 100644
--- a/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp
+++ b/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp
@@ -70,10 +70,11 @@ void SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(Attribute* attr)
         return SVGStyledElement::parseMappedAttribute(attr);
 }
 
-void SVGFilterPrimitiveStandardAttributes::setFilterEffectAttribute(FilterEffect*, const QualifiedName&)
+bool SVGFilterPrimitiveStandardAttributes::setFilterEffectAttribute(FilterEffect*, const QualifiedName&)
 {
     // When all filters support this method, it will be changed to a pure virtual method.
     ASSERT_NOT_REACHED();
+    return false;
 }
 
 void SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(const QualifiedName& attrName)
diff --git a/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h b/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h
index e00c9c0..876aa8d 100644
--- a/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h
+++ b/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h
@@ -42,7 +42,8 @@ public:
     void setStandardAttributes(bool, FilterEffect*) const;
 
     virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter* filter) = 0;
-    virtual void setFilterEffectAttribute(FilterEffect*, const QualifiedName&);
+    // Returns true, if the new value is different from the old one.
+    virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&);
 
 protected:
     SVGFilterPrimitiveStandardAttributes(const QualifiedName&, Document*);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list