[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

krit at webkit.org krit at webkit.org
Thu Oct 29 20:44:41 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit 76f9adfc412f2903ab089320b6b370e7f38fac58
Author: krit at webkit.org <krit at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Oct 14 20:30:35 2009 +0000

    2009-10-14  Dirk Schulze  <krit at webkit.org>
    
            Reviewed by Nikolas Zimmermann.
    
            SVG wrong filterRegions for userSpaceOnUse and percentage values
            [https://bugs.webkit.org/show_bug.cgi?id=30330]
    
            Some clean-up of the SVG filter calculation code. This clean-up
            also fixes the problem with percentage and userSpaceInUse mode.
    
            Test: svg/filters/subRegion-in-userSpace.svg
    
            * platform/graphics/filters/FilterEffect.cpp:
            (WebCore::FilterEffect::FilterEffect):
            * platform/graphics/filters/FilterEffect.h:
            * rendering/SVGRenderSupport.cpp:
            (WebCore::SVGRenderBase::filterBoundingBoxForRenderer):
            * svg/SVGFilterElement.cpp:
            (WebCore::SVGFilterElement::buildFilter):
            (WebCore::SVGFilterElement::canvasResource):
            * svg/SVGFilterElement.h:
            * svg/SVGFilterPrimitiveStandardAttributes.cpp:
            (WebCore::SVGFilterPrimitiveStandardAttributes::setStandardAttributes):
            * svg/graphics/SVGResourceFilter.cpp:
            (WebCore::SVGResourceFilter::SVGResourceFilter):
            (WebCore::SVGResourceFilter::~SVGResourceFilter):
            (WebCore::SVGResourceFilter::addFilterEffect):
            (WebCore::SVGResourceFilter::prepareFilter):
            * svg/graphics/SVGResourceFilter.h:
            (WebCore::SVGResourceFilter::create):
            * svg/graphics/filters/SVGFilter.cpp:
            (WebCore::SVGFilter::SVGFilter):
            (WebCore::SVGFilter::calculateEffectSubRegion):
            (WebCore::SVGFilter::create):
            * svg/graphics/filters/SVGFilter.h:
    
            Reviewed by Nikolas Zimmermann.
    
            Check if the percentage of effect values takes user space as reference and
            not the FilterRect.
    
            * platform/mac/svg/filters/subRegion-in-userSpace-expected.checksum: Added.
            * platform/mac/svg/filters/subRegion-in-userSpace-expected.png: Added.
            * platform/mac/svg/filters/subRegion-in-userSpace-expected.txt: Added.
            * svg/filters/subRegion-in-userSpace.svg: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49582 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index fa6825d..8a44d50 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2009-10-14  Dirk Schulze  <krit at webkit.org>
+
+        Reviewed by Nikolas Zimmermann.
+
+        Check if the percentage of effect values takes user space as reference and
+        not the FilterRect.
+
+        * platform/mac/svg/filters/subRegion-in-userSpace-expected.checksum: Added.
+        * platform/mac/svg/filters/subRegion-in-userSpace-expected.png: Added.
+        * platform/mac/svg/filters/subRegion-in-userSpace-expected.txt: Added.
+        * svg/filters/subRegion-in-userSpace.svg: Added.
+
 2009-10-14  Brady Eidson  <beidson at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/LayoutTests/platform/mac-tiger/svg/custom/mask-excessive-malloc-expected.checksum b/LayoutTests/platform/mac/svg/filters/subRegion-in-userSpace-expected.checksum
similarity index 100%
copy from LayoutTests/platform/mac-tiger/svg/custom/mask-excessive-malloc-expected.checksum
copy to LayoutTests/platform/mac/svg/filters/subRegion-in-userSpace-expected.checksum
diff --git a/LayoutTests/platform/mac/dom/xhtml/level3/core/canonicalform08-expected.png b/LayoutTests/platform/mac/svg/filters/subRegion-in-userSpace-expected.png
similarity index 100%
copy from LayoutTests/platform/mac/dom/xhtml/level3/core/canonicalform08-expected.png
copy to LayoutTests/platform/mac/svg/filters/subRegion-in-userSpace-expected.png
diff --git a/LayoutTests/platform/mac/svg/filters/subRegion-in-userSpace-expected.txt b/LayoutTests/platform/mac/svg/filters/subRegion-in-userSpace-expected.txt
new file mode 100644
index 0000000..ee5bf6d
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/filters/subRegion-in-userSpace-expected.txt
@@ -0,0 +1,5 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 400x400
+  RenderSVGRoot {svg} at (0,0) size 0x0
+    RenderSVGContainer {g} at (0,0) size 0x0 [filter=filter1]
diff --git a/LayoutTests/svg/filters/subRegion-in-userSpace.svg b/LayoutTests/svg/filters/subRegion-in-userSpace.svg
new file mode 100644
index 0000000..74b3735
--- /dev/null
+++ b/LayoutTests/svg/filters/subRegion-in-userSpace.svg
@@ -0,0 +1,11 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="400" height="400">
+
+<filter id="filter1" filterUnits="userSpaceOnUse" primitiveUnits="userSpaceOnUse">
+  <feFlood flood-color="#ff0000" x="0%" y="0%" width="20%" height="20%" result="flood1"/>
+  <feFlood flood-color="#0000ff" x="20%" y="20%" width="20%" height="20%" result="flood2"/>
+  <feComposite in="flood1" in2="flood2" x="0%" y="0%" width="40%" height="40%" result="pair"/>
+  <feTile in="pair"/>
+</filter>
+<g filter="url(#filter1)"></g>
+</svg>
+
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index f06e47b..be45e7d 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,39 @@
+2009-10-14  Dirk Schulze  <krit at webkit.org>
+
+        Reviewed by Nikolas Zimmermann.
+
+        SVG wrong filterRegions for userSpaceOnUse and percentage values
+        [https://bugs.webkit.org/show_bug.cgi?id=30330]
+
+        Some clean-up of the SVG filter calculation code. This clean-up
+        also fixes the problem with percentage and userSpaceInUse mode.
+
+        Test: svg/filters/subRegion-in-userSpace.svg
+
+        * platform/graphics/filters/FilterEffect.cpp:
+        (WebCore::FilterEffect::FilterEffect):
+        * platform/graphics/filters/FilterEffect.h:
+        * rendering/SVGRenderSupport.cpp:
+        (WebCore::SVGRenderBase::filterBoundingBoxForRenderer):
+        * svg/SVGFilterElement.cpp:
+        (WebCore::SVGFilterElement::buildFilter):
+        (WebCore::SVGFilterElement::canvasResource):
+        * svg/SVGFilterElement.h:
+        * svg/SVGFilterPrimitiveStandardAttributes.cpp:
+        (WebCore::SVGFilterPrimitiveStandardAttributes::setStandardAttributes):
+        * svg/graphics/SVGResourceFilter.cpp:
+        (WebCore::SVGResourceFilter::SVGResourceFilter):
+        (WebCore::SVGResourceFilter::~SVGResourceFilter):
+        (WebCore::SVGResourceFilter::addFilterEffect):
+        (WebCore::SVGResourceFilter::prepareFilter):
+        * svg/graphics/SVGResourceFilter.h:
+        (WebCore::SVGResourceFilter::create):
+        * svg/graphics/filters/SVGFilter.cpp:
+        (WebCore::SVGFilter::SVGFilter):
+        (WebCore::SVGFilter::calculateEffectSubRegion):
+        (WebCore::SVGFilter::create):
+        * svg/graphics/filters/SVGFilter.h:
+
 2009-10-14  Chris Marrin  <cmarrin at apple.com>
 
         The last change fixed the problem, removing diagnostic printfs.
diff --git a/WebCore/platform/graphics/filters/FilterEffect.cpp b/WebCore/platform/graphics/filters/FilterEffect.cpp
index 06ad89d..68900b5 100644
--- a/WebCore/platform/graphics/filters/FilterEffect.cpp
+++ b/WebCore/platform/graphics/filters/FilterEffect.cpp
@@ -25,11 +25,7 @@
 namespace WebCore {
 
 FilterEffect::FilterEffect()
-    : m_xBBoxMode(false)
-    , m_yBBoxMode(false)
-    , m_widthBBoxMode(false)
-    , m_heightBBoxMode(false)
-    , m_hasX(false)
+    : m_hasX(false)
     , m_hasY(false)
     , m_hasWidth(false)
     , m_hasHeight(false)
diff --git a/WebCore/platform/graphics/filters/FilterEffect.h b/WebCore/platform/graphics/filters/FilterEffect.h
index 6eba188..b30e513 100644
--- a/WebCore/platform/graphics/filters/FilterEffect.h
+++ b/WebCore/platform/graphics/filters/FilterEffect.h
@@ -38,18 +38,6 @@ namespace WebCore {
     public:
         virtual ~FilterEffect();
 
-        bool xBoundingBoxMode() const { return m_xBBoxMode; }
-        void setXBoundingBoxMode(bool bboxMode) { m_xBBoxMode = bboxMode; }
-
-        bool yBoundingBoxMode() const { return m_yBBoxMode; }
-        void setYBoundingBoxMode(bool bboxMode) { m_yBBoxMode = bboxMode; }
-
-        bool widthBoundingBoxMode() const { return m_widthBBoxMode; }
-        void setWidthBoundingBoxMode(bool bboxMode) { m_widthBBoxMode = bboxMode; }
-
-        bool heightBoundingBoxMode() const { return m_heightBBoxMode; }
-        void setHeightBoundingBoxMode(bool bboxMode) { m_heightBBoxMode = bboxMode; }
-
         void setUnionOfChildEffectSubregions(const FloatRect& uniteRect) { m_unionOfChildEffectSubregions = uniteRect; }
         FloatRect unionOfChildEffectSubregions() const { return m_unionOfChildEffectSubregions; }
 
diff --git a/WebCore/rendering/SVGRenderSupport.cpp b/WebCore/rendering/SVGRenderSupport.cpp
index fb6866f..0f295e4 100644
--- a/WebCore/rendering/SVGRenderSupport.cpp
+++ b/WebCore/rendering/SVGRenderSupport.cpp
@@ -220,7 +220,7 @@ FloatRect SVGRenderBase::filterBoundingBoxForRenderer(const RenderObject* object
 #if ENABLE(FILTERS)
     SVGResourceFilter* filter = getFilterById(object->document(), object->style()->svgStyle()->filter());
     if (filter)
-        return filter->filterBBoxForItemBBox(object->objectBoundingBox());
+        return filter->filterBoundingBox();
 #else
     UNUSED_PARAM(object);
 #endif
diff --git a/WebCore/svg/SVGFilterElement.cpp b/WebCore/svg/SVGFilterElement.cpp
index 1952bdf..db46179 100644
--- a/WebCore/svg/SVGFilterElement.cpp
+++ b/WebCore/svg/SVGFilterElement.cpp
@@ -2,6 +2,7 @@
     Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann at kde.org>
     Copyright (C) 2004, 2005, 2006 Rob Buis <buis at kde.org>
     Copyright (C) 2006 Samuel Weinig <sam.weinig at gmail.com>
+    Copyright (C) 2009 Dirk Schulze <krit at webkit.org>
 
     This file is part of the KDE project
 
@@ -102,39 +103,36 @@ void SVGFilterElement::parseMappedAttribute(MappedAttribute* attr)
     }
 }
 
-SVGResource* SVGFilterElement::canvasResource()
+void SVGFilterElement::buildFilter(const FloatRect& targetRect) const
 {
-    if (!attached())
-        return 0;
-
-    if (!m_filter)
-        m_filter = new SVGResourceFilter();
-
     bool filterBBoxMode = filterUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX;
-    m_filter->setFilterBoundingBoxMode(filterBBoxMode);
-
-    float _x, _y, _width, _height;
-
-    if (filterBBoxMode) {
-        _x = x().valueAsPercentage();
-        _y = y().valueAsPercentage();
-        _width = width().valueAsPercentage();
-        _height = height().valueAsPercentage();
-    } else {
-        m_filter->setXBoundingBoxMode(x().unitType() == LengthTypePercentage);
-        m_filter->setYBoundingBoxMode(y().unitType() == LengthTypePercentage);
-
-        _x = x().value(this);
-        _y = y().value(this);
-        _width = width().value(this);
-        _height = height().value(this);
-    } 
-
-    m_filter->setFilterRect(FloatRect(_x, _y, _width, _height));
-
     bool primitiveBBoxMode = primitiveUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX;
+
+    FloatRect filterBBox;
+    if (filterBBoxMode)
+        filterBBox = FloatRect(x().valueAsPercentage(),
+                               y().valueAsPercentage(),
+                               width().valueAsPercentage(),
+                               height().valueAsPercentage());
+    else
+        filterBBox = FloatRect(x().value(this),
+                               y().value(this),
+                               width().value(this),
+                               height().value(this));
+
+    FloatRect filterRect = filterBBox;
+    if (filterBBoxMode)
+        filterRect = FloatRect(targetRect.x() + filterRect.x() * targetRect.width(),
+                               targetRect.y() + filterRect.y() * targetRect.height(),
+                               filterRect.width() * targetRect.width(),
+                               filterRect.height() * targetRect.height());
+
+    m_filter->setFilterBoundingBox(filterRect);
+    m_filter->setFilterRect(filterBBox);
     m_filter->setEffectBoundingBoxMode(primitiveBBoxMode);
+    m_filter->setFilterBoundingBoxMode(filterBBoxMode);
 
+    // Add effects to the filter
     m_filter->builder()->clearEffects();
     for (Node* n = firstChild(); n != 0; n = n->nextSibling()) {
         SVGElement* element = 0;
@@ -149,12 +147,18 @@ SVGResource* SVGFilterElement::canvasResource()
             }
         }
     }
+}
 
+SVGResource* SVGFilterElement::canvasResource()
+{
+    if (!attached())
+        return 0;
+
+    if (!m_filter)
+        m_filter = SVGResourceFilter::create(this);
     return m_filter.get();
 }
 
 }
 
-#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
+#endif // ENABLE(SVG) && ENABLE(FILTERS)
diff --git a/WebCore/svg/SVGFilterElement.h b/WebCore/svg/SVGFilterElement.h
index e929b9a..0371811 100644
--- a/WebCore/svg/SVGFilterElement.h
+++ b/WebCore/svg/SVGFilterElement.h
@@ -72,7 +72,11 @@ namespace WebCore {
                                        SVGNames::externalResourcesRequiredAttrString, bool,
                                        ExternalResourcesRequired, externalResourcesRequired)
 
-        RefPtr<SVGResourceFilter> m_filter;
+        mutable RefPtr<SVGResourceFilter> m_filter;
+
+    private:
+        friend class SVGResourceFilter;
+        void buildFilter(const FloatRect& targetRect) const;
     };
 
 } // namespace WebCore
