[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

krit at webkit.org krit at webkit.org
Wed Dec 22 13:33:18 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit df9f37047b8b9897f5cbbeac38297d2f205d95f9
Author: krit at webkit.org <krit at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Sep 20 14:39:54 2010 +0000

    2010-09-20  Dirk Schulze  <krit at webkit.org>
    
            Reviewed by Nikolas Zimmermann.
    
            SVG Filter cleanup
            https://bugs.webkit.org/show_bug.cgi?id=45612
    
            All effect inputs are stored in a Vector in FilterEffect instead of passing them via constructors to every effect type.
            This simplifies the primitive subregion logic and centralizes it in determineFilterPrimitiveSubregion.
            Just SourceGraphic, SourceAlpha and FETile still calculate filter primitive subregions on
            their own. Working on it in a followup patch.
            The subregions code is SVG specific and moving this calculation to FilterEffect is an
            intermediate step before moving it to RenderSVGResourceFilterPrimitive in a following patch.
            The new FilterEffectVector will also make it possible to add code to determine the
            smallest used region of an effect and will help save memory and resources in the future.
            subRegion got renamed to filterPrimitiveSubregion to match the name scheme. scaledSubRegion got
            renamed to repaintRectInLocalCoordinates since this is its proper meaning.
            Removed unnecessary member variables and functions from FilterEffect.
    
            No new tests added since the functionality didn't change.
    
            * platform/graphics/cairo/GraphicsContextCairo.cpp: scaledSubRegion was renamed to repaintRectInLocalCoordinates.
            (WebCore::GraphicsContext::createShadowMask):
            * platform/graphics/filters/FEBlend.cpp: Removed Filter effect inputs from constructor.
            (WebCore::FEBlend::FEBlend):
            (WebCore::FEBlend::create):
            (WebCore::FEBlend::apply): Call inputFilterEffects to get input filter primitives.
            (WebCore::FEBlend::externalRepresentation): Call inputFilterEffects to get input filter primitives.
            * platform/graphics/filters/FEBlend.h:
            * platform/graphics/filters/FEColorMatrix.cpp: Ditto.
            (WebCore::FEColorMatrix::FEColorMatrix):
            (WebCore::FEColorMatrix::create):
            (WebCore::FEColorMatrix::apply):
            (WebCore::FEColorMatrix::externalRepresentation):
            * platform/graphics/filters/FEColorMatrix.h:
            * platform/graphics/filters/FEComponentTransfer.cpp: Ditto.
            (WebCore::FEComponentTransfer::FEComponentTransfer):
            (WebCore::FEComponentTransfer::create):
            (WebCore::FEComponentTransfer::apply):
            (WebCore::FEComponentTransfer::externalRepresentation):
            * platform/graphics/filters/FEComponentTransfer.h:
            * platform/graphics/filters/FEComposite.cpp: Ditto.
            (WebCore::FEComposite::FEComposite):
            (WebCore::FEComposite::create):
            (WebCore::FEComposite::apply):
            (WebCore::FEComposite::externalRepresentation):
            * platform/graphics/filters/FEComposite.h:
            * platform/graphics/filters/FEGaussianBlur.cpp: Ditto.
            (WebCore::FEGaussianBlur::FEGaussianBlur):
            (WebCore::FEGaussianBlur::create):
            (WebCore::FEGaussianBlur::apply):
            (WebCore::FEGaussianBlur::externalRepresentation):
            * platform/graphics/filters/FEGaussianBlur.h:
            * platform/graphics/filters/Filter.h:
            (WebCore::Filter::determineFilterPrimitiveSubregion): Renamed from calculateEffectSubRegion to match name scheme.
            * platform/graphics/filters/FilterEffect.cpp:
            (WebCore::FilterEffect::FilterEffect):
            (WebCore::FilterEffect::determineFilterPrimitiveSubregion): The main place for subregion calculation.
            (WebCore::FilterEffect::calculateDrawingIntRect): Takes repaintRectInLocalCoordinates now.
            (WebCore::FilterEffect::calculateDrawingRect): ditto.
            (WebCore::FilterEffect::getEffectContext): Check if ImageBuffer was created.
            * platform/graphics/filters/FilterEffect.h: Changed names to match name scheme. Removed unnecessary member variables and functions.
                Seperate SVG specific member variables and functions. Will get removed in followup patches.
            (WebCore::FilterEffect::resultImage):
            (WebCore::FilterEffect::setEffectBuffer):
            (WebCore::FilterEffect::inputEffect):
            (WebCore::FilterEffect::inputEffects):
            (WebCore::FilterEffect::numberOfinputEffects):
            (WebCore::FilterEffect::isAlphaImage):
            (WebCore::FilterEffect::setIsAlphaImage):
            (WebCore::FilterEffect::repaintRectInLocalCoordinates):
            (WebCore::FilterEffect::setRepaintRectInLocalCoordinates):
            (WebCore::FilterEffect::isSourceInput):
            (WebCore::FilterEffect::hasX):
            (WebCore::FilterEffect::setHasX):
            (WebCore::FilterEffect::hasY):
            (WebCore::FilterEffect::setHasY):
            (WebCore::FilterEffect::hasWidth):
            (WebCore::FilterEffect::setHasWidth):
            (WebCore::FilterEffect::hasHeight):
            (WebCore::FilterEffect::setHasHeight):
            (WebCore::FilterEffect::filterPrimitiveSubregion):
            (WebCore::FilterEffect::setFilterPrimitiveSubregion):
            (WebCore::FilterEffect::effectBoundaries):
            (WebCore::FilterEffect::setEffectBoundaries):
            * platform/graphics/filters/SourceAlpha.cpp:
            (WebCore::SourceAlpha::determineFilterPrimitiveSubregion): Renamed to match name scheme.
            * platform/graphics/filters/SourceAlpha.h:
            (WebCore::SourceAlpha::isSourceInput):
            * platform/graphics/filters/SourceGraphic.cpp:
            (WebCore::SourceGraphic::determineFilterPrimitiveSubregion): Ditto.
            * platform/graphics/filters/SourceGraphic.h:
            (WebCore::SourceGraphic::isSourceInput):
            * rendering/RenderSVGResourceFilter.cpp: Adapt to renames in FilterEffect.
            (WebCore::RenderSVGResourceFilter::applyResource):
            (WebCore::RenderSVGResourceFilter::postApplyResource):
            * svg/SVGFEBlendElement.cpp: Constructor of FEBlend doesn't take input effects. Adding them afterwards.
            (WebCore::SVGFEBlendElement::build):
            * svg/SVGFEColorMatrixElement.cpp: Ditto.
            (WebCore::SVGFEColorMatrixElement::build):
            * svg/SVGFEComponentTransferElement.cpp: Ditto.
            (WebCore::SVGFEComponentTransferElement::build):
            * svg/SVGFECompositeElement.cpp: Ditto.
            (WebCore::SVGFECompositeElement::build):
            * svg/SVGFEConvolveMatrixElement.cpp: Ditto.
            (WebCore::SVGFEConvolveMatrixElement::build):
            * svg/SVGFEDiffuseLightingElement.cpp: Ditto.
            (WebCore::SVGFEDiffuseLightingElement::build):
            * svg/SVGFEDisplacementMapElement.cpp: Ditto.
            (WebCore::SVGFEDisplacementMapElement::build):
            * svg/SVGFEGaussianBlurElement.cpp: Ditto.
            (WebCore::SVGFEGaussianBlurElement::build):
            * svg/SVGFEMergeElement.cpp: Ditto.
            (WebCore::SVGFEMergeElement::build):
            * svg/SVGFEMorphologyElement.cpp: Ditto.
            (WebCore::SVGFEMorphologyElement::build):
            * svg/SVGFEOffsetElement.cpp: Ditto.
            (WebCore::SVGFEOffsetElement::build):
            * svg/SVGFESpecularLightingElement.cpp: Ditto.
            (WebCore::SVGFESpecularLightingElement::build):
            * svg/SVGFETileElement.cpp: Ditto.
            (WebCore::SVGFETileElement::build):
            * svg/graphics/filters/SVGFEConvolveMatrix.cpp: Ditto.
            (WebCore::FEConvolveMatrix::FEConvolveMatrix):
            (WebCore::FEConvolveMatrix::create):
            (WebCore::FEConvolveMatrix::apply):
            (WebCore::FEConvolveMatrix::externalRepresentation):
            * svg/graphics/filters/SVGFEConvolveMatrix.h:
            * svg/graphics/filters/SVGFEDiffuseLighting.cpp: Ditto.
            (WebCore::FEDiffuseLighting::FEDiffuseLighting):
            (WebCore::FEDiffuseLighting::create):
            (WebCore::FEDiffuseLighting::externalRepresentation):
            * svg/graphics/filters/SVGFEDiffuseLighting.h:
            * svg/graphics/filters/SVGFEDisplacementMap.cpp: Ditto.
            (WebCore::FEDisplacementMap::FEDisplacementMap):
            (WebCore::FEDisplacementMap::create):
            (WebCore::FEDisplacementMap::apply):
            (WebCore::FEDisplacementMap::externalRepresentation):
            * svg/graphics/filters/SVGFEDisplacementMap.h:
            * svg/graphics/filters/SVGFEFlood.cpp: Ditto.
            (WebCore::FEFlood::apply):
            * svg/graphics/filters/SVGFEImage.cpp: Ditto.
            (WebCore::FEImage::apply):
            * svg/graphics/filters/SVGFELighting.cpp: Ditto.
            (WebCore::FELighting::FELighting):
            (WebCore::FELighting::apply):
            * svg/graphics/filters/SVGFELighting.h:
            * svg/graphics/filters/SVGFEMerge.cpp: Ditto.
            (WebCore::FEMerge::FEMerge):
            (WebCore::FEMerge::create):
            (WebCore::FEMerge::apply):
            (WebCore::FEMerge::externalRepresentation):
            * svg/graphics/filters/SVGFEMerge.h:
            * svg/graphics/filters/SVGFEMorphology.cpp: Ditto.
            (WebCore::FEMorphology::FEMorphology):
            (WebCore::FEMorphology::create):
            (WebCore::FEMorphology::apply):
            (WebCore::FEMorphology::externalRepresentation):
            * svg/graphics/filters/SVGFEMorphology.h:
            * svg/graphics/filters/SVGFEOffset.cpp: Ditto.
            (WebCore::FEOffset::FEOffset):
            (WebCore::FEOffset::create):
            (WebCore::FEOffset::apply):
            (WebCore::FEOffset::externalRepresentation):
            * svg/graphics/filters/SVGFEOffset.h:
            * svg/graphics/filters/SVGFESpecularLighting.cpp: Ditto.
            (WebCore::FESpecularLighting::FESpecularLighting):
            (WebCore::FESpecularLighting::create):
            (WebCore::FESpecularLighting::externalRepresentation):
            * svg/graphics/filters/SVGFESpecularLighting.h:
            * svg/graphics/filters/SVGFETile.cpp: Ditto.
            (WebCore::FETile::FETile):
            (WebCore::FETile::create):
            (WebCore::FETile::determineFilterPrimitiveSubregion): Renamed to match name scheme.
            (WebCore::FETile::apply):
            (WebCore::FETile::externalRepresentation):
            * svg/graphics/filters/SVGFETile.h:
            * svg/graphics/filters/SVGFilter.cpp: Renamed itemBox to targetBoundingBox to match name scheme.
            (WebCore::SVGFilter::SVGFilter):
            (WebCore::SVGFilter::determineFilterPrimitiveSubregion): Renamed to match name scheme.
            (WebCore::SVGFilter::create):
            * svg/graphics/filters/SVGFilter.h:
            (WebCore::SVGFilter::sourceImageRect):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67847 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 895afb3..9383e27 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,187 @@
+2010-09-20  Dirk Schulze  <krit at webkit.org>
+
+        Reviewed by Nikolas Zimmermann.
+
+        SVG Filter cleanup
+        https://bugs.webkit.org/show_bug.cgi?id=45612
+        
+        All effect inputs are stored in a Vector in FilterEffect instead of passing them via constructors to every effect type.
+        This simplifies the primitive subregion logic and centralizes it in determineFilterPrimitiveSubregion.
+        Just SourceGraphic, SourceAlpha and FETile still calculate filter primitive subregions on
+        their own. Working on it in a followup patch.
+        The subregions code is SVG specific and moving this calculation to FilterEffect is an
+        intermediate step before moving it to RenderSVGResourceFilterPrimitive in a following patch.
+        The new FilterEffectVector will also make it possible to add code to determine the
+        smallest used region of an effect and will help save memory and resources in the future.
+        subRegion got renamed to filterPrimitiveSubregion to match the name scheme. scaledSubRegion got
+        renamed to repaintRectInLocalCoordinates since this is its proper meaning.
+        Removed unnecessary member variables and functions from FilterEffect.
+
+        No new tests added since the functionality didn't change.
+
+        * platform/graphics/cairo/GraphicsContextCairo.cpp: scaledSubRegion was renamed to repaintRectInLocalCoordinates.
+        (WebCore::GraphicsContext::createShadowMask):
+        * platform/graphics/filters/FEBlend.cpp: Removed Filter effect inputs from constructor.
+        (WebCore::FEBlend::FEBlend):
+        (WebCore::FEBlend::create):
+        (WebCore::FEBlend::apply): Call inputFilterEffects to get input filter primitives.
+        (WebCore::FEBlend::externalRepresentation): Call inputFilterEffects to get input filter primitives.
+        * platform/graphics/filters/FEBlend.h:
+        * platform/graphics/filters/FEColorMatrix.cpp: Ditto.
+        (WebCore::FEColorMatrix::FEColorMatrix):
+        (WebCore::FEColorMatrix::create):
+        (WebCore::FEColorMatrix::apply):
+        (WebCore::FEColorMatrix::externalRepresentation):
+        * platform/graphics/filters/FEColorMatrix.h:
+        * platform/graphics/filters/FEComponentTransfer.cpp: Ditto.
+        (WebCore::FEComponentTransfer::FEComponentTransfer):
+        (WebCore::FEComponentTransfer::create):
+        (WebCore::FEComponentTransfer::apply):
+        (WebCore::FEComponentTransfer::externalRepresentation):
+        * platform/graphics/filters/FEComponentTransfer.h:
+        * platform/graphics/filters/FEComposite.cpp: Ditto.
+        (WebCore::FEComposite::FEComposite):
+        (WebCore::FEComposite::create):
+        (WebCore::FEComposite::apply):
+        (WebCore::FEComposite::externalRepresentation):
+        * platform/graphics/filters/FEComposite.h:
+        * platform/graphics/filters/FEGaussianBlur.cpp: Ditto.
+        (WebCore::FEGaussianBlur::FEGaussianBlur):
+        (WebCore::FEGaussianBlur::create):
+        (WebCore::FEGaussianBlur::apply):
+        (WebCore::FEGaussianBlur::externalRepresentation):
+        * platform/graphics/filters/FEGaussianBlur.h:
+        * platform/graphics/filters/Filter.h:
+        (WebCore::Filter::determineFilterPrimitiveSubregion): Renamed from calculateEffectSubRegion to match name scheme.
+        * platform/graphics/filters/FilterEffect.cpp:
+        (WebCore::FilterEffect::FilterEffect):
+        (WebCore::FilterEffect::determineFilterPrimitiveSubregion): The main place for subregion calculation.
+        (WebCore::FilterEffect::calculateDrawingIntRect): Takes repaintRectInLocalCoordinates now.
+        (WebCore::FilterEffect::calculateDrawingRect): ditto.
+        (WebCore::FilterEffect::getEffectContext): Check if ImageBuffer was created.
+        * platform/graphics/filters/FilterEffect.h: Changed names to match name scheme. Removed unnecessary member variables and functions.
+            Seperate SVG specific member variables and functions. Will get removed in followup patches.
+        (WebCore::FilterEffect::resultImage):
+        (WebCore::FilterEffect::setEffectBuffer):
+        (WebCore::FilterEffect::inputEffect):
+        (WebCore::FilterEffect::inputEffects):
+        (WebCore::FilterEffect::numberOfinputEffects):
+        (WebCore::FilterEffect::isAlphaImage):
+        (WebCore::FilterEffect::setIsAlphaImage):
+        (WebCore::FilterEffect::repaintRectInLocalCoordinates):
+        (WebCore::FilterEffect::setRepaintRectInLocalCoordinates):
+        (WebCore::FilterEffect::isSourceInput):
+        (WebCore::FilterEffect::hasX):
+        (WebCore::FilterEffect::setHasX):
+        (WebCore::FilterEffect::hasY):
+        (WebCore::FilterEffect::setHasY):
+        (WebCore::FilterEffect::hasWidth):
+        (WebCore::FilterEffect::setHasWidth):
+        (WebCore::FilterEffect::hasHeight):
+        (WebCore::FilterEffect::setHasHeight):
+        (WebCore::FilterEffect::filterPrimitiveSubregion):
+        (WebCore::FilterEffect::setFilterPrimitiveSubregion):
+        (WebCore::FilterEffect::effectBoundaries):
+        (WebCore::FilterEffect::setEffectBoundaries):
+        * platform/graphics/filters/SourceAlpha.cpp:
+        (WebCore::SourceAlpha::determineFilterPrimitiveSubregion): Renamed to match name scheme.
+        * platform/graphics/filters/SourceAlpha.h:
+        (WebCore::SourceAlpha::isSourceInput):
+        * platform/graphics/filters/SourceGraphic.cpp:
+        (WebCore::SourceGraphic::determineFilterPrimitiveSubregion): Ditto.
+        * platform/graphics/filters/SourceGraphic.h:
+        (WebCore::SourceGraphic::isSourceInput):
+        * rendering/RenderSVGResourceFilter.cpp: Adapt to renames in FilterEffect.
+        (WebCore::RenderSVGResourceFilter::applyResource):
+        (WebCore::RenderSVGResourceFilter::postApplyResource):
+        * svg/SVGFEBlendElement.cpp: Constructor of FEBlend doesn't take input effects. Adding them afterwards.
+        (WebCore::SVGFEBlendElement::build):
+        * svg/SVGFEColorMatrixElement.cpp: Ditto.
+        (WebCore::SVGFEColorMatrixElement::build):
+        * svg/SVGFEComponentTransferElement.cpp: Ditto.
+        (WebCore::SVGFEComponentTransferElement::build):
+        * svg/SVGFECompositeElement.cpp: Ditto.
+        (WebCore::SVGFECompositeElement::build):
+        * svg/SVGFEConvolveMatrixElement.cpp: Ditto.
+        (WebCore::SVGFEConvolveMatrixElement::build):
+        * svg/SVGFEDiffuseLightingElement.cpp: Ditto.
+        (WebCore::SVGFEDiffuseLightingElement::build):
+        * svg/SVGFEDisplacementMapElement.cpp: Ditto.
+        (WebCore::SVGFEDisplacementMapElement::build):
+        * svg/SVGFEGaussianBlurElement.cpp: Ditto.
+        (WebCore::SVGFEGaussianBlurElement::build):
+        * svg/SVGFEMergeElement.cpp: Ditto.
+        (WebCore::SVGFEMergeElement::build):
+        * svg/SVGFEMorphologyElement.cpp: Ditto.
+        (WebCore::SVGFEMorphologyElement::build):
+        * svg/SVGFEOffsetElement.cpp: Ditto.
+        (WebCore::SVGFEOffsetElement::build):
+        * svg/SVGFESpecularLightingElement.cpp: Ditto.
+        (WebCore::SVGFESpecularLightingElement::build):
+        * svg/SVGFETileElement.cpp: Ditto.
+        (WebCore::SVGFETileElement::build):
+        * svg/graphics/filters/SVGFEConvolveMatrix.cpp: Ditto.
+        (WebCore::FEConvolveMatrix::FEConvolveMatrix):
+        (WebCore::FEConvolveMatrix::create):
+        (WebCore::FEConvolveMatrix::apply):
+        (WebCore::FEConvolveMatrix::externalRepresentation):
+        * svg/graphics/filters/SVGFEConvolveMatrix.h:
+        * svg/graphics/filters/SVGFEDiffuseLighting.cpp: Ditto.
+        (WebCore::FEDiffuseLighting::FEDiffuseLighting):
+        (WebCore::FEDiffuseLighting::create):
+        (WebCore::FEDiffuseLighting::externalRepresentation):
+        * svg/graphics/filters/SVGFEDiffuseLighting.h:
+        * svg/graphics/filters/SVGFEDisplacementMap.cpp: Ditto.
+        (WebCore::FEDisplacementMap::FEDisplacementMap):
+        (WebCore::FEDisplacementMap::create):
+        (WebCore::FEDisplacementMap::apply):
+        (WebCore::FEDisplacementMap::externalRepresentation):
+        * svg/graphics/filters/SVGFEDisplacementMap.h:
+        * svg/graphics/filters/SVGFEFlood.cpp: Ditto.
+        (WebCore::FEFlood::apply):
+        * svg/graphics/filters/SVGFEImage.cpp: Ditto.
+        (WebCore::FEImage::apply):
+        * svg/graphics/filters/SVGFELighting.cpp: Ditto.
+        (WebCore::FELighting::FELighting):
+        (WebCore::FELighting::apply):
+        * svg/graphics/filters/SVGFELighting.h:
+        * svg/graphics/filters/SVGFEMerge.cpp: Ditto.
+        (WebCore::FEMerge::FEMerge):
+        (WebCore::FEMerge::create):
+        (WebCore::FEMerge::apply):
+        (WebCore::FEMerge::externalRepresentation):
+        * svg/graphics/filters/SVGFEMerge.h:
+        * svg/graphics/filters/SVGFEMorphology.cpp: Ditto.
+        (WebCore::FEMorphology::FEMorphology):
+        (WebCore::FEMorphology::create):
+        (WebCore::FEMorphology::apply):
+        (WebCore::FEMorphology::externalRepresentation):
+        * svg/graphics/filters/SVGFEMorphology.h:
+        * svg/graphics/filters/SVGFEOffset.cpp: Ditto.
+        (WebCore::FEOffset::FEOffset):
+        (WebCore::FEOffset::create):
+        (WebCore::FEOffset::apply):
+        (WebCore::FEOffset::externalRepresentation):
+        * svg/graphics/filters/SVGFEOffset.h:
+        * svg/graphics/filters/SVGFESpecularLighting.cpp: Ditto.
+        (WebCore::FESpecularLighting::FESpecularLighting):
+        (WebCore::FESpecularLighting::create):
+        (WebCore::FESpecularLighting::externalRepresentation):
+        * svg/graphics/filters/SVGFESpecularLighting.h:
+        * svg/graphics/filters/SVGFETile.cpp: Ditto.
+        (WebCore::FETile::FETile):
+        (WebCore::FETile::create):
+        (WebCore::FETile::determineFilterPrimitiveSubregion): Renamed to match name scheme.
+        (WebCore::FETile::apply):
+        (WebCore::FETile::externalRepresentation):
+        * svg/graphics/filters/SVGFETile.h:
+        * svg/graphics/filters/SVGFilter.cpp: Renamed itemBox to targetBoundingBox to match name scheme.
+        (WebCore::SVGFilter::SVGFilter):
+        (WebCore::SVGFilter::determineFilterPrimitiveSubregion): Renamed to match name scheme.
+        (WebCore::SVGFilter::create):
+        * svg/graphics/filters/SVGFilter.h:
+        (WebCore::SVGFilter::sourceImageRect):
+
 2010-09-20  Pavel Podivilov  <podivilov at chromium.org>
 
         Reviewed by Pavel Feldman.
diff --git a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
index 4e58b99..5de7e1f 100644
--- a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
+++ b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
@@ -973,18 +973,20 @@ PlatformRefPtr<cairo_surface_t> GraphicsContext::createShadowMask(PassOwnPtr<Ima
         return buffer->m_data.m_surface;
 
     FloatPoint blurRadius = FloatPoint(radius, radius);
-    float sd = FEGaussianBlur::calculateStdDeviation(radius);
-    if (!sd)
+    float stdDeviation = FEGaussianBlur::calculateStdDeviation(radius);
+    if (!stdDeviation)
         return buffer->m_data.m_surface;
 
     // create filter
     RefPtr<Filter> filter = ImageBufferFilter::create();
     filter->setSourceImage(buffer);
     RefPtr<FilterEffect> source = SourceGraphic::create();
-    source->setScaledSubRegion(FloatRect(FloatPoint(), shadowRect.size()));
+    source->setRepaintRectInLocalCoordinates(FloatRect(FloatPoint(), shadowRect.size()));
     source->setIsAlphaImage(true);
-    RefPtr<FilterEffect> blur = FEGaussianBlur::create(source.get(), sd, sd);
-    blur->setScaledSubRegion(FloatRect(FloatPoint(), shadowRect.size()));
+    RefPtr<FilterEffect> blur = FEGaussianBlur::create(stdDeviation, stdDeviation);
+    FilterEffectVector& inputEffects = blur->inputEffects();
+    inputEffects.append(source.get());
+    blur->setRepaintRectInLocalCoordinates(FloatRect(FloatPoint(), shadowRect.size()));
     blur->apply(filter.get());
     return blur->resultImage()->m_data.m_surface;
 #endif
diff --git a/WebCore/platform/graphics/filters/FEBlend.cpp b/WebCore/platform/graphics/filters/FEBlend.cpp
index 99c0ae7..acd6545 100644
--- a/WebCore/platform/graphics/filters/FEBlend.cpp
+++ b/WebCore/platform/graphics/filters/FEBlend.cpp
@@ -35,27 +35,15 @@ typedef unsigned char (*BlendType)(unsigned char colorA, unsigned char colorB, u
 
 namespace WebCore {
 
-FEBlend::FEBlend(FilterEffect* in, FilterEffect* in2, BlendModeType mode)
+FEBlend::FEBlend(BlendModeType mode)
     : FilterEffect()
-    , m_in(in)
-    , m_in2(in2)
     , m_mode(mode)
 {
 }
 
-PassRefPtr<FEBlend> FEBlend::create(FilterEffect* in, FilterEffect* in2, BlendModeType mode)
+PassRefPtr<FEBlend> FEBlend::create(BlendModeType mode)
 {
-    return adoptRef(new FEBlend(in, in2, mode));
-}
-
-FilterEffect* FEBlend::in2() const
-{
-    return m_in2.get();
-}
-
-void FEBlend::setIn2(FilterEffect* in2)
-{
-    m_in2 = in2;
+    return adoptRef(new FEBlend(mode));
 }
 
 BlendModeType FEBlend::blendMode() const
@@ -100,9 +88,11 @@ static unsigned char lighten(unsigned char colorA, unsigned char colorB, unsigne
 
 void FEBlend::apply(Filter* filter)
 {
-    m_in->apply(filter);
-    m_in2->apply(filter);
-    if (!m_in->resultImage() || !m_in2->resultImage())
+    FilterEffect* in = inputEffect(0);
+    FilterEffect* in2 = inputEffect(1);
+    in->apply(filter);
+    in2->apply(filter);
+    if (!in->resultImage() || !in2->resultImage())
         return;
 
     if (m_mode == FEBLEND_MODE_UNKNOWN)
@@ -111,11 +101,11 @@ void FEBlend::apply(Filter* filter)
     if (!getEffectContext())
         return;
 
-    IntRect effectADrawingRect = calculateDrawingIntRect(m_in->scaledSubRegion());
-    RefPtr<CanvasPixelArray> srcPixelArrayA(m_in->resultImage()->getPremultipliedImageData(effectADrawingRect)->data());
+    IntRect effectADrawingRect = calculateDrawingIntRect(in->repaintRectInLocalCoordinates());
+    RefPtr<CanvasPixelArray> srcPixelArrayA(in->resultImage()->getPremultipliedImageData(effectADrawingRect)->data());
 
-    IntRect effectBDrawingRect = calculateDrawingIntRect(m_in2->scaledSubRegion());
-    RefPtr<CanvasPixelArray> srcPixelArrayB(m_in2->resultImage()->getPremultipliedImageData(effectBDrawingRect)->data());
+    IntRect effectBDrawingRect = calculateDrawingIntRect(in2->repaintRectInLocalCoordinates());
+    RefPtr<CanvasPixelArray> srcPixelArrayB(in2->resultImage()->getPremultipliedImageData(effectBDrawingRect)->data());
 
     IntRect imageRect(IntPoint(), resultImage()->size());
     RefPtr<ImageData> imageData = ImageData::create(imageRect.width(), imageRect.height());
@@ -176,8 +166,8 @@ TextStream& FEBlend::externalRepresentation(TextStream& ts, int indent) const
     ts << "[feBlend";
     FilterEffect::externalRepresentation(ts);
     ts << " mode=\"" << m_mode << "\"]\n";
-    m_in->externalRepresentation(ts, indent + 1);
-    m_in2->externalRepresentation(ts, indent + 1);
+    inputEffect(0)->externalRepresentation(ts, indent + 1);
+    inputEffect(1)->externalRepresentation(ts, indent + 1);
     return ts;
 }
 
diff --git a/WebCore/platform/graphics/filters/FEBlend.h b/WebCore/platform/graphics/filters/FEBlend.h
index 52de647..2e67588 100644
--- a/WebCore/platform/graphics/filters/FEBlend.h
+++ b/WebCore/platform/graphics/filters/FEBlend.h
@@ -40,24 +40,18 @@ namespace WebCore {
 
     class FEBlend : public FilterEffect {
     public:
-        static PassRefPtr<FEBlend> create(FilterEffect*, FilterEffect*, BlendModeType);
-
-        FilterEffect* in2() const;
-        void setIn2(FilterEffect*);
+        static PassRefPtr<FEBlend> create(BlendModeType);
 
         BlendModeType blendMode() const;
         void setBlendMode(BlendModeType);
 
-        virtual FloatRect uniteChildEffectSubregions(Filter* filter) { return calculateUnionOfChildEffectSubregions(filter, m_in.get(), m_in2.get()); }
         void apply(Filter*);
         void dump();
         TextStream& externalRepresentation(TextStream&, int indent) const;
 
     private:
-        FEBlend(FilterEffect*, FilterEffect*, BlendModeType);
+        FEBlend(BlendModeType);
 
-        RefPtr<FilterEffect> m_in;
-        RefPtr<FilterEffect> m_in2;
         BlendModeType m_mode;
     };
 
diff --git a/WebCore/platform/graphics/filters/FEColorMatrix.cpp b/WebCore/platform/graphics/filters/FEColorMatrix.cpp
index 7718066..1d9c66b 100644
--- a/WebCore/platform/graphics/filters/FEColorMatrix.cpp
+++ b/WebCore/platform/graphics/filters/FEColorMatrix.cpp
@@ -34,17 +34,16 @@
 
 namespace WebCore {
 
-FEColorMatrix::FEColorMatrix(FilterEffect* in, ColorMatrixType type, const Vector<float>& values)
+FEColorMatrix::FEColorMatrix(ColorMatrixType type, const Vector<float>& values)
     : FilterEffect()
-    , m_in(in)
     , m_type(type)
     , m_values(values)
 {
 }
 
-PassRefPtr<FEColorMatrix> FEColorMatrix::create(FilterEffect* in, ColorMatrixType type, const Vector<float>& values)
+PassRefPtr<FEColorMatrix> FEColorMatrix::create(ColorMatrixType type, const Vector<float>& values)
 {
-    return adoptRef(new FEColorMatrix(in, type, values));
+    return adoptRef(new FEColorMatrix(type, values));
 }
 
 ColorMatrixType FEColorMatrix::type() const
@@ -156,15 +155,16 @@ void effectType(const PassRefPtr<CanvasPixelArray>& srcPixelArray, PassRefPtr<Im
 
 void FEColorMatrix::apply(Filter* filter)
 {
-    m_in->apply(filter);
-    if (!m_in->resultImage())
+    FilterEffect* in = inputEffect(0);
+    in->apply(filter);
+    if (!in->resultImage())
         return;
 
     GraphicsContext* filterContext = getEffectContext();
     if (!filterContext)
         return;
 
-    filterContext->drawImageBuffer(m_in->resultImage(), DeviceColorSpace, calculateDrawingRect(m_in->scaledSubRegion()));
+    filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, calculateDrawingRect(in->repaintRectInLocalCoordinates()));
 
     IntRect imageRect(IntPoint(), resultImage()->size());
     PassRefPtr<ImageData> imageData(resultImage()->getUnmultipliedImageData(imageRect));
@@ -236,7 +236,7 @@ TextStream& FEColorMatrix::externalRepresentation(TextStream& ts, int indent) co
         ts << "\"";
     }
     ts << "]\n";
-    m_in->externalRepresentation(ts, indent + 1);
+    inputEffect(0)->externalRepresentation(ts, indent + 1);
     return ts;
 }
 
diff --git a/WebCore/platform/graphics/filters/FEColorMatrix.h b/WebCore/platform/graphics/filters/FEColorMatrix.h
index 906d0f1..9b9084c 100644
--- a/WebCore/platform/graphics/filters/FEColorMatrix.h
+++ b/WebCore/platform/graphics/filters/FEColorMatrix.h
@@ -40,7 +40,7 @@ namespace WebCore {
 
     class FEColorMatrix : public FilterEffect {
     public:
-        static PassRefPtr<FEColorMatrix> create(FilterEffect*, ColorMatrixType, const Vector<float>&);
+        static PassRefPtr<FEColorMatrix> create(ColorMatrixType, const Vector<float>&);
 
         ColorMatrixType type() const;
         void setType(ColorMatrixType);
@@ -48,15 +48,13 @@ namespace WebCore {
         const Vector<float>& values() const;
         void setValues(const Vector<float>&);
 
-        virtual FloatRect uniteChildEffectSubregions(Filter* filter) { return calculateUnionOfChildEffectSubregions(filter, m_in.get()); }
         void apply(Filter*);
         void dump();
         TextStream& externalRepresentation(TextStream&, int indent) const;
 
     private:
-        FEColorMatrix(FilterEffect*, ColorMatrixType, const Vector<float>&);
+        FEColorMatrix(ColorMatrixType, const Vector<float>&);
 
-        RefPtr<FilterEffect> m_in;
         ColorMatrixType m_type;
         Vector<float> m_values;
     };
diff --git a/WebCore/platform/graphics/filters/FEComponentTransfer.cpp b/WebCore/platform/graphics/filters/FEComponentTransfer.cpp
index 19df970..471fec8 100644
--- a/WebCore/platform/graphics/filters/FEComponentTransfer.cpp
+++ b/WebCore/platform/graphics/filters/FEComponentTransfer.cpp
@@ -36,10 +36,9 @@ namespace WebCore {
 
 typedef void (*TransferType)(unsigned char*, const ComponentTransferFunction&);
 
-FEComponentTransfer::FEComponentTransfer(FilterEffect* in, const ComponentTransferFunction& redFunc, 
+FEComponentTransfer::FEComponentTransfer(const ComponentTransferFunction& redFunc, 
     const ComponentTransferFunction& greenFunc, const ComponentTransferFunction& blueFunc, const ComponentTransferFunction& alphaFunc)
     : FilterEffect()
-    , m_in(in)
     , m_redFunc(redFunc)
     , m_greenFunc(greenFunc)
     , m_blueFunc(blueFunc)
@@ -47,10 +46,10 @@ FEComponentTransfer::FEComponentTransfer(FilterEffect* in, const ComponentTransf
 {
 }
 
-PassRefPtr<FEComponentTransfer> FEComponentTransfer::create(FilterEffect* in, const ComponentTransferFunction& redFunc, 
+PassRefPtr<FEComponentTransfer> FEComponentTransfer::create(const ComponentTransferFunction& redFunc, 
     const ComponentTransferFunction& greenFunc, const ComponentTransferFunction& blueFunc, const ComponentTransferFunction& alphaFunc)
 {
-    return adoptRef(new FEComponentTransfer(in, redFunc, greenFunc, blueFunc, alphaFunc));
+    return adoptRef(new FEComponentTransfer(redFunc, greenFunc, blueFunc, alphaFunc));
 }
 
 ComponentTransferFunction FEComponentTransfer::redFunction() const
@@ -150,8 +149,9 @@ static void gamma(unsigned char* values, const ComponentTransferFunction& transf
 
 void FEComponentTransfer::apply(Filter* filter)
 {
-    m_in->apply(filter);
-    if (!m_in->resultImage())
+    FilterEffect* in = inputEffect(0);
+    in->apply(filter);
+    if (!in->resultImage())
         return;
 
     if (!getEffectContext())
@@ -167,8 +167,8 @@ void FEComponentTransfer::apply(Filter* filter)
     for (unsigned channel = 0; channel < 4; channel++)
         (*callEffect[transferFunction[channel].type])(tables[channel], transferFunction[channel]);
 
-    IntRect drawingRect = calculateDrawingIntRect(m_in->scaledSubRegion());
-    RefPtr<ImageData> imageData(m_in->resultImage()->getUnmultipliedImageData(drawingRect));
+    IntRect drawingRect = calculateDrawingIntRect(in->repaintRectInLocalCoordinates());
+    RefPtr<ImageData> imageData(in->resultImage()->getUnmultipliedImageData(drawingRect));
     CanvasPixelArray* srcPixelArray(imageData->data());
 
     for (unsigned pixelOffset = 0; pixelOffset < srcPixelArray->length(); pixelOffset += 4) {
@@ -235,7 +235,7 @@ TextStream& FEComponentTransfer::externalRepresentation(TextStream& ts, int inde
     ts << "{blue: " << m_blueFunc << "}\n";    
     writeIndent(ts, indent + 2);
     ts << "{alpha: " << m_alphaFunc << "}]\n";
-    m_in->externalRepresentation(ts, indent + 1);
+    inputEffect(0)->externalRepresentation(ts, indent + 1);
     return ts;
 }
 
diff --git a/WebCore/platform/graphics/filters/FEComponentTransfer.h b/WebCore/platform/graphics/filters/FEComponentTransfer.h
index 834d9ee..55724db 100644
--- a/WebCore/platform/graphics/filters/FEComponentTransfer.h
+++ b/WebCore/platform/graphics/filters/FEComponentTransfer.h
@@ -63,7 +63,7 @@ namespace WebCore {
 
     class FEComponentTransfer : public FilterEffect {
     public:
-        static PassRefPtr<FEComponentTransfer> create(FilterEffect*, const ComponentTransferFunction&, 
+        static PassRefPtr<FEComponentTransfer> create(const ComponentTransferFunction&, 
                 const ComponentTransferFunction&, const ComponentTransferFunction&, const ComponentTransferFunction&);
 
         ComponentTransferFunction redFunction() const;
@@ -78,16 +78,14 @@ namespace WebCore {
         ComponentTransferFunction alphaFunction() const;
         void setAlphaFunction(const ComponentTransferFunction&);
 
-        virtual FloatRect uniteChildEffectSubregions(Filter* filter) { return calculateUnionOfChildEffectSubregions(filter, m_in.get()); }
         void apply(Filter*);
         void dump();
         TextStream& externalRepresentation(TextStream&, int indent) const;
 
     private:
-        FEComponentTransfer(FilterEffect*,const ComponentTransferFunction&, const ComponentTransferFunction&,
-                const ComponentTransferFunction&, const ComponentTransferFunction&);
+        FEComponentTransfer(const ComponentTransferFunction&, const ComponentTransferFunction&,
+                            const ComponentTransferFunction&, const ComponentTransferFunction&);
 
-        RefPtr<FilterEffect> m_in;
         ComponentTransferFunction m_redFunc;
         ComponentTransferFunction m_greenFunc;
         ComponentTransferFunction m_blueFunc;
diff --git a/WebCore/platform/graphics/filters/FEComposite.cpp b/WebCore/platform/graphics/filters/FEComposite.cpp
index d9f00ce..c10a0f2 100644
--- a/WebCore/platform/graphics/filters/FEComposite.cpp
+++ b/WebCore/platform/graphics/filters/FEComposite.cpp
@@ -32,11 +32,8 @@
 
 namespace WebCore {
 
-FEComposite::FEComposite(FilterEffect* in, FilterEffect* in2, const CompositeOperationType& type,
-    const float& k1, const float& k2, const float& k3, const float& k4)
+FEComposite::FEComposite(const CompositeOperationType& type, float k1, float k2, float k3, float k4)
     : FilterEffect()
-    , m_in(in)
-    , m_in2(in2)
     , m_type(type)
     , m_k1(k1)
     , m_k2(k2)
@@ -45,10 +42,9 @@ FEComposite::FEComposite(FilterEffect* in, FilterEffect* in2, const CompositeOpe
 {
 }
 
-PassRefPtr<FEComposite> FEComposite::create(FilterEffect* in, FilterEffect* in2, const CompositeOperationType& type,
-    const float& k1, const float& k2, const float& k3, const float& k4)
+PassRefPtr<FEComposite> FEComposite::create(const CompositeOperationType& type, float k1, float k2, float k3, float k4)
 {
-    return adoptRef(new FEComposite(in, in2, type, k1, k2, k3, k4));
+    return adoptRef(new FEComposite(type, k1, k2, k3, k4));
 }
 
 CompositeOperationType FEComposite::operation() const
@@ -119,9 +115,11 @@ inline void arithmetic(const RefPtr<CanvasPixelArray>& srcPixelArrayA, CanvasPix
 
 void FEComposite::apply(Filter* filter)
 {
-    m_in->apply(filter);
-    m_in2->apply(filter);
-    if (!m_in->resultImage() || !m_in2->resultImage())
+    FilterEffect* in = inputEffect(0);
+    FilterEffect* in2 = inputEffect(1);
+    in->apply(filter);
+    in2->apply(filter);
+    if (!in->resultImage() || !in2->resultImage())
         return;
 
     GraphicsContext* filterContext = getEffectContext();
@@ -131,33 +129,33 @@ void FEComposite::apply(Filter* filter)
     FloatRect srcRect = FloatRect(0.f, 0.f, -1.f, -1.f);
     switch (m_type) {
     case FECOMPOSITE_OPERATOR_OVER:
-        filterContext->drawImageBuffer(m_in2->resultImage(), DeviceColorSpace, calculateDrawingRect(m_in2->scaledSubRegion()));
-        filterContext->drawImageBuffer(m_in->resultImage(), DeviceColorSpace, calculateDrawingRect(m_in->scaledSubRegion()));
+        filterContext->drawImageBuffer(in2->resultImage(), DeviceColorSpace, calculateDrawingRect(in2->repaintRectInLocalCoordinates()));
+        filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, calculateDrawingRect(in->repaintRectInLocalCoordinates()));
         break;
     case FECOMPOSITE_OPERATOR_IN:
         filterContext->save();
-        filterContext->clipToImageBuffer(m_in2->resultImage(), calculateDrawingRect(m_in2->scaledSubRegion()));
-        filterContext->drawImageBuffer(m_in->resultImage(), DeviceColorSpace, calculateDrawingRect(m_in->scaledSubRegion()));
+        filterContext->clipToImageBuffer(in2->resultImage(), calculateDrawingRect(in2->repaintRectInLocalCoordinates()));
+        filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, calculateDrawingRect(in->repaintRectInLocalCoordinates()));
         filterContext->restore();
         break;
     case FECOMPOSITE_OPERATOR_OUT:
-        filterContext->drawImageBuffer(m_in->resultImage(), DeviceColorSpace, calculateDrawingRect(m_in->scaledSubRegion()));
-        filterContext->drawImageBuffer(m_in2->resultImage(), DeviceColorSpace, calculateDrawingRect(m_in2->scaledSubRegion()), srcRect, CompositeDestinationOut);
+        filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, calculateDrawingRect(in->repaintRectInLocalCoordinates()));
+        filterContext->drawImageBuffer(in2->resultImage(), DeviceColorSpace, calculateDrawingRect(in2->repaintRectInLocalCoordinates()), srcRect, CompositeDestinationOut);
         break;
     case FECOMPOSITE_OPERATOR_ATOP:
-        filterContext->drawImageBuffer(m_in2->resultImage(), DeviceColorSpace, calculateDrawingRect(m_in2->scaledSubRegion()));
-        filterContext->drawImageBuffer(m_in->resultImage(), DeviceColorSpace, calculateDrawingRect(m_in->scaledSubRegion()), srcRect, CompositeSourceAtop);
+        filterContext->drawImageBuffer(in2->resultImage(), DeviceColorSpace, calculateDrawingRect(in2->repaintRectInLocalCoordinates()));
+        filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, calculateDrawingRect(in->repaintRectInLocalCoordinates()), srcRect, CompositeSourceAtop);
         break;
     case FECOMPOSITE_OPERATOR_XOR:
-        filterContext->drawImageBuffer(m_in2->resultImage(), DeviceColorSpace, calculateDrawingRect(m_in2->scaledSubRegion()));
-        filterContext->drawImageBuffer(m_in->resultImage(), DeviceColorSpace, calculateDrawingRect(m_in->scaledSubRegion()), srcRect, CompositeXOR);
+        filterContext->drawImageBuffer(in2->resultImage(), DeviceColorSpace, calculateDrawingRect(in2->repaintRectInLocalCoordinates()));
+        filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, calculateDrawingRect(in->repaintRectInLocalCoordinates()), srcRect, CompositeXOR);
         break;
     case FECOMPOSITE_OPERATOR_ARITHMETIC: {
-        IntRect effectADrawingRect = calculateDrawingIntRect(m_in->scaledSubRegion());
-        RefPtr<CanvasPixelArray> srcPixelArrayA(m_in->resultImage()->getPremultipliedImageData(effectADrawingRect)->data());
+        IntRect effectADrawingRect = calculateDrawingIntRect(in->repaintRectInLocalCoordinates());
+        RefPtr<CanvasPixelArray> srcPixelArrayA(in->resultImage()->getPremultipliedImageData(effectADrawingRect)->data());
 
-        IntRect effectBDrawingRect = calculateDrawingIntRect(m_in2->scaledSubRegion());
-        RefPtr<ImageData> imageData(m_in2->resultImage()->getPremultipliedImageData(effectBDrawingRect));
+        IntRect effectBDrawingRect = calculateDrawingIntRect(in2->repaintRectInLocalCoordinates());
+        RefPtr<ImageData> imageData(in2->resultImage()->getPremultipliedImageData(effectBDrawingRect));
         CanvasPixelArray* srcPixelArrayB(imageData->data());
 
         arithmetic(srcPixelArrayA, srcPixelArrayB, m_k1, m_k2, m_k3, m_k4);
@@ -210,8 +208,8 @@ TextStream& FEComposite::externalRepresentation(TextStream& ts, int indent) cons
     if (m_type == FECOMPOSITE_OPERATOR_ARITHMETIC)
         ts << " k1=\"" << m_k1 << "\" k2=\"" << m_k2 << "\" k3=\"" << m_k3 << "\" k4=\"" << m_k4 << "\"";
     ts << "]\n";
-    m_in->externalRepresentation(ts, indent + 1);
-    m_in2->externalRepresentation(ts, indent + 1);
+    inputEffect(0)->externalRepresentation(ts, indent + 1);
+    inputEffect(1)->externalRepresentation(ts, indent + 1);
     return ts;
 }
 
diff --git a/WebCore/platform/graphics/filters/FEComposite.h b/WebCore/platform/graphics/filters/FEComposite.h
index 11268c7..448d036 100644
--- a/WebCore/platform/graphics/filters/FEComposite.h
+++ b/WebCore/platform/graphics/filters/FEComposite.h
@@ -42,8 +42,7 @@ enum CompositeOperationType {
 
 class FEComposite : public FilterEffect {
 public:
-    static PassRefPtr<FEComposite> create(FilterEffect*, FilterEffect*, const CompositeOperationType&,
-            const float&, const float&, const float&, const float&);
+    static PassRefPtr<FEComposite> create(const CompositeOperationType&, float, float, float, float);
 
     CompositeOperationType operation() const;
     void setOperation(CompositeOperationType);
@@ -60,17 +59,13 @@ public:
     float k4() const;
     void setK4(float);
 
-    virtual FloatRect uniteChildEffectSubregions(Filter* filter) { return calculateUnionOfChildEffectSubregions(filter, m_in.get(), m_in2.get()); }
     void apply(Filter*);
     void dump();
     TextStream& externalRepresentation(TextStream&, int indent) const;
 
 private:
-    FEComposite(FilterEffect*, FilterEffect*, const CompositeOperationType&,
-            const float&, const float&, const float&, const float&);
+    FEComposite(const CompositeOperationType&, float, float, float, float);
 
-    RefPtr<FilterEffect> m_in;
-    RefPtr<FilterEffect> m_in2;
     CompositeOperationType m_type;
     float m_k1;
     float m_k2;
diff --git a/WebCore/platform/graphics/filters/FEGaussianBlur.cpp b/WebCore/platform/graphics/filters/FEGaussianBlur.cpp
index 44bb65a..72a5a04 100644
--- a/WebCore/platform/graphics/filters/FEGaussianBlur.cpp
+++ b/WebCore/platform/graphics/filters/FEGaussianBlur.cpp
@@ -38,17 +38,16 @@ static const float gGaussianKernelFactor = (3 * sqrtf(2 * piFloat) / 4.f);
 
 namespace WebCore {
 
-FEGaussianBlur::FEGaussianBlur(FilterEffect* in, const float& x, const float& y)
+FEGaussianBlur::FEGaussianBlur(float x, float y)
     : FilterEffect()
-    , m_in(in)
     , m_stdX(x)
     , m_stdY(y)
 {
 }
 
-PassRefPtr<FEGaussianBlur> FEGaussianBlur::create(FilterEffect* in, const float& x, const float& y)
+PassRefPtr<FEGaussianBlur> FEGaussianBlur::create(float x, float y)
 {
-    return adoptRef(new FEGaussianBlur(in, x, y));
+    return adoptRef(new FEGaussianBlur(x, y));
 }
 
 float FEGaussianBlur::stdDeviationX() const
@@ -128,17 +127,18 @@ void FEGaussianBlur::kernelPosition(int boxBlur, unsigned& std, int& dLeft, int&
 
 void FEGaussianBlur::apply(Filter* filter)
 {
-    m_in->apply(filter);
-    if (!m_in->resultImage())
+    FilterEffect* in = inputEffect(0);
+    in->apply(filter);
+    if (!in->resultImage())
         return;
 
     if (!getEffectContext())
         return;
 
-    setIsAlphaImage(m_in->isAlphaImage());
+    setIsAlphaImage(in->isAlphaImage());
 
-    IntRect effectDrawingRect = calculateDrawingIntRect(m_in->scaledSubRegion());
-    RefPtr<ImageData> srcImageData(m_in->resultImage()->getPremultipliedImageData(effectDrawingRect));
+    IntRect effectDrawingRect = calculateDrawingIntRect(in->repaintRectInLocalCoordinates());
+    RefPtr<ImageData> srcImageData(in->resultImage()->getPremultipliedImageData(effectDrawingRect));
     IntRect imageRect(IntPoint(), resultImage()->size());
 
     if (!m_stdX && !m_stdY) {
@@ -196,7 +196,7 @@ TextStream& FEGaussianBlur::externalRepresentation(TextStream& ts, int indent) c
     ts << "[feGaussianBlur";
     FilterEffect::externalRepresentation(ts);
     ts << " stdDeviation=\"" << m_stdX << ", " << m_stdY << "\"]\n";
-    m_in->externalRepresentation(ts, indent + 1);
+    inputEffect(0)->externalRepresentation(ts, indent + 1);
     return ts;
 }
 
diff --git a/WebCore/platform/graphics/filters/FEGaussianBlur.h b/WebCore/platform/graphics/filters/FEGaussianBlur.h
index ad5c5a3..63d763e 100644
--- a/WebCore/platform/graphics/filters/FEGaussianBlur.h
+++ b/WebCore/platform/graphics/filters/FEGaussianBlur.h
@@ -30,7 +30,7 @@ namespace WebCore {
 
 class FEGaussianBlur : public FilterEffect {
 public:
-    static PassRefPtr<FEGaussianBlur> create(FilterEffect*, const float&, const float&);
+    static PassRefPtr<FEGaussianBlur> create(float, float);
 
     float stdDeviationX() const;
     void setStdDeviationX(float);
@@ -38,7 +38,6 @@ public:
     float stdDeviationY() const;
     void setStdDeviationY(float);
 
-    virtual FloatRect uniteChildEffectSubregions(Filter* filter) { return calculateUnionOfChildEffectSubregions(filter, m_in.get()); }
     void apply(Filter*);
     void dump();
     TextStream& externalRepresentation(TextStream&, int indent) const;
@@ -46,10 +45,9 @@ public:
     static float calculateStdDeviation(float);
 
 private:
-    FEGaussianBlur(FilterEffect*, const float&, const float&);
+    FEGaussianBlur(float, float);
     static void kernelPosition(int boxBlur, unsigned& std, int& dLeft, int& dRight);
 
-    RefPtr<FilterEffect> m_in;
     float m_stdX;
     float m_stdY;
 };
diff --git a/WebCore/platform/graphics/filters/Filter.h b/WebCore/platform/graphics/filters/Filter.h
index 16d499f..7ad25aa 100644
--- a/WebCore/platform/graphics/filters/Filter.h
+++ b/WebCore/platform/graphics/filters/Filter.h
@@ -48,7 +48,7 @@ namespace WebCore {
         virtual FloatRect filterRegion() const = 0;
 
         // SVG specific
-        virtual void calculateEffectSubRegion(FilterEffect*) { }
+        virtual void determineFilterPrimitiveSubregion(FilterEffect*, const FloatRect&) { }
 
         virtual FloatSize maxImageSize() const = 0;
         virtual bool effectBoundingBoxMode() const = 0;
diff --git a/WebCore/platform/graphics/filters/FilterEffect.cpp b/WebCore/platform/graphics/filters/FilterEffect.cpp
index 4d7265c..b6278b2 100644
--- a/WebCore/platform/graphics/filters/FilterEffect.cpp
+++ b/WebCore/platform/graphics/filters/FilterEffect.cpp
@@ -1,21 +1,23 @@
 /*
-    Copyright (C) Alex Mathews <possessedpenguinbob at gmail.com>
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Library General Public
-    License as published by the Free Software Foundation; either
-    version 2 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Library General Public License for more details.
-
-    You should have received a copy of the GNU Library General Public License
-    aint with this library; see the file COPYING.LIB.  If not, write to
-    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-    Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2008 Alex Mathews <possessedpenguinbob at gmail.com>
+ * Copyright (C) 2009 Dirk Schulze <krit at webkit.org>
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
 
 #include "config.h"
 
@@ -25,11 +27,11 @@
 namespace WebCore {
 
 FilterEffect::FilterEffect()
-    : m_hasX(false)
+    : m_alphaImage(false)
+    , m_hasX(false)
     , m_hasY(false)
     , m_hasWidth(false)
     , m_hasHeight(false)
-    , m_alphaImage(false)
 {
 }
 
@@ -37,43 +39,49 @@ FilterEffect::~FilterEffect()
 {
 }
 
-FloatRect FilterEffect::calculateUnionOfChildEffectSubregions(Filter* filter, FilterEffect* in)
-{
-    return in->calculateEffectRect(filter);
-}
-
-FloatRect FilterEffect::calculateUnionOfChildEffectSubregions(Filter* filter, FilterEffect* in, FilterEffect* in2)
+FloatRect FilterEffect::determineFilterPrimitiveSubregion(Filter* filter)
 {
-    FloatRect uniteEffectRect = in->calculateEffectRect(filter);
-    uniteEffectRect.unite(in2->calculateEffectRect(filter));
-    return uniteEffectRect;
+    FloatRect uniteRect;
+    unsigned size = m_inputEffects.size();
+
+    // FETurbulence, FEImage and FEFlood don't have input effects, take the filter region as unite rect.
+    if (!size)
+        uniteRect = filter->filterRegion();
+    else {
+        for (unsigned i = 0; i < size; ++i)
+            uniteRect.unite(m_inputEffects.at(i)->determineFilterPrimitiveSubregion(filter));
+    }
+
+    filter->determineFilterPrimitiveSubregion(this, uniteRect);
+    return m_filterPrimitiveSubregion;
 }
 
-FloatRect FilterEffect::calculateEffectRect(Filter* filter)
+IntRect FilterEffect::calculateDrawingIntRect(const FloatRect& effectRect) const
 {
-    setUnionOfChildEffectSubregions(uniteChildEffectSubregions(filter));
-    filter->calculateEffectSubRegion(this);
-    return subRegion();
+    ASSERT(m_effectBuffer);
+    FloatPoint location = m_repaintRectInLocalCoordinates.location();
+    location.move(-effectRect.x(), -effectRect.y());
+    return IntRect(roundedIntPoint(location), m_effectBuffer->size());
 }
 
-IntRect FilterEffect::calculateDrawingIntRect(const FloatRect& effectRect)
+FloatRect FilterEffect::calculateDrawingRect(const FloatRect& srcRect) const
 {
-    IntPoint location = roundedIntPoint(FloatPoint(scaledSubRegion().x() - effectRect.x(),
-                                                   scaledSubRegion().y() - effectRect.y()));
-    return IntRect(location, resultImage()->size());
+    return FloatRect(FloatPoint(srcRect.x() - m_repaintRectInLocalCoordinates.x(),
+                                srcRect.y() - m_repaintRectInLocalCoordinates.y()), srcRect.size());
 }
 
-FloatRect FilterEffect::calculateDrawingRect(const FloatRect& srcRect)
+FilterEffect* FilterEffect::inputEffect(unsigned number) const
 {
-    FloatPoint startPoint = FloatPoint(srcRect.x() - scaledSubRegion().x(), srcRect.y() - scaledSubRegion().y());
-    FloatRect drawingRect = FloatRect(startPoint, srcRect.size());
-    return drawingRect;
+    ASSERT(number < m_inputEffects.size());
+    return m_inputEffects.at(number).get();
 }
 
 GraphicsContext* FilterEffect::getEffectContext()
 {
-    IntRect bufferRect = enclosingIntRect(scaledSubRegion());
+    IntRect bufferRect = enclosingIntRect(m_repaintRectInLocalCoordinates);
     m_effectBuffer = ImageBuffer::create(bufferRect.size(), LinearRGB);
+    if (!m_effectBuffer)
+        return 0;
     return m_effectBuffer->context();
 }
 
diff --git a/WebCore/platform/graphics/filters/FilterEffect.h b/WebCore/platform/graphics/filters/FilterEffect.h
index 3b8b5a3..91c52f3 100644
--- a/WebCore/platform/graphics/filters/FilterEffect.h
+++ b/WebCore/platform/graphics/filters/FilterEffect.h
@@ -1,22 +1,23 @@
 /*
-    Copyright (C) 2008 Alex Mathews <possessedpenguinbob at gmail.com>
-                  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
-    License as published by the Free Software Foundation; either
-    version 2 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Library General Public License for more details.
-
-    You should have received a copy of the GNU Library General Public License
-    aint with this library; see the file COPYING.LIB.  If not, write to
-    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-    Boston, MA 02110-1301, USA.
-*/
+ * Copyright (C) 2008 Alex Mathews <possessedpenguinbob at gmail.com>
+ * Copyright (C) 2009 Dirk Schulze <krit at webkit.org>
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
 
 #ifndef FilterEffect_h
 #define FilterEffect_h
@@ -32,84 +33,97 @@
 #include <wtf/PassOwnPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
 
 namespace WebCore {
 
-    class FilterEffect : public RefCounted<FilterEffect> {
-    public:
-        virtual ~FilterEffect();
+typedef Vector<RefPtr<FilterEffect> > FilterEffectVector;
+
+class FilterEffect : public RefCounted<FilterEffect> {
+public:
+    virtual ~FilterEffect();
+
+    // The result is bounded to the size of the filter primitive to save resources.
+    ImageBuffer* resultImage() const { return m_effectBuffer.get(); }
+    void setEffectBuffer(PassOwnPtr<ImageBuffer> effectBuffer) { m_effectBuffer = effectBuffer; }
+
+    // Creates the ImageBuffer for the current filter primitive result in the size of the
+    // repaintRect. Gives back the GraphicsContext of the own ImageBuffer.
+    GraphicsContext* getEffectContext();
 
-        void setUnionOfChildEffectSubregions(const FloatRect& uniteRect) { m_unionOfChildEffectSubregions = uniteRect; }
-        FloatRect unionOfChildEffectSubregions() const { return m_unionOfChildEffectSubregions; }
+    FilterEffectVector& inputEffects() { return m_inputEffects; }
+    FilterEffect* inputEffect(unsigned) const;
+    unsigned numberOfEffectInputs() const { return m_inputEffects.size(); }
 
-        FloatRect subRegion() const { return m_subRegion; }
-        void setSubRegion(const FloatRect& subRegion) { m_subRegion = subRegion; }
+    FloatRect calculateDrawingRect(const FloatRect&) const;
+    IntRect calculateDrawingIntRect(const FloatRect&) const;
 
-        FloatRect scaledSubRegion() const { return m_scaledSubRegion; }
-        void setScaledSubRegion(const FloatRect& scaledSubRegion) { m_scaledSubRegion = scaledSubRegion; }
+    // Solid black image with different alpha values.
+    bool isAlphaImage() const { return m_alphaImage; }
+    void setIsAlphaImage(bool alphaImage) { m_alphaImage = alphaImage; }
 
-        FloatRect effectBoundaries() const { return m_effectBoundaries; }
-        void setEffectBoundaries(const FloatRect& effectBoundaries) { m_effectBoundaries = effectBoundaries; }
+    FloatRect repaintRectInLocalCoordinates() const { return m_repaintRectInLocalCoordinates; }
+    void setRepaintRectInLocalCoordinates(const FloatRect& repaintRectInLocalCoordinates) { m_repaintRectInLocalCoordinates = repaintRectInLocalCoordinates; }
 
-        bool hasX() { return m_hasX; }
-        void setHasX(bool value) { m_hasX = value; }
+    virtual void apply(Filter*) = 0;
+    virtual void dump() = 0;
 
-        bool hasY() { return m_hasY; }
-        void setHasY(bool value) { m_hasY = value; }
+    virtual bool isSourceInput() const { return false; }
 
-        bool hasWidth() { return m_hasWidth; }
-        void setHasWidth(bool value) { m_hasWidth = value; }
+    virtual TextStream& externalRepresentation(TextStream&, int indention = 0) const;
 
-        bool hasHeight() { return m_hasHeight; }
-        void setHasHeight(bool value) { m_hasHeight = value; }
+public:
+    // The following functions are SVG specific and will move to RenderSVGResourceFilterPrimitive.
+    // See bug https://bugs.webkit.org/show_bug.cgi?id=45614.
+    bool hasX() const { return m_hasX; }
+    void setHasX(bool value) { m_hasX = value; }
 
-        // The result is bounded by the size of the filter primitive to save resources
-        ImageBuffer* resultImage() { return m_effectBuffer.get(); }
-        void setEffectBuffer(PassOwnPtr<ImageBuffer> effectBuffer) { m_effectBuffer = effectBuffer; }
+    bool hasY() const { return m_hasY; }
+    void setHasY(bool value) { m_hasY = value; }
 
-        FloatRect calculateUnionOfChildEffectSubregions(Filter*, FilterEffect*, FilterEffect*);
-        FloatRect calculateUnionOfChildEffectSubregions(Filter*, FilterEffect*);
+    bool hasWidth() const { return m_hasWidth; }
+    void setHasWidth(bool value) { m_hasWidth = value; }
 
-        GraphicsContext* getEffectContext();
-        FloatRect calculateDrawingRect(const FloatRect&);
-        IntRect calculateDrawingIntRect(const FloatRect&);
+    bool hasHeight() const { return m_hasHeight; }
+    void setHasHeight(bool value) { m_hasHeight = value; }
 
-        // black image with different alpha values
-        bool isAlphaImage() { return m_alphaImage; }
-        void setIsAlphaImage(bool alphaImage) { m_alphaImage = alphaImage; }
+    // FIXME: Pseudo primitives like SourceGraphic and SourceAlpha as well as FETile still need special handling.
+    virtual FloatRect determineFilterPrimitiveSubregion(Filter*);
 
-        virtual FloatRect uniteChildEffectSubregions(Filter* filter) { return filter->filterRegion(); }
-        virtual FloatRect calculateEffectRect(Filter*);
-        virtual void apply(Filter*) = 0;
-        virtual void dump() = 0;
+    FloatRect filterPrimitiveSubregion() const { return m_filterPrimitiveSubregion; }
+    void setFilterPrimitiveSubregion(const FloatRect& filterPrimitiveSubregion) { m_filterPrimitiveSubregion = filterPrimitiveSubregion; }
 
-        virtual bool isSourceInput() { return false; }
+    FloatRect effectBoundaries() const { return m_effectBoundaries; }
+    void setEffectBoundaries(const FloatRect& effectBoundaries) { m_effectBoundaries = effectBoundaries; }
 
-        virtual TextStream& externalRepresentation(TextStream&, int indention = 0) const;
-    protected:
-        FilterEffect();
+protected:
+    FilterEffect();
 
-    private:
+private:
+    OwnPtr<ImageBuffer> m_effectBuffer;
+    FilterEffectVector m_inputEffects;
 
-        bool m_xBBoxMode : 1;
-        bool m_yBBoxMode : 1;
-        bool m_widthBBoxMode : 1;
-        bool m_heightBBoxMode : 1;
+    bool m_alphaImage;
 
-        bool m_hasX : 1;
-        bool m_hasY : 1;
-        bool m_hasWidth : 1;
-        bool m_hasHeight : 1;
+    // FIXME: Should be the paint region of the filter primitive, instead of the scaled subregion on use of filterRes.
+    FloatRect m_repaintRectInLocalCoordinates;
 
-        bool m_alphaImage;
+private:
+    // The following member variables are SVG specific and will move to RenderSVGResourceFilterPrimitive.
+    // See bug https://bugs.webkit.org/show_bug.cgi?id=45614.
 
-        FloatRect m_effectBoundaries;
-        FloatRect m_subRegion;
-        FloatRect m_scaledSubRegion;
-        FloatRect m_unionOfChildEffectSubregions;
+    // The subregion of a filter primitive according to the SVG Filter specification in local coordinates.
+    // This is SVG specific and needs to move to RenderSVGResourceFilterPrimitive.
+    FloatRect m_filterPrimitiveSubregion;
 
-        mutable OwnPtr<ImageBuffer> m_effectBuffer;
-    };
+    // x, y, width and height of the actual SVGFE*Element. Is needed to determine the subregion of the
+    // filter primitive on a later step.
+    FloatRect m_effectBoundaries;
+    bool m_hasX;
+    bool m_hasY;
+    bool m_hasWidth;
+    bool m_hasHeight;
+};
 
 } // namespace WebCore
 
diff --git a/WebCore/platform/graphics/filters/SourceAlpha.cpp b/WebCore/platform/graphics/filters/SourceAlpha.cpp
index 37b0023..9c6a953 100644
--- a/WebCore/platform/graphics/filters/SourceAlpha.cpp
+++ b/WebCore/platform/graphics/filters/SourceAlpha.cpp
@@ -42,16 +42,16 @@ const AtomicString& SourceAlpha::effectName()
     return s_effectName;
 }
 
-FloatRect SourceAlpha::calculateEffectRect(Filter* filter)
+FloatRect SourceAlpha::determineFilterPrimitiveSubregion(Filter* filter)
 {
     FloatRect clippedSourceRect = filter->sourceImageRect();
     if (filter->sourceImageRect().x() < filter->filterRegion().x())
         clippedSourceRect.setX(filter->filterRegion().x());
     if (filter->sourceImageRect().y() < filter->filterRegion().y())
         clippedSourceRect.setY(filter->filterRegion().y());
-    setSubRegion(clippedSourceRect);
+    setFilterPrimitiveSubregion(clippedSourceRect);
     clippedSourceRect.scale(filter->filterResolution().width(), filter->filterResolution().height());
-    setScaledSubRegion(clippedSourceRect);
+    setRepaintRectInLocalCoordinates(clippedSourceRect);
     return filter->filterRegion();
 }
 
diff --git a/WebCore/platform/graphics/filters/SourceAlpha.h b/WebCore/platform/graphics/filters/SourceAlpha.h
index e5c6815..25a17b2 100644
--- a/WebCore/platform/graphics/filters/SourceAlpha.h
+++ b/WebCore/platform/graphics/filters/SourceAlpha.h
@@ -34,11 +34,12 @@ namespace WebCore {
 
         static const AtomicString& effectName();
 
-        virtual bool isSourceInput() { return true; }
-        virtual FloatRect calculateEffectRect(Filter*);
         void apply(Filter*);
         void dump();
         TextStream& externalRepresentation(TextStream&, int indent) const;
+
+        virtual bool isSourceInput() const { return true; }
+        virtual FloatRect determineFilterPrimitiveSubregion(Filter*);
     
     private:
         SourceAlpha() { }
diff --git a/WebCore/platform/graphics/filters/SourceGraphic.cpp b/WebCore/platform/graphics/filters/SourceGraphic.cpp
index 5730d34..6a32e36 100644
--- a/WebCore/platform/graphics/filters/SourceGraphic.cpp
+++ b/WebCore/platform/graphics/filters/SourceGraphic.cpp
@@ -41,16 +41,16 @@ const AtomicString& SourceGraphic::effectName()
     return s_effectName;
 }
 
-FloatRect SourceGraphic::calculateEffectRect(Filter* filter)
+FloatRect SourceGraphic::determineFilterPrimitiveSubregion(Filter* filter)
 {
     FloatRect clippedSourceRect = filter->sourceImageRect();
     if (filter->sourceImageRect().x() < filter->filterRegion().x())
         clippedSourceRect.setX(filter->filterRegion().x());
     if (filter->sourceImageRect().y() < filter->filterRegion().y())
         clippedSourceRect.setY(filter->filterRegion().y());
-    setSubRegion(clippedSourceRect);
+    setFilterPrimitiveSubregion(clippedSourceRect);
     clippedSourceRect.scale(filter->filterResolution().width(), filter->filterResolution().height());
-    setScaledSubRegion(clippedSourceRect);
+    setRepaintRectInLocalCoordinates(clippedSourceRect);
     return filter->filterRegion();
 }
 
diff --git a/WebCore/platform/graphics/filters/SourceGraphic.h b/WebCore/platform/graphics/filters/SourceGraphic.h
index 05238a2..911648c 100644
--- a/WebCore/platform/graphics/filters/SourceGraphic.h
+++ b/WebCore/platform/graphics/filters/SourceGraphic.h
@@ -35,12 +35,13 @@ namespace WebCore {
 
         static const AtomicString& effectName();
 
-        virtual bool isSourceInput() { return true; }
-        virtual FloatRect calculateEffectRect(Filter*);
         void apply(Filter*);
         void dump();
         TextStream& externalRepresentation(TextStream&, int indent) const;
-    
+
+        virtual bool isSourceInput() const { return true; }
+        virtual FloatRect determineFilterPrimitiveSubregion(Filter*);
+
     private:
         SourceGraphic() { }
     };
diff --git a/WebCore/rendering/RenderSVGResourceFilter.cpp b/WebCore/rendering/RenderSVGResourceFilter.cpp
index 982375e..698033e 100644
--- a/WebCore/rendering/RenderSVGResourceFilter.cpp
+++ b/WebCore/rendering/RenderSVGResourceFilter.cpp
@@ -1,8 +1,8 @@
 /*
  * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann at kde.org>
- *               2004, 2005 Rob Buis <buis at kde.org>
- *               2005 Eric Seidel <eric at webkit.org>
- *               2009 Dirk Schulze <krit at webkit.org>
+ * Copyright (C) 2004, 2005 Rob Buis <buis at kde.org>
+ * Copyright (C) 2005 Eric Seidel <eric at webkit.org>
+ * Copyright (C) 2009 Dirk Schulze <krit at webkit.org>
  * Copyright (C) Research In Motion Limited 2010. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
@@ -19,7 +19,6 @@
  * along with this library; see the file COPYING.LIB.  If not, write to
  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  * Boston, MA 02110-1301, USA.
- *
  */
 
 #include "config.h"
@@ -193,12 +192,12 @@ bool RenderSVGResourceFilter::applyResource(RenderObject* object, RenderStyle*,
     if (!lastEffect)
         return false;
     
-    lastEffect->calculateEffectRect(filterData->filter.get());
+    lastEffect->determineFilterPrimitiveSubregion(filterData->filter.get());
     // At least one FilterEffect has a too big image size,
     // recalculate the effect sizes with new scale factors.
     if (!fitsInMaximumImageSize(filterData->filter->maxImageSize(), scale)) {
         filterData->filter->setFilterResolution(scale);
-        lastEffect->calculateEffectRect(filterData->filter.get());
+        lastEffect->determineFilterPrimitiveSubregion(filterData->filter.get());
     }
 
     clippedSourceRect.scale(scale.width(), scale.height());
@@ -255,7 +254,7 @@ void RenderSVGResourceFilter::postApplyResource(RenderObject* object, GraphicsCo
 
     FilterEffect* lastEffect = filterData->builder->lastEffect();
     
-    if (lastEffect && !filterData->boundaries.isEmpty() && !lastEffect->subRegion().isEmpty()) {
+    if (lastEffect && !filterData->boundaries.isEmpty() && !lastEffect->filterPrimitiveSubregion().isEmpty()) {
         // This is the real filtering of the object. It just needs to be called on the
         // initial filtering process. We just take the stored filter result on a
         // second drawing.
@@ -272,7 +271,7 @@ void RenderSVGResourceFilter::postApplyResource(RenderObject* object, GraphicsCo
 
         ImageBuffer* resultImage = lastEffect->resultImage();
         if (resultImage)
-            context->drawImageBuffer(resultImage, object->style()->colorSpace(), lastEffect->subRegion());
+            context->drawImageBuffer(resultImage, object->style()->colorSpace(), lastEffect->filterPrimitiveSubregion());
     }
 
     filterData->sourceGraphicBuffer.clear();
diff --git a/WebCore/svg/SVGFEBlendElement.cpp b/WebCore/svg/SVGFEBlendElement.cpp
index 451b7d1..c4d816b 100644
--- a/WebCore/svg/SVGFEBlendElement.cpp
+++ b/WebCore/svg/SVGFEBlendElement.cpp
@@ -87,7 +87,12 @@ PassRefPtr<FilterEffect> SVGFEBlendElement::build(SVGFilterBuilder* filterBuilde
     if (!input1 || !input2)
         return 0;
 
-    return FEBlend::create(input1, input2, static_cast<BlendModeType>(mode()));
+    RefPtr<FilterEffect> effect = FEBlend::create(static_cast<BlendModeType>(mode()));
+    FilterEffectVector& inputEffects = effect->inputEffects();
+    inputEffects.reserveCapacity(2);
+    inputEffects.append(input1);
+    inputEffects.append(input2);    
+    return effect.release();
 }
 
 }
diff --git a/WebCore/svg/SVGFEColorMatrixElement.cpp b/WebCore/svg/SVGFEColorMatrixElement.cpp
index 7f496bc..f14b4e7 100644
--- a/WebCore/svg/SVGFEColorMatrixElement.cpp
+++ b/WebCore/svg/SVGFEColorMatrixElement.cpp
@@ -123,7 +123,9 @@ PassRefPtr<FilterEffect> SVGFEColorMatrixElement::build(SVGFilterBuilder* filter
             return 0;
     }
 
-    return FEColorMatrix::create(input1, filterType, filterValues);
+    RefPtr<FilterEffect> effect = FEColorMatrix::create(filterType, filterValues);
+    effect->inputEffects().append(input1);
+    return effect.release();
 }
 
 } //namespace WebCore
diff --git a/WebCore/svg/SVGFEComponentTransferElement.cpp b/WebCore/svg/SVGFEComponentTransferElement.cpp
index a99e74c..f6b26f5 100644
--- a/WebCore/svg/SVGFEComponentTransferElement.cpp
+++ b/WebCore/svg/SVGFEComponentTransferElement.cpp
@@ -83,7 +83,9 @@ PassRefPtr<FilterEffect> SVGFEComponentTransferElement::build(SVGFilterBuilder*
             alpha = static_cast<SVGFEFuncAElement*>(n)->transferFunction();
     }
     
-    return FEComponentTransfer::create(input1, red, green, blue, alpha);
+    RefPtr<FilterEffect> effect = FEComponentTransfer::create(red, green, blue, alpha);
+    effect->inputEffects().append(input1);
+    return effect.release();
 }
 
 }
diff --git a/WebCore/svg/SVGFECompositeElement.cpp b/WebCore/svg/SVGFECompositeElement.cpp
index f658632..b6f1002 100644
--- a/WebCore/svg/SVGFECompositeElement.cpp
+++ b/WebCore/svg/SVGFECompositeElement.cpp
@@ -109,9 +109,14 @@ PassRefPtr<FilterEffect> SVGFECompositeElement::build(SVGFilterBuilder* filterBu
     
     if (!input1 || !input2)
         return 0;
-    
-    return FEComposite::create(input1, input2, static_cast<CompositeOperationType>(_operator()),
-                                        k1(), k2(), k3(), k4());
+
+    RefPtr<FilterEffect> effect = FEComposite::create(static_cast<CompositeOperationType>(_operator()),
+                                                          k1(), k2(), k3(), k4());
+    FilterEffectVector& inputEffects = effect->inputEffects();
+    inputEffects.reserveCapacity(2);
+    inputEffects.append(input1);
+    inputEffects.append(input2);    
+    return effect.release();
 }
 
 }
diff --git a/WebCore/svg/SVGFEConvolveMatrixElement.cpp b/WebCore/svg/SVGFEConvolveMatrixElement.cpp
index 9432a00..db2fad5 100644
--- a/WebCore/svg/SVGFEConvolveMatrixElement.cpp
+++ b/WebCore/svg/SVGFEConvolveMatrixElement.cpp
@@ -151,10 +151,12 @@ PassRefPtr<FilterEffect> SVGFEConvolveMatrixElement::build(SVGFilterBuilder* fil
             divisorValue = 1;
     }
 
-    return FEConvolveMatrix::create(
-        input1, IntSize(orderXValue, orderYValue), divisorValue,
-        bias(), IntPoint(targetXValue, targetYValue), static_cast<EdgeModeType>(edgeMode()),
-        FloatPoint(kernelUnitLengthX(), kernelUnitLengthX()), preserveAlpha(), kernelMatrixValues);
+    RefPtr<FilterEffect> effect = FEConvolveMatrix::create(
+                    IntSize(orderXValue, orderYValue), divisorValue,
+                    bias(), IntPoint(targetXValue, targetYValue), static_cast<EdgeModeType>(edgeMode()),
+                    FloatPoint(kernelUnitLengthX(), kernelUnitLengthX()), preserveAlpha(), kernelMatrixValues);
+    effect->inputEffects().append(input1);
+    return effect.release();
 }
 
 } // namespace WebCore
diff --git a/WebCore/svg/SVGFEDiffuseLightingElement.cpp b/WebCore/svg/SVGFEDiffuseLightingElement.cpp
index 4349f27..4bc1bdb 100644
--- a/WebCore/svg/SVGFEDiffuseLightingElement.cpp
+++ b/WebCore/svg/SVGFEDiffuseLightingElement.cpp
@@ -113,8 +113,10 @@ PassRefPtr<FilterEffect> SVGFEDiffuseLightingElement::build(SVGFilterBuilder* fi
     RefPtr<RenderStyle> filterStyle = styleForRenderer();
     Color color = filterStyle->svgStyle()->lightingColor();
     
-    return FEDiffuseLighting::create(input1, color, surfaceScale(), diffuseConstant(), 
-                                            kernelUnitLengthX(), kernelUnitLengthY(), findLights());
+    RefPtr<FilterEffect> effect = FEDiffuseLighting::create(color, surfaceScale(), diffuseConstant(), 
+                                                                kernelUnitLengthX(), kernelUnitLengthY(), findLights());
+    effect->inputEffects().append(input1);
+    return effect.release();
 }
 
 PassRefPtr<LightSource> SVGFEDiffuseLightingElement::findLights() const
diff --git a/WebCore/svg/SVGFEDisplacementMapElement.cpp b/WebCore/svg/SVGFEDisplacementMapElement.cpp
index 013eca5..ea8a7b8 100644
--- a/WebCore/svg/SVGFEDisplacementMapElement.cpp
+++ b/WebCore/svg/SVGFEDisplacementMapElement.cpp
@@ -101,10 +101,14 @@ PassRefPtr<FilterEffect> SVGFEDisplacementMapElement::build(SVGFilterBuilder* fi
     
     if (!input1 || !input2)
         return 0;
-        
-    
-    return FEDisplacementMap::create(input1, input2, static_cast<ChannelSelectorType>(xChannelSelector()), 
-                                     static_cast<ChannelSelectorType>(yChannelSelector()), scale());
+
+    RefPtr<FilterEffect> effect = FEDisplacementMap::create(static_cast<ChannelSelectorType>(xChannelSelector()), 
+                                                                static_cast<ChannelSelectorType>(yChannelSelector()), scale());
+    FilterEffectVector& inputEffects = effect->inputEffects();
+    inputEffects.reserveCapacity(2);
+    inputEffects.append(input1);
+    inputEffects.append(input2);    
+    return effect.release();
 }
 
 }
diff --git a/WebCore/svg/SVGFEGaussianBlurElement.cpp b/WebCore/svg/SVGFEGaussianBlurElement.cpp
index f66fa90..3dfd51c 100644
--- a/WebCore/svg/SVGFEGaussianBlurElement.cpp
+++ b/WebCore/svg/SVGFEGaussianBlurElement.cpp
@@ -87,7 +87,9 @@ PassRefPtr<FilterEffect> SVGFEGaussianBlurElement::build(SVGFilterBuilder* filte
     if (!input1)
         return 0;
 
-    return FEGaussianBlur::create(input1, stdDeviationX(), stdDeviationY());
+    RefPtr<FilterEffect> effect = FEGaussianBlur::create(stdDeviationX(), stdDeviationY());
+    effect->inputEffects().append(input1);
+    return effect.release();
 }
 
 }
diff --git a/WebCore/svg/SVGFEMergeElement.cpp b/WebCore/svg/SVGFEMergeElement.cpp
index 6254b24..49a052e 100644
--- a/WebCore/svg/SVGFEMergeElement.cpp
+++ b/WebCore/svg/SVGFEMergeElement.cpp
@@ -39,7 +39,8 @@ PassRefPtr<SVGFEMergeElement> SVGFEMergeElement::create(const QualifiedName& tag
 
 PassRefPtr<FilterEffect> SVGFEMergeElement::build(SVGFilterBuilder* filterBuilder)
 {
-    Vector<RefPtr<FilterEffect> > mergeInputs;
+    RefPtr<FilterEffect> effect = FEMerge::create();
+    FilterEffectVector& mergeInputs = effect->inputEffects();
     for (Node* n = firstChild(); n != 0; n = n->nextSibling()) {
         if (n->hasTagName(SVGNames::feMergeNodeTag)) {
             FilterEffect* mergeEffect = filterBuilder->getEffectById(static_cast<SVGFEMergeNodeElement*>(n)->in1());
@@ -52,7 +53,7 @@ PassRefPtr<FilterEffect> SVGFEMergeElement::build(SVGFilterBuilder* filterBuilde
     if (mergeInputs.isEmpty())
         return 0;
 
-    return FEMerge::create(mergeInputs);
+    return effect.release();
 }
 
 }
diff --git a/WebCore/svg/SVGFEMorphologyElement.cpp b/WebCore/svg/SVGFEMorphologyElement.cpp
index c3db844..b45c6f9 100644
--- a/WebCore/svg/SVGFEMorphologyElement.cpp
+++ b/WebCore/svg/SVGFEMorphologyElement.cpp
@@ -101,7 +101,9 @@ PassRefPtr<FilterEffect> SVGFEMorphologyElement::build(SVGFilterBuilder* filterB
     if (xRadius < 0 || yRadius < 0)
         return 0;
 
-    return FEMorphology::create(input1, static_cast<MorphologyOperatorType>(_operator()), xRadius, yRadius);
+    RefPtr<FilterEffect> effect = FEMorphology::create(static_cast<MorphologyOperatorType>(_operator()), xRadius, yRadius);
+    effect->inputEffects().append(input1);
+    return effect.release();
 }
 
 } //namespace WebCore
diff --git a/WebCore/svg/SVGFEOffsetElement.cpp b/WebCore/svg/SVGFEOffsetElement.cpp
index 58b4a6a..65523a5 100644
--- a/WebCore/svg/SVGFEOffsetElement.cpp
+++ b/WebCore/svg/SVGFEOffsetElement.cpp
@@ -86,7 +86,9 @@ PassRefPtr<FilterEffect> SVGFEOffsetElement::build(SVGFilterBuilder* filterBuild
     if (!input1)
         return 0;
 
-    return FEOffset::create(input1, dx(), dy());
+    RefPtr<FilterEffect> effect = FEOffset::create(dx(), dy());
+    effect->inputEffects().append(input1);
+    return effect.release();
 }
 
 }
diff --git a/WebCore/svg/SVGFESpecularLightingElement.cpp b/WebCore/svg/SVGFESpecularLightingElement.cpp
index d07c6ce..1647525 100644
--- a/WebCore/svg/SVGFESpecularLightingElement.cpp
+++ b/WebCore/svg/SVGFESpecularLightingElement.cpp
@@ -118,9 +118,11 @@ PassRefPtr<FilterEffect> SVGFESpecularLightingElement::build(SVGFilterBuilder* f
     RefPtr<RenderStyle> filterStyle = styleForRenderer();    
     
     Color color = filterStyle->svgStyle()->lightingColor();
-    
-    return FESpecularLighting::create(input1, color, surfaceScale(), specularConstant(), 
-                                      specularExponent(), kernelUnitLengthX(), kernelUnitLengthY(), findLights());
+
+    RefPtr<FilterEffect> effect = FESpecularLighting::create(color, surfaceScale(), specularConstant(), 
+                                          specularExponent(), kernelUnitLengthX(), kernelUnitLengthY(), findLights());
+    effect->inputEffects().append(input1);
+    return effect.release();
 }
 
 }
diff --git a/WebCore/svg/SVGFETileElement.cpp b/WebCore/svg/SVGFETileElement.cpp
index 4379b96..9664490 100644
--- a/WebCore/svg/SVGFETileElement.cpp
+++ b/WebCore/svg/SVGFETileElement.cpp
@@ -62,7 +62,9 @@ PassRefPtr<FilterEffect> SVGFETileElement::build(SVGFilterBuilder* filterBuilder
     if (!input1)
         return 0;
 
-    return FETile::create(input1);
+    RefPtr<FilterEffect> effect = FETile::create();
+    effect->inputEffects().append(input1);
+    return effect.release();
 }
 
 }
diff --git a/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.cpp b/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.cpp
index c1a1166..2dbc7ab 100644
--- a/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.cpp
+++ b/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.cpp
@@ -33,11 +33,10 @@
 
 namespace WebCore {
 
-FEConvolveMatrix::FEConvolveMatrix(FilterEffect* in, const IntSize& kernelSize,
+FEConvolveMatrix::FEConvolveMatrix(const IntSize& kernelSize,
     float divisor, float bias, const IntPoint& targetOffset, EdgeModeType edgeMode,
     const FloatPoint& kernelUnitLength, bool preserveAlpha, const Vector<float>& kernelMatrix)
     : FilterEffect()
-    , m_in(in)
     , m_kernelSize(kernelSize)
     , m_divisor(divisor)
     , m_bias(bias)
@@ -49,11 +48,11 @@ FEConvolveMatrix::FEConvolveMatrix(FilterEffect* in, const IntSize& kernelSize,
 {
 }
 
-PassRefPtr<FEConvolveMatrix> FEConvolveMatrix::create(FilterEffect* in, const IntSize& kernelSize,
+PassRefPtr<FEConvolveMatrix> FEConvolveMatrix::create(const IntSize& kernelSize,
     float divisor, float bias, const IntPoint& targetOffset, EdgeModeType edgeMode,
     const FloatPoint& kernelUnitLength, bool preserveAlpha, const Vector<float>& kernelMatrix)
 {
-    return adoptRef(new FEConvolveMatrix(in, kernelSize, divisor, bias, targetOffset, edgeMode, kernelUnitLength,
+    return adoptRef(new FEConvolveMatrix(kernelSize, divisor, bias, targetOffset, edgeMode, kernelUnitLength,
         preserveAlpha, kernelMatrix));
 }
 
@@ -374,21 +373,22 @@ ALWAYS_INLINE void FEConvolveMatrix::setOuterPixels(PaintingData& paintingData,
 
 void FEConvolveMatrix::apply(Filter* filter)
 {
-    m_in->apply(filter);
-    if (!m_in->resultImage())
+    FilterEffect* in = inputEffect(0);
+    in->apply(filter);
+    if (!in->resultImage())
         return;
 
     if (!getEffectContext())
         return;
 
     IntRect imageRect(IntPoint(), resultImage()->size());
-    IntRect effectDrawingRect = calculateDrawingIntRect(m_in->subRegion());
+    IntRect effectDrawingRect = calculateDrawingIntRect(in->filterPrimitiveSubregion());
 
     RefPtr<CanvasPixelArray> srcPixelArray;
     if (m_preserveAlpha)
-        srcPixelArray = m_in->resultImage()->getUnmultipliedImageData(effectDrawingRect)->data();
+        srcPixelArray = in->resultImage()->getUnmultipliedImageData(effectDrawingRect)->data();
     else
-        srcPixelArray = m_in->resultImage()->getPremultipliedImageData(effectDrawingRect)->data();
+        srcPixelArray = in->resultImage()->getPremultipliedImageData(effectDrawingRect)->data();
 
     RefPtr<ImageData> imageData = ImageData::create(imageRect.width(), imageRect.height());
 
@@ -463,7 +463,7 @@ TextStream& FEConvolveMatrix::externalRepresentation(TextStream& ts, int indent)
        << "edgeMode=\"" << m_edgeMode << "\" "
        << "kernelUnitLength=\"" << m_kernelUnitLength << "\" "
        << "preserveAlpha=\"" << m_preserveAlpha << "\"]\n";
-    m_in->externalRepresentation(ts, indent + 1);
+    inputEffect(0)->externalRepresentation(ts, indent + 1);
     return ts;
 }
 
diff --git a/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.h b/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.h
index 662d097..736933c 100644
--- a/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.h
+++ b/WebCore/svg/graphics/filters/SVGFEConvolveMatrix.h
@@ -44,7 +44,7 @@ class CanvasPixelArray;
 
 class FEConvolveMatrix : public FilterEffect {
 public:
-    static PassRefPtr<FEConvolveMatrix> create(FilterEffect*, const IntSize&,
+    static PassRefPtr<FEConvolveMatrix> create(const IntSize&,
             float, float, const IntPoint&, EdgeModeType, const FloatPoint&,
             bool, const Vector<float>&);
 
@@ -72,13 +72,12 @@ public:
     bool preserveAlpha() const;
     void setPreserveAlpha(bool);
 
-    virtual FloatRect uniteChildEffectSubregions(Filter* filter) { return calculateUnionOfChildEffectSubregions(filter, m_in.get()); }
     void apply(Filter*);
     void dump();
     TextStream& externalRepresentation(TextStream&, int indent) const;
 
 private:
-    FEConvolveMatrix(FilterEffect*, const IntSize&, float, float,
+    FEConvolveMatrix(const IntSize&, float, float,
             const IntPoint&, EdgeModeType, const FloatPoint&, bool, const Vector<float>&);
 
     struct PaintingData {
@@ -101,7 +100,6 @@ private:
     ALWAYS_INLINE void setInteriorPixels(PaintingData& paintingData, int clipRight, int clipBottom);
     ALWAYS_INLINE void setOuterPixels(PaintingData& paintingData, int x1, int y1, int x2, int y2);
 
-    RefPtr<FilterEffect> m_in;
     IntSize m_kernelSize;
     float m_divisor;
     float m_bias;
diff --git a/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.cpp b/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.cpp
index 3a008fa..b439c46 100644
--- a/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.cpp
+++ b/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.cpp
@@ -29,17 +29,17 @@
 
 namespace WebCore {
 
-FEDiffuseLighting::FEDiffuseLighting(FilterEffect* in, const Color& lightingColor, float surfaceScale,
+FEDiffuseLighting::FEDiffuseLighting(const Color& lightingColor, float surfaceScale,
     float diffuseConstant, float kernelUnitLengthX, float kernelUnitLengthY, PassRefPtr<LightSource> lightSource)
-    : FELighting(DiffuseLighting, in, lightingColor, surfaceScale, diffuseConstant, 0.0f, 0.0f, kernelUnitLengthX, kernelUnitLengthY, lightSource)
+    : FELighting(DiffuseLighting, lightingColor, surfaceScale, diffuseConstant, 0, 0, kernelUnitLengthX, kernelUnitLengthY, lightSource)
 {
 }
 
-PassRefPtr<FEDiffuseLighting> FEDiffuseLighting::create(FilterEffect* in , const Color& lightingColor,
+PassRefPtr<FEDiffuseLighting> FEDiffuseLighting::create(const Color& lightingColor,
     float surfaceScale, float diffuseConstant, float kernelUnitLengthX,
     float kernelUnitLengthY, PassRefPtr<LightSource> lightSource)
 {
-    return adoptRef(new FEDiffuseLighting(in, lightingColor, surfaceScale, diffuseConstant, kernelUnitLengthX, kernelUnitLengthY, lightSource));
+    return adoptRef(new FEDiffuseLighting(lightingColor, surfaceScale, diffuseConstant, kernelUnitLengthX, kernelUnitLengthY, lightSource));
 }
 
 FEDiffuseLighting::~FEDiffuseLighting()
@@ -118,7 +118,7 @@ TextStream& FEDiffuseLighting::externalRepresentation(TextStream& ts, int indent
     ts << " surfaceScale=\"" << m_surfaceScale << "\" "
        << "diffuseConstant=\"" << m_diffuseConstant << "\" "
        << "kernelUnitLength=\"" << m_kernelUnitLengthX << ", " << m_kernelUnitLengthY << "\"]\n";
-    m_in->externalRepresentation(ts, indent + 1);
+    inputEffect(0)->externalRepresentation(ts, indent + 1);
     return ts;
 }
 
diff --git a/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.h b/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.h
index ee4d5b1..0cdeae3 100644
--- a/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.h
+++ b/WebCore/svg/graphics/filters/SVGFEDiffuseLighting.h
@@ -31,7 +31,7 @@ class LightSource;
 
 class FEDiffuseLighting : public FELighting {
 public:
-    static PassRefPtr<FEDiffuseLighting> create(FilterEffect*, const Color&, float, float,
+    static PassRefPtr<FEDiffuseLighting> create(const Color&, float, float,
         float, float, PassRefPtr<LightSource>);
     virtual ~FEDiffuseLighting();
 
@@ -57,7 +57,7 @@ public:
     TextStream& externalRepresentation(TextStream&, int indent) const;
 
 private:
-    FEDiffuseLighting(FilterEffect*, const Color&, float, float,
+    FEDiffuseLighting(const Color&, float, float,
         float, float, PassRefPtr<LightSource>);
 };
 
diff --git a/WebCore/svg/graphics/filters/SVGFEDisplacementMap.cpp b/WebCore/svg/graphics/filters/SVGFEDisplacementMap.cpp
index 3305f27..9d9857e 100644
--- a/WebCore/svg/graphics/filters/SVGFEDisplacementMap.cpp
+++ b/WebCore/svg/graphics/filters/SVGFEDisplacementMap.cpp
@@ -33,21 +33,18 @@
 
 namespace WebCore {
 
-FEDisplacementMap::FEDisplacementMap(FilterEffect* in, FilterEffect* in2, ChannelSelectorType xChannelSelector,
-    ChannelSelectorType yChannelSelector, const float& scale)
+FEDisplacementMap::FEDisplacementMap(ChannelSelectorType xChannelSelector, ChannelSelectorType yChannelSelector, float scale)
     : FilterEffect()
-    , m_in(in)
-    , m_in2(in2)
     , m_xChannelSelector(xChannelSelector)
     , m_yChannelSelector(yChannelSelector)
     , m_scale(scale)
 {
 }
 
-PassRefPtr<FEDisplacementMap> FEDisplacementMap::create(FilterEffect* in, FilterEffect* in2,
-    ChannelSelectorType xChannelSelector, ChannelSelectorType yChannelSelector, const float& scale)
+PassRefPtr<FEDisplacementMap> FEDisplacementMap::create(ChannelSelectorType xChannelSelector,
+    ChannelSelectorType yChannelSelector, float scale)
 {
-    return adoptRef(new FEDisplacementMap(in, in2, xChannelSelector, yChannelSelector, scale));
+    return adoptRef(new FEDisplacementMap(xChannelSelector, yChannelSelector, scale));
 }
 
 ChannelSelectorType FEDisplacementMap::xChannelSelector() const
@@ -82,9 +79,11 @@ void FEDisplacementMap::setScale(float scale)
 
 void FEDisplacementMap::apply(Filter* filter)
 {
-    m_in->apply(filter);
-    m_in2->apply(filter);
-    if (!m_in->resultImage() || !m_in2->resultImage())
+    FilterEffect* in = inputEffect(0);
+    FilterEffect* in2 = inputEffect(1);
+    in->apply(filter);
+    in2->apply(filter);
+    if (!in->resultImage() || !in2->resultImage())
         return;
 
     if (m_xChannelSelector == CHANNEL_UNKNOWN || m_yChannelSelector == CHANNEL_UNKNOWN)
@@ -93,11 +92,11 @@ void FEDisplacementMap::apply(Filter* filter)
     if (!getEffectContext())
         return;
 
-    IntRect effectADrawingRect = calculateDrawingIntRect(m_in->scaledSubRegion());
-    RefPtr<CanvasPixelArray> srcPixelArrayA(m_in->resultImage()->getPremultipliedImageData(effectADrawingRect)->data());
+    IntRect effectADrawingRect = calculateDrawingIntRect(in->repaintRectInLocalCoordinates());
+    RefPtr<CanvasPixelArray> srcPixelArrayA(in->resultImage()->getPremultipliedImageData(effectADrawingRect)->data());
 
-    IntRect effectBDrawingRect = calculateDrawingIntRect(m_in2->scaledSubRegion());
-    RefPtr<CanvasPixelArray> srcPixelArrayB(m_in2->resultImage()->getUnmultipliedImageData(effectBDrawingRect)->data());
+    IntRect effectBDrawingRect = calculateDrawingIntRect(in2->repaintRectInLocalCoordinates());
+    RefPtr<CanvasPixelArray> srcPixelArrayB(in2->resultImage()->getUnmultipliedImageData(effectBDrawingRect)->data());
 
     IntRect imageRect(IntPoint(), resultImage()->size());
     RefPtr<ImageData> imageData = ImageData::create(imageRect.width(), imageRect.height());
@@ -163,8 +162,8 @@ TextStream& FEDisplacementMap::externalRepresentation(TextStream& ts, int indent
     ts << " scale=\"" << m_scale << "\" "
        << "xChannelSelector=\"" << m_xChannelSelector << "\" "
        << "yChannelSelector=\"" << m_yChannelSelector << "\"]\n";
-    m_in->externalRepresentation(ts, indent + 1);
-    m_in2->externalRepresentation(ts, indent + 1);
+    inputEffect(0)->externalRepresentation(ts, indent + 1);
+    inputEffect(1)->externalRepresentation(ts, indent + 1);
     return ts;
 }
 
diff --git a/WebCore/svg/graphics/filters/SVGFEDisplacementMap.h b/WebCore/svg/graphics/filters/SVGFEDisplacementMap.h
index 7bb9d19..9e17da4 100644
--- a/WebCore/svg/graphics/filters/SVGFEDisplacementMap.h
+++ b/WebCore/svg/graphics/filters/SVGFEDisplacementMap.h
@@ -39,8 +39,7 @@ namespace WebCore {
     
     class FEDisplacementMap : public FilterEffect {
     public:
-        static PassRefPtr<FEDisplacementMap> create(FilterEffect*, FilterEffect*, ChannelSelectorType,
-                ChannelSelectorType, const float&);
+        static PassRefPtr<FEDisplacementMap> create(ChannelSelectorType, ChannelSelectorType, float);
 
         ChannelSelectorType xChannelSelector() const;
         void setXChannelSelector(const ChannelSelectorType);
@@ -51,17 +50,13 @@ namespace WebCore {
         float scale() const;
         void setScale(float scale);
 
-        virtual FloatRect uniteChildEffectSubregions(Filter* filter) { return calculateUnionOfChildEffectSubregions(filter, m_in.get(), m_in2.get()); }
         void apply(Filter*);
         void dump();
         TextStream& externalRepresentation(TextStream&, int indent) const;
 
     private:
-        FEDisplacementMap(FilterEffect*, FilterEffect*, ChannelSelectorType,
-            ChannelSelectorType, const float&);
+        FEDisplacementMap(ChannelSelectorType, ChannelSelectorType, float);
 
-        RefPtr<FilterEffect> m_in;
-        RefPtr<FilterEffect> m_in2;
         ChannelSelectorType m_xChannelSelector;
         ChannelSelectorType m_yChannelSelector;
         float m_scale;
diff --git a/WebCore/svg/graphics/filters/SVGFEFlood.cpp b/WebCore/svg/graphics/filters/SVGFEFlood.cpp
index 5286d80..a2b2cd2 100644
--- a/WebCore/svg/graphics/filters/SVGFEFlood.cpp
+++ b/WebCore/svg/graphics/filters/SVGFEFlood.cpp
@@ -70,7 +70,7 @@ void FEFlood::apply(Filter*)
         return;
 
     Color color = colorWithOverrideAlpha(floodColor().rgb(), floodOpacity());
-    filterContext->fillRect(FloatRect(FloatPoint(), scaledSubRegion().size()), color, DeviceColorSpace);
+    filterContext->fillRect(FloatRect(FloatPoint(), repaintRectInLocalCoordinates().size()), color, DeviceColorSpace);
 }
 
 void FEFlood::dump()
diff --git a/WebCore/svg/graphics/filters/SVGFEImage.cpp b/WebCore/svg/graphics/filters/SVGFEImage.cpp
index b21ceae..a3ac882 100644
--- a/WebCore/svg/graphics/filters/SVGFEImage.cpp
+++ b/WebCore/svg/graphics/filters/SVGFEImage.cpp
@@ -55,7 +55,7 @@ void FEImage::apply(Filter*)
         return;
 
     FloatRect srcRect(FloatPoint(), m_image->size());
-    FloatRect destRect(FloatPoint(), subRegion().size());
+    FloatRect destRect(FloatPoint(), filterPrimitiveSubregion().size());
 
     m_preserveAspectRatio.transformRect(destRect, srcRect);
 
diff --git a/WebCore/svg/graphics/filters/SVGFELighting.cpp b/WebCore/svg/graphics/filters/SVGFELighting.cpp
index 7c3c81c..dc82840 100644
--- a/WebCore/svg/graphics/filters/SVGFELighting.cpp
+++ b/WebCore/svg/graphics/filters/SVGFELighting.cpp
@@ -35,12 +35,11 @@
 
 namespace WebCore {
 
-FELighting::FELighting(LightingType lightingType, FilterEffect* in, const Color& lightingColor, float surfaceScale,
+FELighting::FELighting(LightingType lightingType, const Color& lightingColor, float surfaceScale,
     float diffuseConstant, float specularConstant, float specularExponent,
     float kernelUnitLengthX, float kernelUnitLengthY, PassRefPtr<LightSource> lightSource)
     : FilterEffect()
     , m_lightingType(lightingType)
-    , m_in(in)
     , m_lightSource(lightSource)
     , m_lightingColor(lightingColor)
     , m_surfaceScale(surfaceScale)
@@ -243,8 +242,9 @@ bool FELighting::drawLighting(CanvasPixelArray* pixels, int width, int height)
 
 void FELighting::apply(Filter* filter)
 {
-    m_in->apply(filter);
-    if (!m_in->resultImage())
+    FilterEffect* in = inputEffect(0);
+    in->apply(filter);
+    if (!in->resultImage())
         return;
 
     if (!getEffectContext())
@@ -252,8 +252,8 @@ void FELighting::apply(Filter* filter)
 
     setIsAlphaImage(false);
 
-    IntRect effectDrawingRect = calculateDrawingIntRect(m_in->scaledSubRegion());
-    RefPtr<ImageData> srcImageData(m_in->resultImage()->getUnmultipliedImageData(effectDrawingRect));
+    IntRect effectDrawingRect = calculateDrawingIntRect(in->repaintRectInLocalCoordinates());
+    RefPtr<ImageData> srcImageData(in->resultImage()->getUnmultipliedImageData(effectDrawingRect));
     CanvasPixelArray* srcPixelArray(srcImageData->data());
 
     // FIXME: support kernelUnitLengths other than (1,1). The issue here is that the W3
diff --git a/WebCore/svg/graphics/filters/SVGFELighting.h b/WebCore/svg/graphics/filters/SVGFELighting.h
index 7db50e0..55802ca 100644
--- a/WebCore/svg/graphics/filters/SVGFELighting.h
+++ b/WebCore/svg/graphics/filters/SVGFELighting.h
@@ -42,7 +42,6 @@ class CanvasPixelArray;
 
 class FELighting : public FilterEffect {
 public:
-    virtual FloatRect uniteChildEffectSubregions(Filter* filter) { return calculateUnionOfChildEffectSubregions(filter, m_in.get()); }
     void apply(Filter*);
 
 protected:
@@ -72,15 +71,13 @@ protected:
         ALWAYS_INLINE int downRightPixelValue();
     };
 
-    FELighting(LightingType, FilterEffect*, const Color&, float, float, float,
-        float, float, float, PassRefPtr<LightSource>);
+    FELighting(LightingType, const Color&, float, float, float, float, float, float, PassRefPtr<LightSource>);
 
     bool drawLighting(CanvasPixelArray*, int, int);
     ALWAYS_INLINE void setPixel(LightingData&, LightSource::PaintingData&,
         int lightX, int lightY, float factorX, int normalX, float factorY, int normalY);
 
     LightingType m_lightingType;
-    RefPtr<FilterEffect> m_in;
     RefPtr<LightSource> m_lightSource;
 
     Color m_lightingColor;
diff --git a/WebCore/svg/graphics/filters/SVGFEMerge.cpp b/WebCore/svg/graphics/filters/SVGFEMerge.cpp
index 11c7407..e92ce4c 100644
--- a/WebCore/svg/graphics/filters/SVGFEMerge.cpp
+++ b/WebCore/svg/graphics/filters/SVGFEMerge.cpp
@@ -30,46 +30,24 @@
 
 namespace WebCore {
 
-FEMerge::FEMerge(const Vector<RefPtr<FilterEffect> >& mergeInputs) 
+FEMerge::FEMerge() 
     : FilterEffect()
-    , m_mergeInputs(mergeInputs)
 {
 }
 
-PassRefPtr<FEMerge> FEMerge::create(const Vector<RefPtr<FilterEffect> >& mergeInputs)
+PassRefPtr<FEMerge> FEMerge::create()
 {
-    return adoptRef(new FEMerge(mergeInputs));
-}
-
-const Vector<RefPtr<FilterEffect> >& FEMerge::mergeInputs() const
-{
-    return m_mergeInputs;
-}
-
-void FEMerge::setMergeInputs(const Vector<RefPtr<FilterEffect> >& mergeInputs)
-{
-    m_mergeInputs = mergeInputs;
-}
-
-FloatRect FEMerge::uniteChildEffectSubregions(Filter* filter)
-{
-    ASSERT(!m_mergeInputs.isEmpty());
-
-    FloatRect uniteEffectRect = m_mergeInputs[0]->calculateEffectRect(filter);
-
-    for (unsigned i = 1; i < m_mergeInputs.size(); i++)
-        uniteEffectRect.unite(m_mergeInputs[i]->calculateEffectRect(filter));
-
-    return uniteEffectRect;
+    return adoptRef(new FEMerge);
 }
 
 void FEMerge::apply(Filter* filter)
 {
-    ASSERT(!m_mergeInputs.isEmpty());
-
-    for (unsigned i = 0; i < m_mergeInputs.size(); i++) {
-        m_mergeInputs[i]->apply(filter);
-        if (!m_mergeInputs[i]->resultImage())
+    unsigned size = numberOfEffectInputs();
+    ASSERT(size > 0);
+    for (unsigned i = 0; i < size; ++i) {
+        FilterEffect* in = inputEffect(i);
+        in->apply(filter);
+        if (!in->resultImage())
             return;
     }
 
@@ -77,9 +55,9 @@ void FEMerge::apply(Filter* filter)
     if (!filterContext)
         return;
 
-    for (unsigned i = 0; i < m_mergeInputs.size(); i++) {
-        FloatRect destRect = calculateDrawingRect(m_mergeInputs[i]->scaledSubRegion());
-        filterContext->drawImageBuffer(m_mergeInputs[i]->resultImage(), DeviceColorSpace, destRect);
+    for (unsigned i = 0; i < size; ++i) {
+        FilterEffect* in = inputEffect(i);
+        filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, calculateDrawingRect(in->repaintRectInLocalCoordinates()));
     }
 }
 
@@ -92,12 +70,11 @@ TextStream& FEMerge::externalRepresentation(TextStream& ts, int indent) const
     writeIndent(ts, indent);
     ts << "[feMerge";
     FilterEffect::externalRepresentation(ts);
-    ts << " mergeNodes=\"" << m_mergeInputs.size() << "\"]\n";
-    if (!m_mergeInputs.isEmpty()) {
-        const Vector<RefPtr<FilterEffect> >::const_iterator end = m_mergeInputs.end();
-        for (Vector<RefPtr<FilterEffect> >::const_iterator it = m_mergeInputs.begin(); it != end; ++it)
-            (*it)->externalRepresentation(ts, indent + 1);
-    }
+    unsigned size = numberOfEffectInputs();
+    ASSERT(size > 0);
+    ts << " mergeNodes=\"" << size << "\"]\n";
+    for (unsigned i = 0; i < size; ++i)
+        inputEffect(i)->externalRepresentation(ts, indent + 1);
     return ts;
 }
 
diff --git a/WebCore/svg/graphics/filters/SVGFEMerge.h b/WebCore/svg/graphics/filters/SVGFEMerge.h
index 66decfc..439d789 100644
--- a/WebCore/svg/graphics/filters/SVGFEMerge.h
+++ b/WebCore/svg/graphics/filters/SVGFEMerge.h
@@ -31,20 +31,14 @@ namespace WebCore {
 
     class FEMerge : public FilterEffect {
     public:
-        static PassRefPtr<FEMerge> create(const Vector<RefPtr<FilterEffect> >&);
+        static PassRefPtr<FEMerge> create();
 
-        const Vector<RefPtr<FilterEffect> >& mergeInputs() const;
-        void setMergeInputs(const Vector<RefPtr<FilterEffect> >& mergeInputs);
-
-        virtual FloatRect uniteChildEffectSubregions(Filter*);
         void apply(Filter*);
         void dump();
         TextStream& externalRepresentation(TextStream&, int indent) const;
 
     private:
-        FEMerge(const Vector<RefPtr<FilterEffect> >&);
-
-        Vector<RefPtr<FilterEffect> > m_mergeInputs;
+        FEMerge();
     };
 
 } // namespace WebCore
diff --git a/WebCore/svg/graphics/filters/SVGFEMorphology.cpp b/WebCore/svg/graphics/filters/SVGFEMorphology.cpp
index 3fdf369..6645259 100644
--- a/WebCore/svg/graphics/filters/SVGFEMorphology.cpp
+++ b/WebCore/svg/graphics/filters/SVGFEMorphology.cpp
@@ -37,18 +37,17 @@ using std::max;
 
 namespace WebCore {
 
-FEMorphology::FEMorphology(FilterEffect* in, MorphologyOperatorType type, float radiusX, float radiusY)
+FEMorphology::FEMorphology(MorphologyOperatorType type, float radiusX, float radiusY)
     : FilterEffect()
-    , m_in(in)
     , m_type(type)
     , m_radiusX(radiusX)
     , m_radiusY(radiusY)
 {
 }
 
-PassRefPtr<FEMorphology> FEMorphology::create(FilterEffect* in, MorphologyOperatorType type, float radiusX, float radiusY)
+PassRefPtr<FEMorphology> FEMorphology::create(MorphologyOperatorType type, float radiusX, float radiusY)
 {
-    return adoptRef(new FEMorphology(in, type, radiusX, radiusY));
+    return adoptRef(new FEMorphology(type, radiusX, radiusY));
 }
 
 MorphologyOperatorType FEMorphology::morphologyOperator() const
@@ -83,14 +82,15 @@ void FEMorphology::setRadiusY(float radiusY)
 
 void FEMorphology::apply(Filter* filter)
 {
-    m_in->apply(filter);
-    if (!m_in->resultImage())
+    FilterEffect* in = inputEffect(0);
+    in->apply(filter);
+    if (!in->resultImage())
         return;
-    
+
     if (!getEffectContext())
         return;
 
-    setIsAlphaImage(m_in->isAlphaImage());
+    setIsAlphaImage(in->isAlphaImage());
 
     int radiusX = static_cast<int>(m_radiusX * filter->filterResolution().width());
     int radiusY = static_cast<int>(m_radiusY * filter->filterResolution().height());
@@ -98,8 +98,8 @@ void FEMorphology::apply(Filter* filter)
         return;
 
     IntRect imageRect(IntPoint(), resultImage()->size());
-    IntRect effectDrawingRect = calculateDrawingIntRect(m_in->scaledSubRegion());
-    RefPtr<CanvasPixelArray> srcPixelArray(m_in->resultImage()->getPremultipliedImageData(effectDrawingRect)->data());
+    IntRect effectDrawingRect = calculateDrawingIntRect(in->repaintRectInLocalCoordinates());
+    RefPtr<CanvasPixelArray> srcPixelArray(in->resultImage()->getPremultipliedImageData(effectDrawingRect)->data());
     RefPtr<ImageData> imageData = ImageData::create(imageRect.width(), imageRect.height());
 
     int effectWidth = effectDrawingRect.width() * 4;
@@ -179,8 +179,8 @@ TextStream& FEMorphology::externalRepresentation(TextStream& ts, int indent) con
     ts << "[feMorphology";
     FilterEffect::externalRepresentation(ts);
     ts << " operator=\"" << morphologyOperator() << "\" "
-       << "radius=\"" << radiusX() << ", " << radiusY() << "\"]\n";     
-    m_in->externalRepresentation(ts, indent + 1);
+       << "radius=\"" << radiusX() << ", " << radiusY() << "\"]\n";    
+    inputEffect(0)->externalRepresentation(ts, indent + 1);
     return ts;
 }
 
diff --git a/WebCore/svg/graphics/filters/SVGFEMorphology.h b/WebCore/svg/graphics/filters/SVGFEMorphology.h
index 79f292d..9743d2b 100644
--- a/WebCore/svg/graphics/filters/SVGFEMorphology.h
+++ b/WebCore/svg/graphics/filters/SVGFEMorphology.h
@@ -36,7 +36,7 @@ namespace WebCore {
 
     class FEMorphology : public FilterEffect {
     public:
-        static PassRefPtr<FEMorphology> create(FilterEffect*, MorphologyOperatorType, float radiusX, float radiusY);  
+        static PassRefPtr<FEMorphology> create(MorphologyOperatorType, float radiusX, float radiusY);  
         MorphologyOperatorType morphologyOperator() const;
         void setMorphologyOperator(MorphologyOperatorType);
 
@@ -46,15 +46,13 @@ namespace WebCore {
         float radiusY() const;
         void setRadiusY(float);
 
-        virtual FloatRect uniteChildEffectSubregions(Filter* filter) { return calculateUnionOfChildEffectSubregions(filter, m_in.get()); }
         void apply(Filter*);
         void dump();
         TextStream& externalRepresentation(TextStream&, int indent) const;
 
     private:
-        FEMorphology(FilterEffect*, MorphologyOperatorType, float radiusX, float radiusY);
+        FEMorphology(MorphologyOperatorType, float radiusX, float radiusY);
         
-        RefPtr<FilterEffect> m_in;
         MorphologyOperatorType m_type;
         float m_radiusX;
         float m_radiusY;
diff --git a/WebCore/svg/graphics/filters/SVGFEOffset.cpp b/WebCore/svg/graphics/filters/SVGFEOffset.cpp
index e12b8e0..685bd7b 100644
--- a/WebCore/svg/graphics/filters/SVGFEOffset.cpp
+++ b/WebCore/svg/graphics/filters/SVGFEOffset.cpp
@@ -31,17 +31,16 @@
 
 namespace WebCore {
 
-FEOffset::FEOffset(FilterEffect* in, const float& dx, const float& dy)
+FEOffset::FEOffset(float dx, float dy)
     : FilterEffect()
-    , m_in(in)
     , m_dx(dx)
     , m_dy(dy)
 {
 }
 
-PassRefPtr<FEOffset> FEOffset::create(FilterEffect* in, const float& dx, const float& dy)
+PassRefPtr<FEOffset> FEOffset::create(float dx, float dy)
 {
-    return adoptRef(new FEOffset(in, dx, dy));
+    return adoptRef(new FEOffset(dx, dy));
 }
 
 float FEOffset::dx() const
@@ -66,15 +65,16 @@ void FEOffset::setDy(float dy)
 
 void FEOffset::apply(Filter* filter)
 {
-    m_in->apply(filter);
-    if (!m_in->resultImage())
+    FilterEffect* in = inputEffect(0);
+    in->apply(filter);
+    if (!in->resultImage())
         return;
 
     GraphicsContext* filterContext = getEffectContext();
     if (!filterContext)
         return;
 
-    setIsAlphaImage(m_in->isAlphaImage());
+    setIsAlphaImage(in->isAlphaImage());
 
     FloatRect sourceImageRect = filter->sourceImageRect();
     sourceImageRect.scale(filter->filterResolution().width(), filter->filterResolution().height());
@@ -86,12 +86,12 @@ void FEOffset::apply(Filter* filter)
     m_dx *= filter->filterResolution().width();
     m_dy *= filter->filterResolution().height();
 
-    FloatRect dstRect = FloatRect(m_dx + m_in->scaledSubRegion().x() - scaledSubRegion().x(),
-                                  m_dy + m_in->scaledSubRegion().y() - scaledSubRegion().y(),
-                                  m_in->scaledSubRegion().width(),
-                                  m_in->scaledSubRegion().height());
+    FloatRect dstRect = FloatRect(m_dx + in->repaintRectInLocalCoordinates().x() - repaintRectInLocalCoordinates().x(),
+                                  m_dy + in->repaintRectInLocalCoordinates().y() - repaintRectInLocalCoordinates().y(),
+                                  in->repaintRectInLocalCoordinates().width(),
+                                  in->repaintRectInLocalCoordinates().height());
 
-    filterContext->drawImageBuffer(m_in->resultImage(), DeviceColorSpace, dstRect);
+    filterContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, dstRect);
 }
 
 void FEOffset::dump()
@@ -104,7 +104,7 @@ TextStream& FEOffset::externalRepresentation(TextStream& ts, int indent) const
     ts << "[feOffset"; 
     FilterEffect::externalRepresentation(ts);
     ts << " dx=\"" << dx() << "\" dy=\"" << dy() << "\"]\n";
-    m_in->externalRepresentation(ts, indent + 1);
+    inputEffect(0)->externalRepresentation(ts, indent + 1);
     return ts;
 }
 
diff --git a/WebCore/svg/graphics/filters/SVGFEOffset.h b/WebCore/svg/graphics/filters/SVGFEOffset.h
index ad071d6..34ed97b 100644
--- a/WebCore/svg/graphics/filters/SVGFEOffset.h
+++ b/WebCore/svg/graphics/filters/SVGFEOffset.h
@@ -30,7 +30,7 @@ namespace WebCore {
 
     class FEOffset : public FilterEffect {
     public:
-        static PassRefPtr<FEOffset> create(FilterEffect*, const float&, const float&);
+        static PassRefPtr<FEOffset> create(float, float);
 
         float dx() const;
         void setDx(float);
@@ -38,15 +38,13 @@ namespace WebCore {
         float dy() const;
         void setDy(float);
 
-        virtual FloatRect uniteChildEffectSubregions(Filter* filter) { return calculateUnionOfChildEffectSubregions(filter, m_in.get()); }
         void apply(Filter*);
         void dump();
         TextStream& externalRepresentation(TextStream&, int indent) const;
 
     private:
-        FEOffset(FilterEffect*, const float&, const float&);
+        FEOffset(float, float);
 
-        RefPtr<FilterEffect> m_in;
         float m_dx;
         float m_dy;
     };
diff --git a/WebCore/svg/graphics/filters/SVGFESpecularLighting.cpp b/WebCore/svg/graphics/filters/SVGFESpecularLighting.cpp
index 5c6dc2a..33f7b6c 100644
--- a/WebCore/svg/graphics/filters/SVGFESpecularLighting.cpp
+++ b/WebCore/svg/graphics/filters/SVGFESpecularLighting.cpp
@@ -29,18 +29,18 @@
 
 namespace WebCore {
 
-FESpecularLighting::FESpecularLighting(FilterEffect* in, const Color& lightingColor, float surfaceScale,
+FESpecularLighting::FESpecularLighting(const Color& lightingColor, float surfaceScale,
     float specularConstant, float specularExponent, float kernelUnitLengthX,
     float kernelUnitLengthY, PassRefPtr<LightSource> lightSource)
-    : FELighting(SpecularLighting, in, lightingColor, surfaceScale, 0.0f, specularConstant, specularExponent, kernelUnitLengthX, kernelUnitLengthY, lightSource)
+    : FELighting(SpecularLighting, lightingColor, surfaceScale, 0, specularConstant, specularExponent, kernelUnitLengthX, kernelUnitLengthY, lightSource)
 {
 }
 
-PassRefPtr<FESpecularLighting> FESpecularLighting::create(FilterEffect* in, const Color& lightingColor,
+PassRefPtr<FESpecularLighting> FESpecularLighting::create(const Color& lightingColor,
     float surfaceScale, float specularConstant, float specularExponent,
     float kernelUnitLengthX, float kernelUnitLengthY, PassRefPtr<LightSource> lightSource)
 {
-    return adoptRef(new FESpecularLighting(in, lightingColor, surfaceScale, specularConstant, specularExponent,
+    return adoptRef(new FESpecularLighting(lightingColor, surfaceScale, specularConstant, specularExponent,
         kernelUnitLengthX, kernelUnitLengthY, lightSource));
 }
 
@@ -130,7 +130,7 @@ TextStream& FESpecularLighting::externalRepresentation(TextStream& ts, int inden
     ts << " surfaceScale=\"" << m_surfaceScale << "\" "
        << "specualConstant=\"" << m_specularConstant << "\" "
        << "specularExponent=\"" << m_specularExponent << "\"]\n";
-    m_in->externalRepresentation(ts, indent + 1);
+    inputEffect(0)->externalRepresentation(ts, indent + 1);
     return ts;
 }
 
diff --git a/WebCore/svg/graphics/filters/SVGFESpecularLighting.h b/WebCore/svg/graphics/filters/SVGFESpecularLighting.h
index 3a49c1e..6067a76 100644
--- a/WebCore/svg/graphics/filters/SVGFESpecularLighting.h
+++ b/WebCore/svg/graphics/filters/SVGFESpecularLighting.h
@@ -29,7 +29,7 @@ namespace WebCore {
 
 class FESpecularLighting : public FELighting {
 public:
-    static PassRefPtr<FESpecularLighting> create(FilterEffect*, const Color&, float, float,
+    static PassRefPtr<FESpecularLighting> create(const Color&, float, float,
         float, float, float, PassRefPtr<LightSource>);
     virtual ~FESpecularLighting();
 
@@ -58,8 +58,7 @@ public:
     TextStream& externalRepresentation(TextStream&, int indent) const;
 
 private:
-    FESpecularLighting(FilterEffect*, const Color&, float, float, float,
-        float, float, PassRefPtr<LightSource>);
+    FESpecularLighting(const Color&, float, float, float, float, float, PassRefPtr<LightSource>);
 };
 
 } // namespace WebCore
diff --git a/WebCore/svg/graphics/filters/SVGFETile.cpp b/WebCore/svg/graphics/filters/SVGFETile.cpp
index 56cbc1e..80eb9b3 100644
--- a/WebCore/svg/graphics/filters/SVGFETile.cpp
+++ b/WebCore/svg/graphics/filters/SVGFETile.cpp
@@ -31,40 +31,42 @@
 
 namespace WebCore {
 
-FETile::FETile(FilterEffect* in)
+FETile::FETile()
     : FilterEffect()
-    , m_in(in)
 {
 }
 
-PassRefPtr<FETile> FETile::create(FilterEffect* in)
+PassRefPtr<FETile> FETile::create()
 {
-    return adoptRef(new FETile(in));
+    return adoptRef(new FETile);
 }
 
-FloatRect FETile::uniteChildEffectSubregions(Filter* filter)
+FloatRect FETile::determineFilterPrimitiveSubregion(Filter* filter)
 {
-    m_in->calculateEffectRect(filter);
-    return filter->filterRegion();
+    inputEffect(0)->determineFilterPrimitiveSubregion(filter);
+
+    filter->determineFilterPrimitiveSubregion(this, filter->filterRegion());
+    return filterPrimitiveSubregion();
 }
 
 void FETile::apply(Filter* filter)
 {
-    m_in->apply(filter);
-    if (!m_in->resultImage())
+    FilterEffect* in = inputEffect(0);
+    in->apply(filter);
+    if (!in->resultImage())
         return;
 
     GraphicsContext* filterContext = getEffectContext();
     if (!filterContext)
         return;
 
-    setIsAlphaImage(m_in->isAlphaImage());
+    setIsAlphaImage(in->isAlphaImage());
 
-    IntRect tileRect = enclosingIntRect(m_in->scaledSubRegion());
+    IntRect tileRect = enclosingIntRect(in->repaintRectInLocalCoordinates());
 
     // Source input needs more attention. It has the size of the filterRegion but gives the
     // size of the cutted sourceImage back. This is part of the specification and optimization.
-    if (m_in->isSourceInput()) {
+    if (in->isSourceInput()) {
         FloatRect filterRegion = filter->filterRegion();
         filterRegion.scale(filter->filterResolution().width(), filter->filterResolution().height());
         tileRect = enclosingIntRect(filterRegion);
@@ -72,15 +74,16 @@ void FETile::apply(Filter* filter)
 
     OwnPtr<ImageBuffer> tileImage = ImageBuffer::create(tileRect.size());
     GraphicsContext* tileImageContext = tileImage->context();
-    tileImageContext->drawImageBuffer(m_in->resultImage(), DeviceColorSpace, IntPoint());
+    tileImageContext->drawImageBuffer(in->resultImage(), DeviceColorSpace, IntPoint());
     RefPtr<Pattern> pattern = Pattern::create(tileImage->copyImage(), true, true);
 
     AffineTransform matrix;
-    matrix.translate(m_in->scaledSubRegion().x() - scaledSubRegion().x(), m_in->scaledSubRegion().y() - scaledSubRegion().y());
+    matrix.translate(in->repaintRectInLocalCoordinates().x() - repaintRectInLocalCoordinates().x(),
+                     in->repaintRectInLocalCoordinates().y() - repaintRectInLocalCoordinates().y());
     pattern.get()->setPatternSpaceTransform(matrix);
 
     filterContext->setFillPattern(pattern);
-    filterContext->fillRect(FloatRect(FloatPoint(), scaledSubRegion().size()));
+    filterContext->fillRect(FloatRect(FloatPoint(), repaintRectInLocalCoordinates().size()));
 }
 
 void FETile::dump()
@@ -93,7 +96,7 @@ TextStream& FETile::externalRepresentation(TextStream& ts, int indent) const
     ts << "[feTile";
     FilterEffect::externalRepresentation(ts);
     ts << "]\n";
-    m_in->externalRepresentation(ts, indent + 1);
+    inputEffect(0)->externalRepresentation(ts, indent + 1);
 
     return ts;
 }
diff --git a/WebCore/svg/graphics/filters/SVGFETile.h b/WebCore/svg/graphics/filters/SVGFETile.h
index 7af9c13..128c9cb 100644
--- a/WebCore/svg/graphics/filters/SVGFETile.h
+++ b/WebCore/svg/graphics/filters/SVGFETile.h
@@ -30,17 +30,16 @@ namespace WebCore {
     
     class FETile : public FilterEffect {
     public:
-        static PassRefPtr<FETile> create(FilterEffect*);
+        static PassRefPtr<FETile> create();
 
-        virtual FloatRect uniteChildEffectSubregions(Filter*);
         void apply(Filter*);
         void dump();
         TextStream& externalRepresentation(TextStream&, int indent) const;
+
+        virtual FloatRect determineFilterPrimitiveSubregion(Filter*);
         
     private:
-        FETile(FilterEffect*);
-        
-        RefPtr<FilterEffect> m_in;
+        FETile();
     };
 
 } // namespace WebCore
diff --git a/WebCore/svg/graphics/filters/SVGFilter.cpp b/WebCore/svg/graphics/filters/SVGFilter.cpp
index 947dbed..d72dc3d 100644
--- a/WebCore/svg/graphics/filters/SVGFilter.cpp
+++ b/WebCore/svg/graphics/filters/SVGFilter.cpp
@@ -24,60 +24,64 @@
 
 namespace WebCore {
 
-SVGFilter::SVGFilter(const FloatRect& itemBox, const FloatRect& filterRect, bool effectBBoxMode)
+SVGFilter::SVGFilter(const FloatRect& targetBoundingBox, const FloatRect& filterRect, bool effectBBoxMode)
     : Filter()
-    , m_itemBox(itemBox)
+    , m_targetBoundingBox(targetBoundingBox)
     , m_filterRect(filterRect)
     , m_effectBBoxMode(effectBBoxMode)
 {
 }
 
-void SVGFilter::calculateEffectSubRegion(FilterEffect* effect)
+void SVGFilter::determineFilterPrimitiveSubregion(FilterEffect* effect, const FloatRect& unionOfPreviousPrimitiveSubregions)
 {
     FloatRect subRegionBBox = effect->effectBoundaries();
-    FloatRect useBBox = effect->unionOfChildEffectSubregions();
     FloatRect newSubRegion = subRegionBBox;
 
     if (m_effectBBoxMode) {
-        newSubRegion = useBBox;
+        newSubRegion = unionOfPreviousPrimitiveSubregions;
 
         if (effect->hasX())
-            newSubRegion.setX(m_itemBox.x() + subRegionBBox.x() * m_itemBox.width());
+            newSubRegion.setX(m_targetBoundingBox.x() + subRegionBBox.x() * m_targetBoundingBox.width());
 
-        if (effect->hasY())
-            newSubRegion.setY(m_itemBox.y() + subRegionBBox.y() * m_itemBox.height());
+       if (effect->hasY())
+            newSubRegion.setY(m_targetBoundingBox.y() + subRegionBBox.y() * m_targetBoundingBox.height());
 
         if (effect->hasWidth())
-            newSubRegion.setWidth(subRegionBBox.width() * m_itemBox.width());
+            newSubRegion.setWidth(subRegionBBox.width() * m_targetBoundingBox.width());
 
         if (effect->hasHeight())
-            newSubRegion.setHeight(subRegionBBox.height() * m_itemBox.height());
+            newSubRegion.setHeight(subRegionBBox.height() * m_targetBoundingBox.height());
     } else {
         if (!effect->hasX())
-            newSubRegion.setX(useBBox.x());
+            newSubRegion.setX(unionOfPreviousPrimitiveSubregions.x());
 
         if (!effect->hasY())
-            newSubRegion.setY(useBBox.y());
+            newSubRegion.setY(unionOfPreviousPrimitiveSubregions.y());
 
         if (!effect->hasWidth())
-            newSubRegion.setWidth(useBBox.width());
+            newSubRegion.setWidth(unionOfPreviousPrimitiveSubregions.width());
 
         if (!effect->hasHeight())
-            newSubRegion.setHeight(useBBox.height());
+            newSubRegion.setHeight(unionOfPreviousPrimitiveSubregions.height());
     }
 
     // clip every filter effect to the filter region
     newSubRegion.intersect(m_filterRect);
 
-    effect->setSubRegion(newSubRegion);
+    effect->setFilterPrimitiveSubregion(newSubRegion);
+    
+    // TODO: Everything above should be moved to a first phase of layout in RenderSVGResourceFilterPrimitive.
+    // The scaling of the subregion to the repaint rect should be merged with a more intelligent repaint logic
+    // and moved to the second phase of layout in RenderSVGResourceFilterPrimitive.
+    // See bug https://bugs.webkit.org/show_bug.cgi?id=45614.
     newSubRegion.scale(filterResolution().width(), filterResolution().height());
-    effect->setScaledSubRegion(newSubRegion);
+    effect->setRepaintRectInLocalCoordinates(newSubRegion);
     m_maxImageSize = m_maxImageSize.expandedTo(newSubRegion.size()); 
 }
 
-PassRefPtr<SVGFilter> SVGFilter::create(const FloatRect& itemBox, const FloatRect& filterRect, bool effectBBoxMode)
+PassRefPtr<SVGFilter> SVGFilter::create(const FloatRect& targetBoundingBox, const FloatRect& filterRect, bool effectBBoxMode)
 {
-    return adoptRef(new SVGFilter(itemBox, filterRect, effectBBoxMode));
+    return adoptRef(new SVGFilter(targetBoundingBox, filterRect, effectBBoxMode));
 }
 
 } // namespace WebCore
diff --git a/WebCore/svg/graphics/filters/SVGFilter.h b/WebCore/svg/graphics/filters/SVGFilter.h
index 1ee5e8a..631f1ee 100644
--- a/WebCore/svg/graphics/filters/SVGFilter.h
+++ b/WebCore/svg/graphics/filters/SVGFilter.h
@@ -39,16 +39,17 @@ namespace WebCore {
         virtual bool effectBoundingBoxMode() const { return m_effectBBoxMode; }
 
         virtual FloatRect filterRegion() const { return m_filterRect; }
-        virtual FloatRect sourceImageRect() const { return m_itemBox; }
+        
+        virtual FloatRect sourceImageRect() const { return m_targetBoundingBox; }
 
         virtual FloatSize maxImageSize() const { return m_maxImageSize; }
-        virtual void calculateEffectSubRegion(FilterEffect*);
+        virtual void determineFilterPrimitiveSubregion(FilterEffect*, const FloatRect&);
 
     private:
-        SVGFilter(const FloatRect& itemBox, const FloatRect& filterRect, bool effectBBoxMode);
+        SVGFilter(const FloatRect& targetBoundingBox, const FloatRect& filterRect, bool effectBBoxMode);
 
         FloatSize m_maxImageSize;
-        FloatRect m_itemBox;
+        FloatRect m_targetBoundingBox;
         FloatRect m_filterRect;
         bool m_effectBBoxMode;
     };

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list