diff --git a/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp b/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp
index 3eeb625..67c8bff 100644
--- a/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp
+++ b/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp
@@ -1,8 +1,7 @@
 /*
     Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann at kde.org>
                   2004, 2005, 2006 Rob Buis <buis at kde.org>
-
-    This file is part of the KDE project
+                  2009 Dirk Schulze <krit at webkit.org>
 
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Library General Public
@@ -77,8 +76,6 @@ void SVGFilterPrimitiveStandardAttributes::setStandardAttributes(SVGResourceFilt
 
     ASSERT(resourceFilter);
 
-    float _x, _y, _width, _height;
-
     if (this->hasAttribute(SVGNames::xAttr))
         filterEffect->setHasX(true);
     if (this->hasAttribute(SVGNames::yAttr))
@@ -88,47 +85,19 @@ void SVGFilterPrimitiveStandardAttributes::setStandardAttributes(SVGResourceFilt
     if (this->hasAttribute(SVGNames::heightAttr))
         filterEffect->setHasHeight(true);
 
-    if (resourceFilter->effectBoundingBoxMode()) {
-        _x = x().valueAsPercentage();
-        _y = y().valueAsPercentage();
-        _width = width().valueAsPercentage();
-        _height = height().valueAsPercentage();
-    } else {
-        // We need to resolve any percentages in filter rect space.
-        if (x().unitType() == LengthTypePercentage) {
-            filterEffect->setXBoundingBoxMode(true);
-            _x = x().valueAsPercentage();
-        } else {
-            filterEffect->setXBoundingBoxMode(false);
-            _x = x().value(this);
-        }
-
-        if (y().unitType() == LengthTypePercentage) {
-            filterEffect->setYBoundingBoxMode(true);
-            _y = y().valueAsPercentage();
-        } else {
-            filterEffect->setYBoundingBoxMode(false);
-            _y = y().value(this);
-        }
-
-        if (width().unitType() == LengthTypePercentage) {
-            filterEffect->setWidthBoundingBoxMode(true);
-            _width = width().valueAsPercentage();
-        } else {
-            filterEffect->setWidthBoundingBoxMode(false);
-            _width = width().value(this);
-        }
-
-        if (height().unitType() == LengthTypePercentage) {
-            filterEffect->setHeightBoundingBoxMode(true);
-            _height = height().valueAsPercentage();
-        } else {
-            filterEffect->setHeightBoundingBoxMode(false);
-            _height = height().value(this);
-        }
-    }
-
-    filterEffect->setSubRegion(FloatRect(_x, _y, _width, _height));
+    FloatRect effectBBox;
+    if (resourceFilter->effectBoundingBoxMode())
+        effectBBox = FloatRect(x().valueAsPercentage(),
+                               y().valueAsPercentage(),
+                               width().valueAsPercentage(),
+                               height().valueAsPercentage());
+    else
+        effectBBox = FloatRect(x().value(this),
+                               y().value(this),
+                               width().value(this),
+                               height().value(this));
+
+    filterEffect->setSubRegion(effectBBox);
 }
 
 }
diff --git a/WebCore/svg/graphics/SVGResourceFilter.cpp b/WebCore/svg/graphics/SVGResourceFilter.cpp
index 4a4bdd5..973743c 100644
--- a/WebCore/svg/graphics/SVGResourceFilter.cpp
+++ b/WebCore/svg/graphics/SVGResourceFilter.cpp
@@ -31,52 +31,44 @@
 #include "PlatformString.h"
 #include "SVGFilter.h"
 #include "SVGFilterBuilder.h"
+#include "SVGFilterElement.h"
 #include "SVGRenderTreeAsText.h"
 #include "SVGFilterPrimitiveStandardAttributes.h"
 
 namespace WebCore {
 
-SVGResourceFilter::SVGResourceFilter()
-    : m_filterBBoxMode(false)
+SVGResourceFilter::SVGResourceFilter(const SVGFilterElement* ownerElement)
+    : SVGResource()
+    , m_ownerElement(ownerElement)
+    , m_filterBBoxMode(false)
     , m_effectBBoxMode(false)
-    , m_xBBoxMode(false)
-    , m_yBBoxMode(false)
     , m_savedContext(0)
     , m_sourceGraphicBuffer(0)
 {
     m_filterBuilder.set(new SVGFilterBuilder());
 }
 
-void SVGResourceFilter::addFilterEffect(SVGFilterPrimitiveStandardAttributes* effectAttributes, PassRefPtr<FilterEffect> effect)
+SVGResourceFilter::~SVGResourceFilter()
 {
-    effectAttributes->setStandardAttributes(this, effect.get());
-    builder()->add(effectAttributes->result(), effect);
 }
 
-FloatRect SVGResourceFilter::filterBBoxForItemBBox(const FloatRect& itemBBox) const
+void SVGResourceFilter::addFilterEffect(SVGFilterPrimitiveStandardAttributes* effectAttributes, PassRefPtr<FilterEffect> effect)
 {
-    FloatRect filterBBox = filterRect();
-
-    if (filterBoundingBoxMode())
-        filterBBox = FloatRect(itemBBox.x() + filterBBox.x() * itemBBox.width(),
-                               itemBBox.y() + filterBBox.y() * itemBBox.height(),
-                               filterBBox.width() * itemBBox.width(),
-                               filterBBox.height() * itemBBox.height());
-
-    return filterBBox;
+    effectAttributes->setStandardAttributes(this, effect.get());
+    builder()->add(effectAttributes->result(), effect);
 }
 
 void SVGResourceFilter::prepareFilter(GraphicsContext*& context, const RenderObject* object)
 {
-    m_itemBBox = object->objectBoundingBox();
-    m_filterBBox = filterBBoxForItemBBox(m_itemBBox);
+    FloatRect targetRect = object->objectBoundingBox();
+    m_ownerElement->buildFilter(targetRect);
 
     // clip sourceImage to filterRegion
-    FloatRect clippedSourceRect = m_itemBBox;
+    FloatRect clippedSourceRect = targetRect;
     clippedSourceRect.intersect(m_filterBBox);
 
     // prepare Filters
-    m_filter = SVGFilter::create(m_itemBBox, m_filterBBox, m_effectBBoxMode, m_filterBBoxMode);
+    m_filter = SVGFilter::create(targetRect, m_filterBBox, m_effectBBoxMode);
 
     FilterEffect* lastEffect = m_filterBuilder->lastEffect();
     if (lastEffect)
@@ -91,8 +83,8 @@ void SVGResourceFilter::prepareFilter(GraphicsContext*& context, const RenderObj
         return;
 
     GraphicsContext* sourceGraphicContext = sourceGraphic->context();
-    sourceGraphicContext->translate(-m_itemBBox.x(), -m_itemBBox.y());
-    sourceGraphicContext->clearRect(FloatRect(FloatPoint(), m_itemBBox.size()));
+    sourceGraphicContext->translate(-targetRect.x(), -targetRect.y());
+    sourceGraphicContext->clearRect(FloatRect(FloatPoint(), targetRect.size()));
     m_sourceGraphicBuffer.set(sourceGraphic.release());
     m_savedContext = context;
 
diff --git a/WebCore/svg/graphics/SVGResourceFilter.h b/WebCore/svg/graphics/SVGResourceFilter.h
index ee1efca..86b11fe 100644
--- a/WebCore/svg/graphics/SVGResourceFilter.h
+++ b/WebCore/svg/graphics/SVGResourceFilter.h
@@ -43,11 +43,13 @@ class Filter;
 class FilterEffect;
 class GraphicsContext;
 class SVGFilterBuilder;
+class SVGFilterElement;
 class SVGFilterPrimitiveStandardAttributes;
 
 class SVGResourceFilter : public SVGResource {
 public:
-    SVGResourceFilter();
+    static PassRefPtr<SVGResourceFilter> create(const SVGFilterElement* ownerElement) { return adoptRef(new SVGResourceFilter(ownerElement)); }
+    virtual ~SVGResourceFilter();
     
     virtual SVGResourceType resourceType() const { return FilterResourceType; }
 
@@ -57,44 +59,31 @@ public:
     bool effectBoundingBoxMode() const { return m_effectBBoxMode; }
     void setEffectBoundingBoxMode(bool bboxMode) { m_effectBBoxMode = bboxMode; }
 
-    bool xBoundingBoxMode() const { return m_xBBoxMode; }
-    void setXBoundingBoxMode(bool bboxMode) { m_xBBoxMode = bboxMode; }
-
-    bool yBoundingBoxMode() const { return m_yBBoxMode; }
-    void setYBoundingBoxMode(bool bboxMode) { m_yBBoxMode = bboxMode; }
-
     FloatRect filterRect() const { return m_filterRect; }
     void setFilterRect(const FloatRect& rect) { m_filterRect = rect; }
 
     FloatRect filterBoundingBox() { return m_filterBBox; }
     void setFilterBoundingBox(const FloatRect& rect) { m_filterBBox = rect; }
 
-    FloatRect itemBoundingBox() { return m_itemBBox; }
-    void setItemBoundingBox(const FloatRect& rect) { m_itemBBox = rect; }
-
-    FloatRect filterBBoxForItemBBox(const FloatRect& itemBBox) const;
-
-    virtual TextStream& externalRepresentation(TextStream&) const;
-
     void prepareFilter(GraphicsContext*&, const RenderObject*);
     void applyFilter(GraphicsContext*&, const RenderObject*);
 
     void addFilterEffect(SVGFilterPrimitiveStandardAttributes*, PassRefPtr<FilterEffect>);
 
     SVGFilterBuilder* builder() { return m_filterBuilder.get(); }
+
+    virtual TextStream& externalRepresentation(TextStream&) const;
     
 private:
+    SVGResourceFilter(const SVGFilterElement*);
+
+    const SVGFilterElement* m_ownerElement;
 
     bool m_filterBBoxMode : 1;
     bool m_effectBBoxMode : 1;
 
-    bool m_xBBoxMode : 1;
-    bool m_yBBoxMode : 1;
-
     FloatRect m_filterRect;
-
     FloatRect m_filterBBox;
-    FloatRect m_itemBBox;
 
     OwnPtr<SVGFilterBuilder> m_filterBuilder;
     GraphicsContext* m_savedContext;
diff --git a/WebCore/svg/graphics/filters/SVGFilter.cpp b/WebCore/svg/graphics/filters/SVGFilter.cpp
index c892ee9..6bfcf39 100644
--- a/WebCore/svg/graphics/filters/SVGFilter.cpp
+++ b/WebCore/svg/graphics/filters/SVGFilter.cpp
@@ -24,12 +24,11 @@
 
 namespace WebCore {
 
-SVGFilter::SVGFilter(const FloatRect& itemBox, const FloatRect& filterRect, bool effectBBoxMode, bool filterBBoxMode)
+SVGFilter::SVGFilter(const FloatRect& itemBox, const FloatRect& filterRect, bool effectBBoxMode)
     : Filter()
     , m_itemBox(itemBox)
     , m_filterRect(filterRect)
     , m_effectBBoxMode(effectBBoxMode)
-    , m_filterBBoxMode(filterBBoxMode)
 {
 }
 
@@ -37,7 +36,6 @@ void SVGFilter::calculateEffectSubRegion(FilterEffect* effect)
 {
     FloatRect subRegionBBox = effect->subRegion();
     FloatRect useBBox = effect->unionOfChildEffectSubregions();
-
     FloatRect newSubRegion = subRegionBBox;
 
     if (m_effectBBoxMode) {
@@ -55,17 +53,17 @@ void SVGFilter::calculateEffectSubRegion(FilterEffect* effect)
         if (effect->hasHeight())
             newSubRegion.setHeight(subRegionBBox.height() * m_itemBox.height());
     } else {
-        if (effect->xBoundingBoxMode())
-            newSubRegion.setX(useBBox.x() + subRegionBBox.x() * useBBox.width());
+        if (!effect->hasX())
+            newSubRegion.setX(useBBox.x());
 
-        if (effect->yBoundingBoxMode())
-            newSubRegion.setY(useBBox.y() + subRegionBBox.y() * useBBox.height());
+        if (!effect->hasY())
+            newSubRegion.setY(useBBox.y());
 
-        if (effect->widthBoundingBoxMode())
-            newSubRegion.setWidth(subRegionBBox.width() * useBBox.width());
+        if (!effect->hasWidth())
+            newSubRegion.setWidth(useBBox.width());
 
-        if (effect->heightBoundingBoxMode())
-            newSubRegion.setHeight(subRegionBBox.height() * useBBox.height());
+        if (!effect->hasHeight())
+            newSubRegion.setHeight(useBBox.height());
     }
 
     // clip every filter effect to the filter region
@@ -74,9 +72,9 @@ void SVGFilter::calculateEffectSubRegion(FilterEffect* effect)
     effect->setSubRegion(newSubRegion);
 }
 
-PassRefPtr<SVGFilter> SVGFilter::create(const FloatRect& itemBox, const FloatRect& filterRect, bool effectBBoxMode, bool filterBBoxMode)
+PassRefPtr<SVGFilter> SVGFilter::create(const FloatRect& itemBox, const FloatRect& filterRect, bool effectBBoxMode)
 {
-    return adoptRef(new SVGFilter(itemBox, filterRect, effectBBoxMode, filterBBoxMode));
+    return adoptRef(new SVGFilter(itemBox, filterRect, effectBBoxMode));
 }
 
 } // namespace WebCore
diff --git a/WebCore/svg/graphics/filters/SVGFilter.h b/WebCore/svg/graphics/filters/SVGFilter.h
index d6e5f77..f23d1ea 100644
--- a/WebCore/svg/graphics/filters/SVGFilter.h
+++ b/WebCore/svg/graphics/filters/SVGFilter.h
@@ -33,7 +33,7 @@ namespace WebCore {
 
     class SVGFilter : public Filter {
     public:
-        static PassRefPtr<SVGFilter> create(const FloatRect&, const FloatRect&, bool, bool);
+        static PassRefPtr<SVGFilter> create(const FloatRect&, const FloatRect&, bool);
 
         bool effectBoundingBoxMode() { return m_effectBBoxMode; }
 
@@ -42,12 +42,11 @@ namespace WebCore {
         void calculateEffectSubRegion(FilterEffect*);
 
     private:
-        SVGFilter(const FloatRect& itemBox, const FloatRect& filterRect, bool itemBBoxMode, bool filterBBoxMode);
+        SVGFilter(const FloatRect& itemBox, const FloatRect& filterRect, bool effectBBoxMode);
 
         FloatRect m_itemBox;
         FloatRect m_filterRect;
         bool m_effectBBoxMode;
-        bool m_filterBBoxMode;
     };
 
 } // namespace WebCore

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list