Diff
Modified: trunk/Source/WebCore/ChangeLog (287891 => 287892)
--- trunk/Source/WebCore/ChangeLog 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/ChangeLog 2022-01-11 20:30:16 UTC (rev 287892)
@@ -1,3 +1,146 @@
+2022-01-11 Said Abou-Hallawa <s...@apple.com>
+
+ [GPU Process] Remove the dependency from FilterEffect to its inputs
+ https://bugs.webkit.org/show_bug.cgi?id=232841
+ rdar://85425930
+
+ Reviewed by Darin Adler.
+
+ This is the last clean-up in the FilterEffect code. It will make the
+ FilterEffect objects in the GPUProcess resemble exactly their counterpart
+ ones in the WebProcess from now on.
+
+ For CSSFilter, we do not need to set the input effects because every
+ FilterFunction is the input of its successor. Passing the previous result
+ FilterImage to the apply() method of the current FilterFunction is enough
+ to get the filter applied correctly.
+
+ For SVGFilter, we need the filter effect inputs only when building the
+ SVGFilterExpression. So we can build a HashMap in SVGFilterBuilder which
+ maps a FilterEffect to its input FilterEffectVector. To make the change
+ clearer, the SVGFExxxElement classes will implement two methods:
+ 1. filterEffectInputsNames() which returns the names of the input FilterEffects.
+ 2. filterEffect() which returns the FilterEffect representing this element.
+ SVGFilterBuilder::buildFilterEffects() converts the names to FilterEffects.
+
+ No need to initialize the SourceGraphic of the referenced SVGFilter with
+ the FilterEffect of its previous FilterFunction. The referenced SVGFilter
+ will create its own native SourceGraphic. This SourceGraphic will copy
+ the input FilterImage to the result FilterImage.
+
+ * platform/graphics/filters/FilterEffect.cpp:
+ (WebCore::FilterEffect::inputEffect const): Deleted.
+ * platform/graphics/filters/FilterEffect.h:
+ (WebCore::FilterEffect::inputEffects): Deleted.
+ * platform/graphics/filters/SourceAlpha.cpp:
+ (WebCore::SourceAlpha::create):
+ (WebCore::SourceAlpha::SourceAlpha):
+ * platform/graphics/filters/SourceAlpha.h:
+ * rendering/CSSFilter.cpp:
+ (WebCore::createSVGFilter):
+ (WebCore::CSSFilter::buildFilterFunctions):
+ * rendering/svg/RenderSVGResourceFilter.cpp:
+ (WebCore::RenderSVGResourceFilter::applyResource):
+ * rendering/svg/SVGRenderTreeAsText.cpp:
+ (WebCore::writeSVGResourceContainer):
+ * svg/SVGFEBlendElement.cpp:
+ (WebCore::SVGFEBlendElement::filterEffect const):
+ (WebCore::SVGFEBlendElement::build const): Deleted.
+ * svg/SVGFEBlendElement.h:
+ * svg/SVGFEColorMatrixElement.cpp:
+ (WebCore::SVGFEColorMatrixElement::filterEffect const):
+ (WebCore::SVGFEColorMatrixElement::build const): Deleted.
+ * svg/SVGFEColorMatrixElement.h:
+ * svg/SVGFEComponentTransferElement.cpp:
+ (WebCore::SVGFEComponentTransferElement::filterEffect const):
+ (WebCore::SVGFEComponentTransferElement::build const): Deleted.
+ * svg/SVGFEComponentTransferElement.h:
+ * svg/SVGFECompositeElement.cpp:
+ (WebCore::SVGFECompositeElement::filterEffect const):
+ (WebCore::SVGFECompositeElement::build const): Deleted.
+ * svg/SVGFECompositeElement.h:
+ * svg/SVGFEConvolveMatrixElement.cpp:
+ (WebCore::SVGFEConvolveMatrixElement::filterEffect const):
+ (WebCore::SVGFEConvolveMatrixElement::build const): Deleted.
+ * svg/SVGFEConvolveMatrixElement.h:
+ * svg/SVGFEDiffuseLightingElement.cpp:
+ (WebCore::SVGFEDiffuseLightingElement::filterEffect const):
+ (WebCore::SVGFEDiffuseLightingElement::build const): Deleted.
+ * svg/SVGFEDiffuseLightingElement.h:
+ * svg/SVGFEDisplacementMapElement.cpp:
+ (WebCore::SVGFEDisplacementMapElement::filterEffect const):
+ (WebCore::SVGFEDisplacementMapElement::build const): Deleted.
+ * svg/SVGFEDisplacementMapElement.h:
+ * svg/SVGFEDistantLightElement.cpp:
+ (WebCore::SVGFEDistantLightElement::lightSource const):
+ * svg/SVGFEDistantLightElement.h:
+ * svg/SVGFEDropShadowElement.cpp:
+ (WebCore::SVGFEDropShadowElement::filterEffect const):
+ (WebCore::SVGFEDropShadowElement::build const): Deleted.
+ * svg/SVGFEDropShadowElement.h:
+ * svg/SVGFEFloodElement.cpp:
+ (WebCore::SVGFEFloodElement::filterEffect const):
+ (WebCore::SVGFEFloodElement::build const): Deleted.
+ * svg/SVGFEFloodElement.h:
+ * svg/SVGFEGaussianBlurElement.cpp:
+ (WebCore::SVGFEGaussianBlurElement::filterEffect const):
+ (WebCore::SVGFEGaussianBlurElement::build const): Deleted.
+ * svg/SVGFEGaussianBlurElement.h:
+ * svg/SVGFEImageElement.cpp:
+ (WebCore::SVGFEImageElement::filterEffect const):
+ (WebCore::SVGFEImageElement::build const): Deleted.
+ * svg/SVGFEImageElement.h:
+ * svg/SVGFELightElement.h:
+ * svg/SVGFEMergeElement.cpp:
+ (WebCore::SVGFEMergeElement::filterEffectInputsNames const):
+ (WebCore::SVGFEMergeElement::filterEffect const):
+ (WebCore::SVGFEMergeElement::build const): Deleted.
+ * svg/SVGFEMergeElement.h:
+ * svg/SVGFEMorphologyElement.cpp:
+ (WebCore::SVGFEMorphologyElement::filterEffect const):
+ (WebCore::SVGFEMorphologyElement::build const): Deleted.
+ * svg/SVGFEMorphologyElement.h:
+ * svg/SVGFEOffsetElement.cpp:
+ (WebCore::SVGFEOffsetElement::filterEffect const):
+ (WebCore::SVGFEOffsetElement::build const): Deleted.
+ * svg/SVGFEOffsetElement.h:
+ * svg/SVGFEPointLightElement.cpp:
+ (WebCore::SVGFEPointLightElement::lightSource const):
+ * svg/SVGFEPointLightElement.h:
+ * svg/SVGFESpecularLightingElement.cpp:
+ (WebCore::SVGFESpecularLightingElement::filterEffect const):
+ (WebCore::SVGFESpecularLightingElement::build const): Deleted.
+ * svg/SVGFESpecularLightingElement.h:
+ * svg/SVGFESpotLightElement.cpp:
+ (WebCore::SVGFESpotLightElement::lightSource const):
+ * svg/SVGFESpotLightElement.h:
+ * svg/SVGFETileElement.cpp:
+ (WebCore::SVGFETileElement::filterEffect const):
+ (WebCore::SVGFETileElement::build const): Deleted.
+ * svg/SVGFETileElement.h:
+ * svg/SVGFETurbulenceElement.cpp:
+ (WebCore::SVGFETurbulenceElement::filterEffect const):
+ (WebCore::SVGFETurbulenceElement::build const): Deleted.
+ * svg/SVGFETurbulenceElement.h:
+ * svg/SVGFilterPrimitiveStandardAttributes.h:
+ (WebCore::SVGFilterPrimitiveStandardAttributes::filterEffectInputsNames const):
+ * svg/graphics/filters/SVGFilter.cpp:
+ (WebCore::SVGFilter::create):
+ * svg/graphics/filters/SVGFilter.h:
+ * svg/graphics/filters/SVGFilterBuilder.cpp:
+ (WebCore::SVGFilterBuilder::setupBuiltinEffects):
+ (WebCore::SVGFilterBuilder::buildFilterEffects):
+ (WebCore::SVGFilterBuilder::sourceGraphic const):
+ (WebCore::SVGFilterBuilder::sourceAlpha const):
+ (WebCore::SVGFilterBuilder::addNamedEffect):
+ (WebCore::SVGFilterBuilder::namedEffect const):
+ (WebCore::SVGFilterBuilder::namedEffects const):
+ (WebCore::SVGFilterBuilder::setEffectInputs):
+ (WebCore::SVGFilterBuilder::buildEffectExpression const):
+ (WebCore::SVGFilterBuilder::add): Deleted.
+ (WebCore::SVGFilterBuilder::getEffectById const): Deleted.
+ * svg/graphics/filters/SVGFilterBuilder.h:
+
2022-01-11 Sam Weinig <wei...@apple.com>
Use the new template ColorSpaceCG helpers to cleanup some code
Modified: trunk/Source/WebCore/platform/graphics/filters/FilterEffect.cpp (287891 => 287892)
--- trunk/Source/WebCore/platform/graphics/filters/FilterEffect.cpp 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/platform/graphics/filters/FilterEffect.cpp 2022-01-11 20:30:16 UTC (rev 287892)
@@ -149,12 +149,6 @@
return result;
}
-FilterEffect& FilterEffect::inputEffect(unsigned number) const
-{
- ASSERT_WITH_SECURITY_IMPLICATION(number < m_inputEffects.size());
- return m_inputEffects.at(number);
-}
-
TextStream& FilterEffect::externalRepresentation(TextStream& ts, FilterRepresentation representation) const
{
// FIXME: We should dump the subRegions of the filter primitives here later. This isn't
Modified: trunk/Source/WebCore/platform/graphics/filters/FilterEffect.h (287891 => 287892)
--- trunk/Source/WebCore/platform/graphics/filters/FilterEffect.h 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/platform/graphics/filters/FilterEffect.h 2022-01-11 20:30:16 UTC (rev 287892)
@@ -23,11 +23,8 @@
#pragma once
#include "DestinationColorSpace.h"
-#include "FilterEffectVector.h"
#include "FilterFunction.h"
-#include "FilterImage.h"
#include "FilterImageVector.h"
-#include <wtf/Vector.h>
namespace WTF {
class TextStream;
@@ -38,21 +35,18 @@
class Filter;
class FilterEffectApplier;
class FilterEffectGeometry;
+class FilterResults;
class FilterEffect : public FilterFunction {
using FilterFunction::apply;
public:
+ const DestinationColorSpace& operatingColorSpace() const { return m_operatingColorSpace; }
+ virtual void setOperatingColorSpace(const DestinationColorSpace& colorSpace) { m_operatingColorSpace = colorSpace; }
+
FilterImageVector takeImageInputs(FilterImageVector& stack) const;
-
- FilterEffectVector& inputEffects() { return m_inputEffects; }
- FilterEffect& inputEffect(unsigned) const;
-
RefPtr<FilterImage> apply(const Filter&, const FilterImageVector& inputs, FilterResults&, const std::optional<FilterEffectGeometry>& = std::nullopt);
- const DestinationColorSpace& operatingColorSpace() const { return m_operatingColorSpace; }
- virtual void setOperatingColorSpace(const DestinationColorSpace& colorSpace) { m_operatingColorSpace = colorSpace; }
-
WTF::TextStream& externalRepresentation(WTF::TextStream&, FilterRepresentation) const override;
protected:
@@ -80,8 +74,6 @@
RefPtr<FilterImage> apply(const Filter&, FilterImage& input, FilterResults&) override;
- FilterEffectVector m_inputEffects;
-
DestinationColorSpace m_operatingColorSpace { DestinationColorSpace::SRGB() };
};
Modified: trunk/Source/WebCore/platform/graphics/filters/SourceAlpha.cpp (287891 => 287892)
--- trunk/Source/WebCore/platform/graphics/filters/SourceAlpha.cpp 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/platform/graphics/filters/SourceAlpha.cpp 2022-01-11 20:30:16 UTC (rev 287892)
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2009 Dirk Schulze <k...@webkit.org>
- * Copyright (C) 2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2021-2022 Apple Inc. 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
@@ -21,34 +21,22 @@
#include "config.h"
#include "SourceAlpha.h"
-#include "ImageBuffer.h"
#include "SourceAlphaSoftwareApplier.h"
#include <wtf/text/TextStream.h>
namespace WebCore {
-Ref<SourceAlpha> SourceAlpha::create()
+Ref<SourceAlpha> SourceAlpha::create(const DestinationColorSpace& colorSpace)
{
- return adoptRef(*new SourceAlpha());
+ return adoptRef(*new SourceAlpha(colorSpace));
}
-Ref<SourceAlpha> SourceAlpha::create(FilterEffect& sourceEffect)
-{
- return adoptRef(*new SourceAlpha(sourceEffect));
-}
-
-SourceAlpha::SourceAlpha()
+SourceAlpha::SourceAlpha(const DestinationColorSpace& colorSpace)
: FilterEffect(FilterEffect::Type::SourceAlpha)
{
+ setOperatingColorSpace(colorSpace);
}
-SourceAlpha::SourceAlpha(FilterEffect& sourceEffect)
- : FilterEffect(FilterEffect::Type::SourceAlpha)
-{
- setOperatingColorSpace(sourceEffect.operatingColorSpace());
- inputEffects().append(sourceEffect);
-}
-
std::unique_ptr<FilterEffectApplier> SourceAlpha::createApplier(const Filter&) const
{
return FilterEffectApplier::create<SourceAlphaSoftwareApplier>(*this);
Modified: trunk/Source/WebCore/platform/graphics/filters/SourceAlpha.h (287891 => 287892)
--- trunk/Source/WebCore/platform/graphics/filters/SourceAlpha.h 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/platform/graphics/filters/SourceAlpha.h 2022-01-11 20:30:16 UTC (rev 287892)
@@ -26,14 +26,12 @@
class SourceAlpha : public FilterEffect {
public:
- WEBCORE_EXPORT static Ref<SourceAlpha> create();
- static Ref<SourceAlpha> create(FilterEffect&);
+ WEBCORE_EXPORT static Ref<SourceAlpha> create(const DestinationColorSpace& = DestinationColorSpace::SRGB());
static AtomString effectName() { return FilterEffect::sourceAlphaName(); }
private:
- SourceAlpha();
- explicit SourceAlpha(FilterEffect&);
+ explicit SourceAlpha(const DestinationColorSpace&);
std::unique_ptr<FilterEffectApplier> createApplier(const Filter&) const override;
Modified: trunk/Source/WebCore/rendering/CSSFilter.cpp (287891 => 287892)
--- trunk/Source/WebCore/rendering/CSSFilter.cpp 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/rendering/CSSFilter.cpp 2022-01-11 20:30:16 UTC (rev 287892)
@@ -218,7 +218,7 @@
return FEColorMatrix::create(FECOLORMATRIX_TYPE_MATRIX, WTFMove(inputParameters));
}
-static RefPtr<SVGFilter> createSVGFilter(CSSFilter& filter, const ReferenceFilterOperation& filterOperation, RenderElement& renderer, const FloatRect& targetBoundingBox, FilterEffect& previousEffect)
+static RefPtr<SVGFilter> createSVGFilter(CSSFilter& filter, const ReferenceFilterOperation& filterOperation, RenderElement& renderer, const FloatRect& targetBoundingBox)
{
auto& referencedSVGResources = renderer.ensureReferencedSVGResources();
auto* filterElement = referencedSVGResources.referencedFilterElement(renderer.document(), filterOperation);
@@ -232,7 +232,7 @@
}
SVGFilterBuilder builder;
- return SVGFilter::create(*filterElement, builder, filter.renderingMode(), filter.filterScale(), filter.clipOperation(), targetBoundingBox, previousEffect);
+ return SVGFilter::create(*filterElement, builder, filter.renderingMode(), filter.filterScale(), filter.clipOperation(), targetBoundingBox, targetBoundingBox);
}
bool CSSFilter::buildFilterFunctions(RenderElement& renderer, const FilterOperations& operations, const FloatRect& targetBoundingBox)
@@ -240,7 +240,6 @@
m_functions.clear();
m_outsets = { };
- RefPtr<FilterEffect> previousEffect = SourceGraphic::create();
RefPtr<SVGFilter> filter;
for (auto& operation : operations.operations()) {
@@ -292,7 +291,7 @@
break;
case FilterOperation::REFERENCE:
- filter = createSVGFilter(*this, downcast<ReferenceFilterOperation>(*operation), renderer, targetBoundingBox, *previousEffect);
+ filter = createSVGFilter(*this, downcast<ReferenceFilterOperation>(*operation), renderer, targetBoundingBox);
effect = nullptr;
break;
@@ -300,24 +299,19 @@
break;
}
- if ((filter || effect) && m_functions.isEmpty()) {
- ASSERT(previousEffect->filterType() == FilterEffect::Type::SourceGraphic);
- m_functions.append({ *previousEffect });
- }
+ if ((filter || effect) && m_functions.isEmpty())
+ m_functions.append(SourceGraphic::create());
if (filter) {
effect = filter->lastEffect();
effect->setOperatingColorSpace(DestinationColorSpace::SRGB());
m_functions.append(filter.releaseNonNull());
- previousEffect = WTFMove(effect);
continue;
}
if (effect) {
effect->setOperatingColorSpace(DestinationColorSpace::SRGB());
- effect->inputEffects() = { previousEffect.releaseNonNull() };
- m_functions.append({ *effect });
- previousEffect = WTFMove(effect);
+ m_functions.append(effect.releaseNonNull());
}
}
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp (287891 => 287892)
--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp 2022-01-11 20:30:16 UTC (rev 287892)
@@ -129,7 +129,7 @@
// Create the SVGFilter object.
filterData->builder = makeUnique<SVGFilterBuilder>();
- filterData->filter = SVGFilter::create(filterElement(), *filterData->builder, renderingMode, filterScale, filterData->boundaries, targetBoundingBox);
+ filterData->filter = SVGFilter::create(filterElement(), *filterData->builder, renderingMode, filterScale, Filter::ClipOperation::Intersect, filterData->boundaries, targetBoundingBox);
if (!filterData->filter) {
m_rendererFilterDataMap.remove(&renderer);
return false;
Modified: trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp (287891 => 287892)
--- trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp 2022-01-11 20:30:16 UTC (rev 287892)
@@ -474,7 +474,7 @@
FloatRect dummyRect;
FloatSize dummyScale(1, 1);
SVGFilterBuilder builder;
- auto dummyFilter = SVGFilter::create(filter.filterElement(), builder, RenderingMode::Unaccelerated, dummyScale, dummyRect, dummyRect);
+ auto dummyFilter = SVGFilter::create(filter.filterElement(), builder, RenderingMode::Unaccelerated, dummyScale, Filter::ClipOperation::Intersect, dummyRect, dummyRect);
if (dummyFilter) {
TextStream::IndentScope indentScope(ts);
dummyFilter->externalRepresentation(ts, FilterRepresentation::TestOutput);
Modified: trunk/Source/WebCore/svg/SVGFEBlendElement.cpp (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFEBlendElement.cpp 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFEBlendElement.cpp 2022-01-11 20:30:16 UTC (rev 287892)
@@ -2,7 +2,7 @@
* Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmerm...@kde.org>
* Copyright (C) 2004, 2005, 2006 Rob Buis <b...@kde.org>
* Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved.
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2022 Apple Inc. 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
@@ -24,8 +24,6 @@
#include "SVGFEBlendElement.h"
#include "FEBlend.h"
-#include "FilterEffect.h"
-#include "SVGFilterBuilder.h"
#include "SVGNames.h"
#include <wtf/IsoMallocInlines.h>
@@ -100,17 +98,9 @@
SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName);
}
-RefPtr<FilterEffect> SVGFEBlendElement::build(SVGFilterBuilder& filterBuilder) const
+RefPtr<FilterEffect> SVGFEBlendElement::filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const
{
- auto input1 = filterBuilder.getEffectById(in1());
- auto input2 = filterBuilder.getEffectById(in2());
-
- if (!input1 || !input2)
- return nullptr;
-
- auto effect = FEBlend::create(mode());
- effect->inputEffects() = { input1.releaseNonNull(), input2.releaseNonNull() };
- return effect;
+ return FEBlend::create(mode());
}
-}
+} // namespace WebCore
Modified: trunk/Source/WebCore/svg/SVGFEBlendElement.h (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFEBlendElement.h 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFEBlendElement.h 2022-01-11 20:30:16 UTC (rev 287892)
@@ -2,7 +2,7 @@
* Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmerm...@kde.org>
* Copyright (C) 2004, 2005, 2006 Rob Buis <b...@kde.org>
* Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved.
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2022 Apple Inc. 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
@@ -69,8 +69,9 @@
void parseAttribute(const QualifiedName&, const AtomString&) override;
void svgAttributeChanged(const QualifiedName&) override;
- RefPtr<FilterEffect> build(SVGFilterBuilder&) const override;
bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName) override;
+ Vector<AtomString> filterEffectInputsNames() const override { return { in1(), in2() }; }
+ RefPtr<FilterEffect> filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const override;
PropertyRegistry m_propertyRegistry { *this };
Ref<SVGAnimatedString> m_in1 { SVGAnimatedString::create(this) };
Modified: trunk/Source/WebCore/svg/SVGFEColorMatrixElement.cpp (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFEColorMatrixElement.cpp 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFEColorMatrixElement.cpp 2022-01-11 20:30:16 UTC (rev 287892)
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmerm...@kde.org>
* Copyright (C) 2004, 2005, 2006 Rob Buis <b...@kde.org>
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2022 Apple Inc. 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
@@ -22,8 +22,7 @@
#include "config.h"
#include "SVGFEColorMatrixElement.h"
-#include "FilterEffect.h"
-#include "SVGFilterBuilder.h"
+#include "FEColorMatrix.h"
#include "SVGNames.h"
#include <wtf/IsoMallocInlines.h>
@@ -100,13 +99,8 @@
SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName);
}
-RefPtr<FilterEffect> SVGFEColorMatrixElement::build(SVGFilterBuilder& filterBuilder) const
+RefPtr<FilterEffect> SVGFEColorMatrixElement::filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const
{
- auto input1 = filterBuilder.getEffectById(in1());
-
- if (!input1)
- return nullptr;
-
Vector<float> filterValues;
ColorMatrixType filterType = type();
@@ -136,14 +130,12 @@
|| (filterType == FECOLORMATRIX_TYPE_HUEROTATE && size != 1)
|| (filterType == FECOLORMATRIX_TYPE_SATURATE && size != 1))
return nullptr;
-
+
filterValues = values();
filterValues.shrinkToFit();
}
- auto effect = FEColorMatrix::create(filterType, WTFMove(filterValues));
- effect->inputEffects() = { input1.releaseNonNull() };
- return effect;
+ return FEColorMatrix::create(filterType, WTFMove(filterValues));
}
} // namespace WebCore
Modified: trunk/Source/WebCore/svg/SVGFEColorMatrixElement.h (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFEColorMatrixElement.h 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFEColorMatrixElement.h 2022-01-11 20:30:16 UTC (rev 287892)
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmerm...@kde.org>
* Copyright (C) 2004, 2005, 2006 Rob Buis <b...@kde.org>
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2022 Apple Inc. 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
@@ -86,7 +86,8 @@
void svgAttributeChanged(const QualifiedName&) override;
bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override;
- RefPtr<FilterEffect> build(SVGFilterBuilder&) const override;
+ Vector<AtomString> filterEffectInputsNames() const override { return { in1() }; }
+ RefPtr<FilterEffect> filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const override;
PropertyRegistry m_propertyRegistry { *this };
Ref<SVGAnimatedString> m_in1 { SVGAnimatedString::create(this) };
Modified: trunk/Source/WebCore/svg/SVGFEComponentTransferElement.cpp (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFEComponentTransferElement.cpp 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFEComponentTransferElement.cpp 2022-01-11 20:30:16 UTC (rev 287892)
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmerm...@kde.org>
* Copyright (C) 2004, 2005 Rob Buis <b...@kde.org>
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2022 Apple Inc. 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
@@ -23,13 +23,12 @@
#include "SVGFEComponentTransferElement.h"
#include "ElementIterator.h"
-#include "FilterEffect.h"
+#include "FEComponentTransfer.h"
#include "SVGElementTypeHelpers.h"
#include "SVGFEFuncAElement.h"
#include "SVGFEFuncBElement.h"
#include "SVGFEFuncGElement.h"
#include "SVGFEFuncRElement.h"
-#include "SVGFilterBuilder.h"
#include "SVGNames.h"
#include <wtf/IsoMallocInlines.h>
@@ -63,13 +62,8 @@
SVGFilterPrimitiveStandardAttributes::parseAttribute(name, value);
}
-RefPtr<FilterEffect> SVGFEComponentTransferElement::build(SVGFilterBuilder& filterBuilder) const
+RefPtr<FilterEffect> SVGFEComponentTransferElement::filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const
{
- auto input1 = filterBuilder.getEffectById(in1());
-
- if (!input1)
- return nullptr;
-
ComponentTransferFunction red;
ComponentTransferFunction green;
ComponentTransferFunction blue;
@@ -86,9 +80,7 @@
alpha = downcast<SVGFEFuncAElement>(child).transferFunction();
}
- auto effect = FEComponentTransfer::create(red, green, blue, alpha);
- effect->inputEffects() = { input1.releaseNonNull() };
- return effect;
+ return FEComponentTransfer::create(red, green, blue, alpha);
}
-}
+} // namespace WebCore
Modified: trunk/Source/WebCore/svg/SVGFEComponentTransferElement.h (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFEComponentTransferElement.h 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFEComponentTransferElement.h 2022-01-11 20:30:16 UTC (rev 287892)
@@ -2,7 +2,7 @@
* Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmerm...@kde.org>
* Copyright (C) 2004, 2005 Rob Buis <b...@kde.org>
* Copyright (C) 2018 Apple Inc. All rights reserved.
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2022 Apple Inc. 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
@@ -43,7 +43,8 @@
// FIXME: svgAttributeChanged missing.
void parseAttribute(const QualifiedName&, const AtomString&) override;
- RefPtr<FilterEffect> build(SVGFilterBuilder&) const override;
+ Vector<AtomString> filterEffectInputsNames() const override { return { in1() }; }
+ RefPtr<FilterEffect> filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const override;
PropertyRegistry m_propertyRegistry { *this };
Ref<SVGAnimatedString> m_in1 { SVGAnimatedString::create(this) };
Modified: trunk/Source/WebCore/svg/SVGFECompositeElement.cpp (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFECompositeElement.cpp 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFECompositeElement.cpp 2022-01-11 20:30:16 UTC (rev 287892)
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmerm...@kde.org>
* Copyright (C) 2004, 2005, 2006 Rob Buis <b...@kde.org>
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2022 Apple Inc. 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
@@ -22,8 +22,7 @@
#include "config.h"
#include "SVGFECompositeElement.h"
-#include "FilterEffect.h"
-#include "SVGFilterBuilder.h"
+#include "FEComposite.h"
#include "SVGNames.h"
#include <wtf/IsoMallocInlines.h>
@@ -131,17 +130,9 @@
SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName);
}
-RefPtr<FilterEffect> SVGFECompositeElement::build(SVGFilterBuilder& filterBuilder) const
+RefPtr<FilterEffect> SVGFECompositeElement::filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const
{
- auto input1 = filterBuilder.getEffectById(in1());
- auto input2 = filterBuilder.getEffectById(in2());
-
- if (!input1 || !input2)
- return nullptr;
-
- auto effect = FEComposite::create(svgOperator(), k1(), k2(), k3(), k4());
- effect->inputEffects() = { input1.releaseNonNull(), input2.releaseNonNull() };
- return effect;
+ return FEComposite::create(svgOperator(), k1(), k2(), k3(), k4());
}
-}
+} // namespace WebCore
Modified: trunk/Source/WebCore/svg/SVGFECompositeElement.h (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFECompositeElement.h 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFECompositeElement.h 2022-01-11 20:30:16 UTC (rev 287892)
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmerm...@kde.org>
* Copyright (C) 2004, 2005, 2006 Rob Buis <b...@kde.org>
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2022 Apple Inc. 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
@@ -109,7 +109,8 @@
void svgAttributeChanged(const QualifiedName&) override;
bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override;
- RefPtr<FilterEffect> build(SVGFilterBuilder&) const override;
+ Vector<AtomString> filterEffectInputsNames() const override { return { in1(), in2() }; }
+ RefPtr<FilterEffect> filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const override;
PropertyRegistry m_propertyRegistry { *this };
Ref<SVGAnimatedString> m_in1 { SVGAnimatedString::create(this) };
Modified: trunk/Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp 2022-01-11 20:30:16 UTC (rev 287892)
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2009 Dirk Schulze <k...@webkit.org>
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2022 Apple Inc. 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
@@ -21,11 +21,7 @@
#include "config.h"
#include "SVGFEConvolveMatrixElement.h"
-#include "FilterEffect.h"
-#include "FloatPoint.h"
-#include "IntPoint.h"
-#include "IntSize.h"
-#include "SVGFilterBuilder.h"
+#include "FEConvolveMatrix.h"
#include "SVGNames.h"
#include "SVGParserUtilities.h"
#include <wtf/IsoMallocInlines.h>
@@ -191,13 +187,8 @@
SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName);
}
-RefPtr<FilterEffect> SVGFEConvolveMatrixElement::build(SVGFilterBuilder& filterBuilder) const
+RefPtr<FilterEffect> SVGFEConvolveMatrixElement::filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const
{
- auto input1 = filterBuilder.getEffectById(in1());
-
- if (!input1)
- return nullptr;
-
int orderXValue = orderX();
int orderYValue = orderY();
if (!hasAttribute(SVGNames::orderAttr)) {
@@ -207,6 +198,7 @@
// Spec says order must be > 0. Bail if it is not.
if (orderXValue < 1 || orderYValue < 1)
return nullptr;
+
auto& kernelMatrix = this->kernelMatrix();
int kernelMatrixSize = kernelMatrix.items().size();
// The spec says this is a requirement, and should bail out if fails
@@ -217,11 +209,13 @@
int targetYValue = targetY();
if (hasAttribute(SVGNames::targetXAttr) && (targetXValue < 0 || targetXValue >= orderXValue))
return nullptr;
+
// The spec says the default value is: targetX = floor ( orderX / 2 ))
if (!hasAttribute(SVGNames::targetXAttr))
targetXValue = static_cast<int>(floorf(orderXValue / 2));
if (hasAttribute(SVGNames::targetYAttr) && (targetYValue < 0 || targetYValue >= orderYValue))
return nullptr;
+
// The spec says the default value is: targetY = floor ( orderY / 2 ))
if (!hasAttribute(SVGNames::targetYAttr))
targetYValue = static_cast<int>(floorf(orderYValue / 2));
@@ -239,6 +233,7 @@
float divisorValue = divisor();
if (hasAttribute(SVGNames::divisorAttr) && !divisorValue)
return nullptr;
+
if (!hasAttribute(SVGNames::divisorAttr)) {
for (int i = 0; i < kernelMatrixSize; ++i)
divisorValue += kernelMatrix.items()[i]->value();
@@ -246,9 +241,7 @@
divisorValue = 1;
}
- auto effect = FEConvolveMatrix::create(IntSize(orderXValue, orderYValue), divisorValue, bias(), IntPoint(targetXValue, targetYValue), edgeMode(), FloatPoint(kernelUnitLengthXValue, kernelUnitLengthYValue), preserveAlpha(), kernelMatrix);
- effect->inputEffects() = { input1.releaseNonNull() };
- return effect;
+ return FEConvolveMatrix::create(IntSize(orderXValue, orderYValue), divisorValue, bias(), IntPoint(targetXValue, targetYValue), edgeMode(), FloatPoint(kernelUnitLengthXValue, kernelUnitLengthYValue), preserveAlpha(), kernelMatrix);
}
} // namespace WebCore
Modified: trunk/Source/WebCore/svg/SVGFEConvolveMatrixElement.h (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFEConvolveMatrixElement.h 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFEConvolveMatrixElement.h 2022-01-11 20:30:16 UTC (rev 287892)
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2009 Dirk Schulze <k...@webkit.org>
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2022 Apple Inc. 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
@@ -103,7 +103,8 @@
void svgAttributeChanged(const QualifiedName&) override;
bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override;
- RefPtr<FilterEffect> build(SVGFilterBuilder&) const override;
+ Vector<AtomString> filterEffectInputsNames() const override { return { in1() }; }
+ RefPtr<FilterEffect> filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const override;
PropertyRegistry m_propertyRegistry { *this };
Ref<SVGAnimatedString> m_in1 { SVGAnimatedString::create(this) };
Modified: trunk/Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp 2022-01-11 20:30:16 UTC (rev 287892)
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2005 Oliver Hunt <oj...@student.canterbury.ac.nz>
- * Copyright (C) 2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2022 Apple Inc. 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
@@ -22,10 +22,8 @@
#include "SVGFEDiffuseLightingElement.h"
#include "FEDiffuseLighting.h"
-#include "FilterEffect.h"
#include "RenderStyle.h"
#include "SVGFELightElement.h"
-#include "SVGFilterBuilder.h"
#include "SVGNames.h"
#include "SVGParserUtilities.h"
#include <wtf/IsoMallocInlines.h>
@@ -151,13 +149,8 @@
primitiveAttributeChanged(attrName);
}
-RefPtr<FilterEffect> SVGFEDiffuseLightingElement::build(SVGFilterBuilder& filterBuilder) const
+RefPtr<FilterEffect> SVGFEDiffuseLightingElement::filterEffect(const SVGFilterBuilder& filterBuilder, const FilterEffectVector&) const
{
- auto input1 = filterBuilder.getEffectById(in1());
-
- if (!input1)
- return nullptr;
-
RefPtr lightElement = SVGFELightElement::findLightElement(this);
if (!lightElement)
return nullptr;
@@ -170,9 +163,7 @@
Color color = renderer->style().colorByApplyingColorFilter(renderer->style().svgStyle().lightingColor());
- auto effect = FEDiffuseLighting::create(color, surfaceScale(), diffuseConstant(), kernelUnitLengthX(), kernelUnitLengthY(), WTFMove(lightSource));
- effect->inputEffects() = { input1.releaseNonNull() };
- return effect;
+ return FEDiffuseLighting::create(color, surfaceScale(), diffuseConstant(), kernelUnitLengthX(), kernelUnitLengthY(), WTFMove(lightSource));
}
-}
+} // namespace WebCore
Modified: trunk/Source/WebCore/svg/SVGFEDiffuseLightingElement.h (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFEDiffuseLightingElement.h 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFEDiffuseLightingElement.h 2022-01-11 20:30:16 UTC (rev 287892)
@@ -2,7 +2,7 @@
* Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmerm...@kde.org>
* Copyright (C) 2004, 2005 Rob Buis <b...@kde.org>
* Copyright (C) 2005 Oliver Hunt <oli...@nerget.com>
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2022 Apple Inc. 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
@@ -58,7 +58,8 @@
void svgAttributeChanged(const QualifiedName&) override;
bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override;
- RefPtr<FilterEffect> build(SVGFilterBuilder&) const override;
+ Vector<AtomString> filterEffectInputsNames() const override { return { in1() }; }
+ RefPtr<FilterEffect> filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const override;
PropertyRegistry m_propertyRegistry { *this };
Ref<SVGAnimatedString> m_in1 { SVGAnimatedString::create(this) };
Modified: trunk/Source/WebCore/svg/SVGFEDisplacementMapElement.cpp (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFEDisplacementMapElement.cpp 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFEDisplacementMapElement.cpp 2022-01-11 20:30:16 UTC (rev 287892)
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2006 Oliver Hunt <oli...@nerget.com>
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2022 Apple Inc. 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
@@ -21,8 +21,7 @@
#include "config.h"
#include "SVGFEDisplacementMapElement.h"
-#include "FilterEffect.h"
-#include "SVGFilterBuilder.h"
+#include "FEDisplacementMap.h"
#include "SVGNames.h"
#include <wtf/IsoMallocInlines.h>
@@ -115,17 +114,9 @@
SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName);
}
-RefPtr<FilterEffect> SVGFEDisplacementMapElement::build(SVGFilterBuilder& filterBuilder) const
+RefPtr<FilterEffect> SVGFEDisplacementMapElement::filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const
{
- auto input1 = filterBuilder.getEffectById(in1());
- auto input2 = filterBuilder.getEffectById(in2());
-
- if (!input1 || !input2)
- return nullptr;
-
- auto effect = FEDisplacementMap::create(xChannelSelector(), yChannelSelector(), scale());
- effect->inputEffects() = { input1.releaseNonNull(), input2.releaseNonNull() };
- return effect;
+ return FEDisplacementMap::create(xChannelSelector(), yChannelSelector(), scale());
}
-}
+} // namespace WebCore
Modified: trunk/Source/WebCore/svg/SVGFEDisplacementMapElement.h (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFEDisplacementMapElement.h 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFEDisplacementMapElement.h 2022-01-11 20:30:16 UTC (rev 287892)
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2006 Oliver Hunt <oli...@nerget.com>
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2022 Apple Inc. 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
@@ -91,7 +91,8 @@
void svgAttributeChanged(const QualifiedName&) override;
bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName) override;
- RefPtr<FilterEffect> build(SVGFilterBuilder&) const override;
+ Vector<AtomString> filterEffectInputsNames() const override { return { in1(), in2() }; }
+ RefPtr<FilterEffect> filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const override;
PropertyRegistry m_propertyRegistry { *this };
Ref<SVGAnimatedString> m_in1 { SVGAnimatedString::create(this) };
Modified: trunk/Source/WebCore/svg/SVGFEDistantLightElement.cpp (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFEDistantLightElement.cpp 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFEDistantLightElement.cpp 2022-01-11 20:30:16 UTC (rev 287892)
@@ -36,7 +36,7 @@
return adoptRef(*new SVGFEDistantLightElement(tagName, document));
}
-Ref<LightSource> SVGFEDistantLightElement::lightSource(SVGFilterBuilder&) const
+Ref<LightSource> SVGFEDistantLightElement::lightSource(const SVGFilterBuilder&) const
{
return DistantLightSource::create(azimuth(), elevation());
}
Modified: trunk/Source/WebCore/svg/SVGFEDistantLightElement.h (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFEDistantLightElement.h 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFEDistantLightElement.h 2022-01-11 20:30:16 UTC (rev 287892)
@@ -30,7 +30,7 @@
private:
SVGFEDistantLightElement(const QualifiedName&, Document&);
- Ref<LightSource> lightSource(SVGFilterBuilder&) const override;
+ Ref<LightSource> lightSource(const SVGFilterBuilder&) const override;
};
static_assert(sizeof(SVGFEDistantLightElement) == sizeof(SVGFELightElement));
Modified: trunk/Source/WebCore/svg/SVGFEDropShadowElement.cpp (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFEDropShadowElement.cpp 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFEDropShadowElement.cpp 2022-01-11 20:30:16 UTC (rev 287892)
@@ -1,6 +1,6 @@
/*
* Copyright (C) Research In Motion Limited 2011. All rights reserved.
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2022 Apple Inc. 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
@@ -22,7 +22,6 @@
#include "SVGFEDropShadowElement.h"
#include "RenderStyle.h"
-#include "SVGFilterBuilder.h"
#include "SVGNames.h"
#include "SVGParserUtilities.h"
#include "SVGRenderStyle.h"
@@ -97,12 +96,8 @@
SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName);
}
-RefPtr<FilterEffect> SVGFEDropShadowElement::build(SVGFilterBuilder& filterBuilder) const
+RefPtr<FilterEffect> SVGFEDropShadowElement::filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const
{
- auto input1 = filterBuilder.getEffectById(in1());
- if (!input1)
- return nullptr;
-
RenderObject* renderer = this->renderer();
if (!renderer)
return nullptr;
@@ -115,9 +110,7 @@
Color color = renderer->style().colorByApplyingColorFilter(svgStyle.floodColor());
float opacity = svgStyle.floodOpacity();
- auto effect = FEDropShadow::create(stdDeviationX(), stdDeviationY(), dx(), dy(), color, opacity);
- effect->inputEffects() = { input1.releaseNonNull() };
- return effect;
+ return FEDropShadow::create(stdDeviationX(), stdDeviationY(), dx(), dy(), color, opacity);
}
-}
+} // namespace WebCore
Modified: trunk/Source/WebCore/svg/SVGFEDropShadowElement.h (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFEDropShadowElement.h 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFEDropShadowElement.h 2022-01-11 20:30:16 UTC (rev 287892)
@@ -1,6 +1,6 @@
/*
* Copyright (C) Research In Motion Limited 2011. All rights reserved.
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2022 Apple Inc. 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
@@ -53,7 +53,8 @@
void parseAttribute(const QualifiedName&, const AtomString&) override;
void svgAttributeChanged(const QualifiedName&) override;
- RefPtr<FilterEffect> build(SVGFilterBuilder&) const override;
+ Vector<AtomString> filterEffectInputsNames() const override { return { in1() }; }
+ RefPtr<FilterEffect> filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const override;
PropertyRegistry m_propertyRegistry { *this };
Ref<SVGAnimatedString> m_in1 { SVGAnimatedString::create(this) };
Modified: trunk/Source/WebCore/svg/SVGFEFloodElement.cpp (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFEFloodElement.cpp 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFEFloodElement.cpp 2022-01-11 20:30:16 UTC (rev 287892)
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmerm...@kde.org>
* Copyright (C) 2004, 2005, 2007, 2008 Rob Buis <b...@kde.org>
+ * Copyright (C) 2022 Apple Inc. 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
@@ -58,12 +59,12 @@
return false;
}
-RefPtr<FilterEffect> SVGFEFloodElement::build(SVGFilterBuilder&) const
+RefPtr<FilterEffect> SVGFEFloodElement::filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const
{
RenderObject* renderer = this->renderer();
if (!renderer)
return nullptr;
-
+
const SVGRenderStyle& svgStyle = renderer->style().svgStyle();
Color color = renderer->style().colorByApplyingColorFilter(svgStyle.floodColor());
@@ -72,4 +73,4 @@
return FEFlood::create(color, opacity);
}
-}
+} // namespace WebCore
Modified: trunk/Source/WebCore/svg/SVGFEFloodElement.h (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFEFloodElement.h 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFEFloodElement.h 2022-01-11 20:30:16 UTC (rev 287892)
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmerm...@kde.org>
* Copyright (C) 2004, 2005, 2008 Rob Buis <b...@kde.org>
+ * Copyright (C) 2022 Apple Inc. 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
@@ -36,7 +37,7 @@
const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; }
bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName) override;
- RefPtr<FilterEffect> build(SVGFilterBuilder&) const override;
+ RefPtr<FilterEffect> filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const override;
PropertyRegistry m_propertyRegistry { *this };
};
Modified: trunk/Source/WebCore/svg/SVGFEGaussianBlurElement.cpp (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFEGaussianBlurElement.cpp 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFEGaussianBlurElement.cpp 2022-01-11 20:30:16 UTC (rev 287892)
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmerm...@kde.org>
* Copyright (C) 2004, 2005, 2006 Rob Buis <b...@kde.org>
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2022 Apple Inc. 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
@@ -22,8 +22,7 @@
#include "config.h"
#include "SVGFEGaussianBlurElement.h"
-#include "FilterEffect.h"
-#include "SVGFilterBuilder.h"
+#include "FEGaussianBlur.h"
#include "SVGNames.h"
#include "SVGParserUtilities.h"
#include <wtf/IsoMallocInlines.h>
@@ -95,18 +94,12 @@
SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName);
}
-RefPtr<FilterEffect> SVGFEGaussianBlurElement::build(SVGFilterBuilder& filterBuilder) const
+RefPtr<FilterEffect> SVGFEGaussianBlurElement::filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const
{
- auto input1 = filterBuilder.getEffectById(in1());
- if (!input1)
- return nullptr;
-
if (stdDeviationX() < 0 || stdDeviationY() < 0)
return nullptr;
- auto effect = FEGaussianBlur::create(stdDeviationX(), stdDeviationY(), edgeMode());
- effect->inputEffects() = { input1.releaseNonNull() };
- return effect;
+ return FEGaussianBlur::create(stdDeviationX(), stdDeviationY(), edgeMode());
}
-}
+} // namespace WebCore
Modified: trunk/Source/WebCore/svg/SVGFEGaussianBlurElement.h (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFEGaussianBlurElement.h 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFEGaussianBlurElement.h 2022-01-11 20:30:16 UTC (rev 287892)
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmerm...@kde.org>
* Copyright (C) 2004, 2005, 2006 Rob Buis <b...@kde.org>
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2022 Apple Inc. 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
@@ -53,7 +53,8 @@
void parseAttribute(const QualifiedName&, const AtomString&) override;
void svgAttributeChanged(const QualifiedName&) override;
- RefPtr<FilterEffect> build(SVGFilterBuilder&) const override;
+ Vector<AtomString> filterEffectInputsNames() const override { return { in1() }; }
+ RefPtr<FilterEffect> filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const override;
PropertyRegistry m_propertyRegistry { *this };
Ref<SVGAnimatedString> m_in1 { SVGAnimatedString::create(this) };
Modified: trunk/Source/WebCore/svg/SVGFEImageElement.cpp (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFEImageElement.cpp 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFEImageElement.cpp 2022-01-11 20:30:16 UTC (rev 287892)
@@ -2,7 +2,7 @@
* Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmerm...@kde.org>
* Copyright (C) 2004, 2005 Rob Buis <b...@kde.org>
* Copyright (C) 2010 Dirk Schulze <k...@webkit.org>
- * Copyright (C) 2018-2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2022 Apple Inc. 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
@@ -208,7 +208,7 @@
return { imageBuffer, imageRect };
}
-RefPtr<FilterEffect> SVGFEImageElement::build(SVGFilterBuilder&) const
+RefPtr<FilterEffect> SVGFEImageElement::filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const
{
if (m_cachedImage)
return FEImage::create(Ref { *m_cachedImage->imageForRenderer(renderer()) }, preserveAspectRatio());
@@ -227,4 +227,4 @@
addSubresourceURL(urls, document().completeURL(href()));
}
-}
+} // namespace WebCore
Modified: trunk/Source/WebCore/svg/SVGFEImageElement.h (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFEImageElement.h 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFEImageElement.h 2022-01-11 20:30:16 UTC (rev 287892)
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmerm...@kde.org>
* Copyright (C) 2004, 2005 Rob Buis <b...@kde.org>
- * Copyright (C) 2018-2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2022 Apple Inc. 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
@@ -57,7 +57,7 @@
std::tuple<RefPtr<ImageBuffer>, FloatRect> imageBufferForEffect() const;
- RefPtr<FilterEffect> build(SVGFilterBuilder&) const override;
+ RefPtr<FilterEffect> filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const override;
void clearResourceReferences();
void requestImageResource();
Modified: trunk/Source/WebCore/svg/SVGFELightElement.h (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFELightElement.h 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFELightElement.h 2022-01-11 20:30:16 UTC (rev 287892)
@@ -32,7 +32,7 @@
class SVGFELightElement : public SVGElement {
WTF_MAKE_ISO_ALLOCATED(SVGFELightElement);
public:
- virtual Ref<LightSource> lightSource(SVGFilterBuilder&) const = 0;
+ virtual Ref<LightSource> lightSource(const SVGFilterBuilder&) const = 0;
static SVGFELightElement* findLightElement(const SVGElement*);
float azimuth() const { return m_azimuth->currentValue(); }
Modified: trunk/Source/WebCore/svg/SVGFEMergeElement.cpp (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFEMergeElement.cpp 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFEMergeElement.cpp 2022-01-11 20:30:16 UTC (rev 287892)
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmerm...@kde.org>
* Copyright (C) 2004, 2005, 2006 Rob Buis <b...@kde.org>
+ * Copyright (C) 2022 Apple Inc. 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
@@ -23,10 +24,8 @@
#include "ElementIterator.h"
#include "FEMerge.h"
-#include "FilterEffect.h"
#include "SVGElementTypeHelpers.h"
#include "SVGFEMergeNodeElement.h"
-#include "SVGFilterBuilder.h"
#include "SVGNames.h"
#include <wtf/IsoMallocInlines.h>
@@ -45,25 +44,17 @@
return adoptRef(*new SVGFEMergeElement(tagName, document));
}
-RefPtr<FilterEffect> SVGFEMergeElement::build(SVGFilterBuilder& filterBuilder) const
+Vector<AtomString> SVGFEMergeElement::filterEffectInputsNames() const
{
- FilterEffectVector mergeInputs;
+ Vector<AtomString> inputsNames;
+ for (auto& mergeNode : childrenOfType<SVGFEMergeNodeElement>(*this))
+ inputsNames.append(mergeNode.in1());
+ return inputsNames;
+}
- for (auto& mergeNode : childrenOfType<SVGFEMergeNodeElement>(*this)) {
- auto mergeEffect = filterBuilder.getEffectById(mergeNode.in1());
- if (!mergeEffect)
- return nullptr;
- mergeInputs.append(mergeEffect.releaseNonNull());
- }
-
- mergeInputs.shrinkToFit();
-
- if (mergeInputs.isEmpty())
- return nullptr;
-
- auto effect = FEMerge::create(mergeInputs.size());
- effect->inputEffects() = WTFMove(mergeInputs);
- return effect;
+RefPtr<FilterEffect> SVGFEMergeElement::filterEffect(const SVGFilterBuilder&, const FilterEffectVector& inputs) const
+{
+ return FEMerge::create(inputs.size());
}
-}
+} // namespace WebCore
Modified: trunk/Source/WebCore/svg/SVGFEMergeElement.h (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFEMergeElement.h 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFEMergeElement.h 2022-01-11 20:30:16 UTC (rev 287892)
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmerm...@kde.org>
* Copyright (C) 2004, 2005, 2006 Rob Buis <b...@kde.org>
+ * Copyright (C) 2022 Apple Inc. 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
@@ -35,7 +36,8 @@
using PropertyRegistry = SVGPropertyOwnerRegistry<SVGFEMergeElement, SVGFilterPrimitiveStandardAttributes>;
const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; }
- RefPtr<FilterEffect> build(SVGFilterBuilder&) const override;
+ Vector<AtomString> filterEffectInputsNames() const override;
+ RefPtr<FilterEffect> filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const override;
PropertyRegistry m_propertyRegistry { *this };
};
Modified: trunk/Source/WebCore/svg/SVGFEMorphologyElement.cpp (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFEMorphologyElement.cpp 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFEMorphologyElement.cpp 2022-01-11 20:30:16 UTC (rev 287892)
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2009 Dirk Schulze <k...@webkit.org>
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2022 Apple Inc. 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
@@ -21,8 +21,7 @@
#include "config.h"
#include "SVGFEMorphologyElement.h"
-#include "FilterEffect.h"
-#include "SVGFilterBuilder.h"
+#include "FEMorphology.h"
#include "SVGNames.h"
#include "SVGParserUtilities.h"
#include <wtf/IsoMallocInlines.h>
@@ -114,20 +113,12 @@
SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName);
}
-RefPtr<FilterEffect> SVGFEMorphologyElement::build(SVGFilterBuilder& filterBuilder) const
+RefPtr<FilterEffect> SVGFEMorphologyElement::filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const
{
- auto input1 = filterBuilder.getEffectById(in1());
- if (!input1)
+ if (radiusX() < 0 || radiusY() < 0)
return nullptr;
- float xRadius = radiusX();
- float yRadius = radiusY();
- if (xRadius < 0 || yRadius < 0)
- return nullptr;
-
- auto effect = FEMorphology::create(svgOperator(), xRadius, yRadius);
- effect->inputEffects() = { input1.releaseNonNull() };
- return effect;
+ return FEMorphology::create(svgOperator(), radiusX(), radiusY());
}
} // namespace WebCore
Modified: trunk/Source/WebCore/svg/SVGFEMorphologyElement.h (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFEMorphologyElement.h 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFEMorphologyElement.h 2022-01-11 20:30:16 UTC (rev 287892)
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2009 Dirk Schulze <k...@webkit.org>
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2022 Apple Inc. 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
@@ -81,7 +81,8 @@
void svgAttributeChanged(const QualifiedName&) override;
bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override;
- RefPtr<FilterEffect> build(SVGFilterBuilder&) const override;
+ Vector<AtomString> filterEffectInputsNames() const override { return { in1() }; }
+ RefPtr<FilterEffect> filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const override;
PropertyRegistry m_propertyRegistry { *this };
Ref<SVGAnimatedString> m_in1 { SVGAnimatedString::create(this) };
Modified: trunk/Source/WebCore/svg/SVGFEOffsetElement.cpp (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFEOffsetElement.cpp 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFEOffsetElement.cpp 2022-01-11 20:30:16 UTC (rev 287892)
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmerm...@kde.org>
* Copyright (C) 2004, 2005 Rob Buis <b...@kde.org>
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2022 Apple Inc. 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
@@ -23,8 +23,6 @@
#include "SVGFEOffsetElement.h"
#include "FEOffset.h"
-#include "FilterEffect.h"
-#include "SVGFilterBuilder.h"
#include "SVGNames.h"
#include <wtf/IsoMallocInlines.h>
@@ -81,15 +79,9 @@
SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName);
}
-RefPtr<FilterEffect> SVGFEOffsetElement::build(SVGFilterBuilder& filterBuilder) const
+RefPtr<FilterEffect> SVGFEOffsetElement::filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const
{
- auto input1 = filterBuilder.getEffectById(in1());
- if (!input1)
- return nullptr;
-
- auto effect = FEOffset::create(dx(), dy());
- effect->inputEffects() = { input1.releaseNonNull() };
- return effect;
+ return FEOffset::create(dx(), dy());
}
-}
+} // namespace WebCore
Modified: trunk/Source/WebCore/svg/SVGFEOffsetElement.h (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFEOffsetElement.h 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFEOffsetElement.h 2022-01-11 20:30:16 UTC (rev 287892)
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmerm...@kde.org>
* Copyright (C) 2004, 2005 Rob Buis <b...@kde.org>
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2022 Apple Inc. 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
@@ -47,7 +47,8 @@
void parseAttribute(const QualifiedName&, const AtomString&) override;
void svgAttributeChanged(const QualifiedName&) override;
- RefPtr<FilterEffect> build(SVGFilterBuilder&) const override;
+ Vector<AtomString> filterEffectInputsNames() const override { return { in1() }; }
+ RefPtr<FilterEffect> filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const override;
PropertyRegistry m_propertyRegistry { *this };
Ref<SVGAnimatedString> m_in1 { SVGAnimatedString::create(this) };
Modified: trunk/Source/WebCore/svg/SVGFEPointLightElement.cpp (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFEPointLightElement.cpp 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFEPointLightElement.cpp 2022-01-11 20:30:16 UTC (rev 287892)
@@ -40,7 +40,7 @@
return adoptRef(*new SVGFEPointLightElement(tagName, document));
}
-Ref<LightSource> SVGFEPointLightElement::lightSource(SVGFilterBuilder& builder) const
+Ref<LightSource> SVGFEPointLightElement::lightSource(const SVGFilterBuilder& builder) const
{
FloatPoint3D position;
if (builder.primitiveUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
Modified: trunk/Source/WebCore/svg/SVGFEPointLightElement.h (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFEPointLightElement.h 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFEPointLightElement.h 2022-01-11 20:30:16 UTC (rev 287892)
@@ -30,7 +30,7 @@
private:
SVGFEPointLightElement(const QualifiedName&, Document&);
- Ref<LightSource> lightSource(SVGFilterBuilder&) const override;
+ Ref<LightSource> lightSource(const SVGFilterBuilder&) const override;
};
static_assert(sizeof(SVGFEPointLightElement) == sizeof(SVGFELightElement));
Modified: trunk/Source/WebCore/svg/SVGFESpecularLightingElement.cpp (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFESpecularLightingElement.cpp 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFESpecularLightingElement.cpp 2022-01-11 20:30:16 UTC (rev 287892)
@@ -2,7 +2,7 @@
* Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmerm...@kde.org>
* Copyright (C) 2004, 2005, 2006 Rob Buis <b...@kde.org>
* Copyright (C) 2005 Oliver Hunt <oli...@nerget.com>
- * Copyright (C) 2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2022 Apple Inc. 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
@@ -23,10 +23,9 @@
#include "config.h"
#include "SVGFESpecularLightingElement.h"
-#include "FilterEffect.h"
+#include "FESpecularLighting.h"
#include "RenderStyle.h"
#include "SVGFELightElement.h"
-#include "SVGFilterBuilder.h"
#include "SVGNames.h"
#include "SVGParserUtilities.h"
#include <wtf/IsoMallocInlines.h>
@@ -160,27 +159,21 @@
primitiveAttributeChanged(attrName);
}
-RefPtr<FilterEffect> SVGFESpecularLightingElement::build(SVGFilterBuilder& filterBuilder) const
+RefPtr<FilterEffect> SVGFESpecularLightingElement::filterEffect(const SVGFilterBuilder& filterBuilder, const FilterEffectVector&) const
{
- auto input1 = filterBuilder.getEffectById(in1());
- if (!input1)
- return nullptr;
-
RefPtr lightElement = SVGFELightElement::findLightElement(this);
if (!lightElement)
return nullptr;
-
+
auto lightSource = lightElement->lightSource(filterBuilder);
RenderObject* renderer = this->renderer();
if (!renderer)
return nullptr;
-
+
Color color = renderer->style().colorByApplyingColorFilter(renderer->style().svgStyle().lightingColor());
- auto effect = FESpecularLighting::create(color, surfaceScale(), specularConstant(), specularExponent(), kernelUnitLengthX(), kernelUnitLengthY(), WTFMove(lightSource));
- effect->inputEffects() = { input1.releaseNonNull() };
- return effect;
+ return FESpecularLighting::create(color, surfaceScale(), specularConstant(), specularExponent(), kernelUnitLengthX(), kernelUnitLengthY(), WTFMove(lightSource));
}
-}
+} // namespace WebCore
Modified: trunk/Source/WebCore/svg/SVGFESpecularLightingElement.h (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFESpecularLightingElement.h 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFESpecularLightingElement.h 2022-01-11 20:30:16 UTC (rev 287892)
@@ -2,7 +2,7 @@
* Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmerm...@kde.org>
* Copyright (C) 2004, 2005, 2006 Rob Buis <b...@kde.org>
* Copyright (C) 2005 Oliver Hunt <oli...@nerget.com>
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2022 Apple Inc. 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
@@ -58,7 +58,8 @@
void svgAttributeChanged(const QualifiedName&) override;
bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override;
- RefPtr<FilterEffect> build(SVGFilterBuilder&) const override;
+ Vector<AtomString> filterEffectInputsNames() const override { return { in1() }; }
+ RefPtr<FilterEffect> filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const override;
PropertyRegistry m_propertyRegistry { *this };
Ref<SVGAnimatedString> m_in1 { SVGAnimatedString::create(this) };
Modified: trunk/Source/WebCore/svg/SVGFESpotLightElement.cpp (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFESpotLightElement.cpp 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFESpotLightElement.cpp 2022-01-11 20:30:16 UTC (rev 287892)
@@ -20,8 +20,6 @@
#include "config.h"
#include "SVGFESpotLightElement.h"
-#include "GeometryUtilities.h"
-#include "ImageBuffer.h"
#include "SVGFilterBuilder.h"
#include "SVGNames.h"
#include "SpotLightSource.h"
@@ -40,7 +38,7 @@
return adoptRef(*new SVGFESpotLightElement(tagName, document));
}
-Ref<LightSource> SVGFESpotLightElement::lightSource(SVGFilterBuilder& builder) const
+Ref<LightSource> SVGFESpotLightElement::lightSource(const SVGFilterBuilder& builder) const
{
FloatPoint3D position;
FloatPoint3D pointsAt;
Modified: trunk/Source/WebCore/svg/SVGFESpotLightElement.h (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFESpotLightElement.h 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFESpotLightElement.h 2022-01-11 20:30:16 UTC (rev 287892)
@@ -30,7 +30,7 @@
private:
SVGFESpotLightElement(const QualifiedName&, Document&);
- Ref<LightSource> lightSource(SVGFilterBuilder&) const override;
+ Ref<LightSource> lightSource(const SVGFilterBuilder&) const override;
};
static_assert(sizeof(SVGFESpotLightElement) == sizeof(SVGFELightElement));
Modified: trunk/Source/WebCore/svg/SVGFETileElement.cpp (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFETileElement.cpp 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFETileElement.cpp 2022-01-11 20:30:16 UTC (rev 287892)
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmerm...@kde.org>
* Copyright (C) 2004, 2005 Rob Buis <b...@kde.org>
- * Copyright (C) 2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2022 Apple Inc. 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
@@ -23,10 +23,7 @@
#include "SVGFETileElement.h"
#include "FETile.h"
-#include "FilterEffect.h"
-#include "SVGFilterBuilder.h"
#include "SVGNames.h"
-#include "SVGRenderStyle.h"
#include <wtf/IsoMallocInlines.h>
namespace WebCore {
@@ -70,15 +67,9 @@
SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName);
}
-RefPtr<FilterEffect> SVGFETileElement::build(SVGFilterBuilder& filterBuilder) const
+RefPtr<FilterEffect> SVGFETileElement::filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const
{
- auto input1 = filterBuilder.getEffectById(in1());
- if (!input1)
- return nullptr;
-
- auto effect = FETile::create();
- effect->inputEffects() = { input1.releaseNonNull() };
- return effect;
+ return FETile::create();
}
-}
+} // namespace WebCore
Modified: trunk/Source/WebCore/svg/SVGFETileElement.h (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFETileElement.h 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFETileElement.h 2022-01-11 20:30:16 UTC (rev 287892)
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmerm...@kde.org>
* Copyright (C) 2004, 2005 Rob Buis <b...@kde.org>
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2022 Apple Inc. 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
@@ -42,7 +42,8 @@
void parseAttribute(const QualifiedName&, const AtomString&) override;
void svgAttributeChanged(const QualifiedName&) override;
- RefPtr<FilterEffect> build(SVGFilterBuilder&) const override;
+ Vector<AtomString> filterEffectInputsNames() const override { return { in1() }; }
+ RefPtr<FilterEffect> filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const override;
PropertyRegistry m_propertyRegistry { *this };
Ref<SVGAnimatedString> m_in1 { SVGAnimatedString::create(this) };
Modified: trunk/Source/WebCore/svg/SVGFETurbulenceElement.cpp (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFETurbulenceElement.cpp 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFETurbulenceElement.cpp 2022-01-11 20:30:16 UTC (rev 287892)
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmerm...@kde.org>
* Copyright (C) 2004, 2005, 2006 Rob Buis <b...@kde.org>
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2022 Apple Inc. 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
@@ -117,11 +117,12 @@
SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName);
}
-RefPtr<FilterEffect> SVGFETurbulenceElement::build(SVGFilterBuilder&) const
+RefPtr<FilterEffect> SVGFETurbulenceElement::filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const
{
if (baseFrequencyX() < 0 || baseFrequencyY() < 0)
return nullptr;
+
return FETurbulence::create(type(), baseFrequencyX(), baseFrequencyY(), numOctaves(), seed(), stitchTiles() == SVG_STITCHTYPE_STITCH);
}
-}
+} // namespace WebCore
Modified: trunk/Source/WebCore/svg/SVGFETurbulenceElement.h (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFETurbulenceElement.h 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFETurbulenceElement.h 2022-01-11 20:30:16 UTC (rev 287892)
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmerm...@kde.org>
* Copyright (C) 2004, 2005, 2006 Rob Buis <b...@kde.org>
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2022 Apple Inc. 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
@@ -119,7 +119,7 @@
void svgAttributeChanged(const QualifiedName&) override;
bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName) override;
- RefPtr<FilterEffect> build(SVGFilterBuilder&) const override;
+ RefPtr<FilterEffect> filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const override;
PropertyRegistry m_propertyRegistry { *this };
Ref<SVGAnimatedNumber> m_baseFrequencyX { SVGAnimatedNumber::create(this) };
Modified: trunk/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h (287891 => 287892)
--- trunk/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h 2022-01-11 20:30:16 UTC (rev 287892)
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmerm...@kde.org>
* Copyright (C) 2004, 2005, 2006 Rob Buis <b...@kde.org>
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2022 Apple Inc. 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
@@ -36,10 +36,6 @@
class SVGFilterPrimitiveStandardAttributes : public SVGElement {
WTF_MAKE_ISO_ALLOCATED(SVGFilterPrimitiveStandardAttributes);
public:
- virtual RefPtr<FilterEffect> build(SVGFilterBuilder&) const = 0;
- // Returns true, if the new value is different from the old one.
- virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&);
-
using PropertyRegistry = SVGPropertyOwnerRegistry<SVGFilterPrimitiveStandardAttributes, SVGElement>;
const SVGLengthValue& x() const { return m_x->currentValue(); }
@@ -54,6 +50,11 @@
SVGAnimatedLength& heightAnimated() { return m_height; }
SVGAnimatedString& resultAnimated() { return m_result; }
+ // Returns true, if the new value is different from the old one.
+ virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&);
+ virtual Vector<AtomString> filterEffectInputsNames() const { return { }; }
+ virtual RefPtr<FilterEffect> filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const = 0;
+
protected:
SVGFilterPrimitiveStandardAttributes(const QualifiedName&, Document&);
Modified: trunk/Source/WebCore/svg/graphics/filters/SVGFilter.cpp (287891 => 287892)
--- trunk/Source/WebCore/svg/graphics/filters/SVGFilter.cpp 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/graphics/filters/SVGFilter.cpp 2022-01-11 20:30:16 UTC (rev 287892)
@@ -30,25 +30,11 @@
namespace WebCore {
-RefPtr<SVGFilter> SVGFilter::create(SVGFilterElement& filterElement, SVGFilterBuilder& builder, RenderingMode renderingMode, const FloatSize& filterScale, ClipOperation clipOperation, const FloatRect& targetBoundingBox, FilterEffect& previousEffect)
+RefPtr<SVGFilter> SVGFilter::create(SVGFilterElement& filterElement, SVGFilterBuilder& builder, RenderingMode renderingMode, const FloatSize& filterScale, ClipOperation clipOperation, const FloatRect& filterRegion, const FloatRect& targetBoundingBox)
{
- return create(filterElement, builder, renderingMode, filterScale, clipOperation, targetBoundingBox, targetBoundingBox, &previousEffect);
-}
-
-RefPtr<SVGFilter> SVGFilter::create(SVGFilterElement& filterElement, SVGFilterBuilder& builder, RenderingMode renderingMode, const FloatSize& filterScale, const FloatRect& filterRegion, const FloatRect& targetBoundingBox)
-{
- return create(filterElement, builder, renderingMode, filterScale, ClipOperation::Intersect, filterRegion, targetBoundingBox, nullptr);
-}
-
-RefPtr<SVGFilter> SVGFilter::create(SVGFilterElement& filterElement, SVGFilterBuilder& builder, RenderingMode renderingMode, const FloatSize& filterScale, ClipOperation clipOperation, const FloatRect& filterRegion, const FloatRect& targetBoundingBox, FilterEffect* previousEffect)
-{
auto filter = adoptRef(*new SVGFilter(renderingMode, filterScale, clipOperation, filterRegion, targetBoundingBox, filterElement.primitiveUnits()));
- if (!previousEffect)
- builder.setupBuiltinEffects(SourceGraphic::create());
- else
- builder.setupBuiltinEffects({ *previousEffect });
-
+ builder.setupBuiltinEffects(SourceGraphic::create());
builder.setTargetBoundingBox(targetBoundingBox);
builder.setPrimitiveUnits(filterElement.primitiveUnits());
Modified: trunk/Source/WebCore/svg/graphics/filters/SVGFilter.h (287891 => 287892)
--- trunk/Source/WebCore/svg/graphics/filters/SVGFilter.h 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/graphics/filters/SVGFilter.h 2022-01-11 20:30:16 UTC (rev 287892)
@@ -36,9 +36,7 @@
class SVGFilter final : public Filter {
public:
- static RefPtr<SVGFilter> create(SVGFilterElement&, SVGFilterBuilder&, RenderingMode, const FloatSize& filterScale, ClipOperation, const FloatRect& targetBoundingBox, FilterEffect& previousEffect);
- static RefPtr<SVGFilter> create(SVGFilterElement&, SVGFilterBuilder&, RenderingMode, const FloatSize& filterScale, const FloatRect& filterRegion, const FloatRect& targetBoundingBox);
- static RefPtr<SVGFilter> create(SVGFilterElement&, SVGFilterBuilder&, RenderingMode, const FloatSize& filterScale, ClipOperation, const FloatRect& filterRegion, const FloatRect& targetBoundingBox, FilterEffect* previousEffect);
+ static RefPtr<SVGFilter> create(SVGFilterElement&, SVGFilterBuilder&, RenderingMode, const FloatSize& filterScale, ClipOperation, const FloatRect& filterRegion, const FloatRect& targetBoundingBox);
WEBCORE_EXPORT static RefPtr<SVGFilter> create(const FloatRect& targetBoundingBox, SVGUnitTypes::SVGUnitType primitiveUnits, SVGFilterExpression&&);
FloatRect targetBoundingBox() const { return m_targetBoundingBox; }
Modified: trunk/Source/WebCore/svg/graphics/filters/SVGFilterBuilder.cpp (287891 => 287892)
--- trunk/Source/WebCore/svg/graphics/filters/SVGFilterBuilder.cpp 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/graphics/filters/SVGFilterBuilder.cpp 2022-01-11 20:30:16 UTC (rev 287892)
@@ -39,8 +39,8 @@
void SVGFilterBuilder::setupBuiltinEffects(Ref<FilterEffect> sourceGraphic)
{
- m_builtinEffects.add(SourceGraphic::effectName(), sourceGraphic.ptr());
- m_builtinEffects.add(SourceAlpha::effectName(), SourceAlpha::create(sourceGraphic));
+ m_builtinEffects.add(SourceGraphic::effectName(), sourceGraphic);
+ m_builtinEffects.add(SourceAlpha::effectName(), SourceAlpha::create(sourceGraphic->operatingColorSpace()));
}
static OptionSet<FilterEffectGeometry::Flags> effectGeometryFlagsForElement(SVGElement& element)
@@ -83,12 +83,16 @@
if (filterElement.countChildNodes() > maxCountChildNodes)
return nullptr;
- RefPtr<FilterEffect> effect;
+ setEffectInputs(sourceAlpha(), FilterEffectVector { sourceGraphic() });
for (auto& effectElement : childrenOfType<SVGFilterPrimitiveStandardAttributes>(filterElement)) {
- effect = effectElement.build(*this);
+ auto inputs = namedEffects(effectElement.filterEffectInputsNames());
+ if (!inputs)
+ return nullptr;
+
+ auto effect = effectElement.filterEffect(*this, *inputs);
if (!effect)
- break;
+ return nullptr;
if (auto flags = effectGeometryFlagsForElement(effectElement)) {
auto effectBoundaries = SVGLengthContext::resolveRectangle<SVGFilterPrimitiveStandardAttributes>(&effectElement, m_primitiveUnits, m_targetBoundingBox);
@@ -103,16 +107,27 @@
if (auto renderer = effectElement.renderer())
appendEffectToEffectRenderer(*effect, *renderer);
- add(effectElement.result(), effect);
+ addNamedEffect(effectElement.result(), { *effect });
+ setEffectInputs(*effect, WTFMove(*inputs));
}
- return effect;
+ return m_lastEffect;
}
-void SVGFilterBuilder::add(const AtomString& id, RefPtr<FilterEffect> effect)
+FilterEffect& SVGFilterBuilder::sourceGraphic() const
{
+ return *m_builtinEffects.get(FilterEffect::sourceGraphicName());
+}
+
+FilterEffect& SVGFilterBuilder::sourceAlpha() const
+{
+ return *m_builtinEffects.get(FilterEffect::sourceAlphaName());
+}
+
+void SVGFilterBuilder::addNamedEffect(const AtomString& id, Ref<FilterEffect>&& effect)
+{
if (id.isEmpty()) {
- m_lastEffect = effect;
+ m_lastEffect = WTFMove(effect);
return;
}
@@ -119,17 +134,17 @@
if (m_builtinEffects.contains(id))
return;
- m_lastEffect = effect;
- m_namedEffects.set(id, m_lastEffect);
+ m_lastEffect = WTFMove(effect);
+ m_namedEffects.set(id, Ref { *m_lastEffect });
}
-RefPtr<FilterEffect> SVGFilterBuilder::getEffectById(const AtomString& id) const
+RefPtr<FilterEffect> SVGFilterBuilder::namedEffect(const AtomString& id) const
{
if (id.isEmpty()) {
if (m_lastEffect)
return m_lastEffect;
- return m_builtinEffects.get(SourceGraphic::effectName());
+ return &sourceGraphic();
}
if (m_builtinEffects.contains(id))
@@ -138,6 +153,28 @@
return m_namedEffects.get(id);
}
+std::optional<FilterEffectVector> SVGFilterBuilder::namedEffects(Span<const AtomString> names) const
+{
+ FilterEffectVector effects;
+
+ effects.reserveInitialCapacity(names.size());
+
+ for (auto& name : names) {
+ auto effect = namedEffect(name);
+ if (!effect)
+ return std::nullopt;
+
+ effects.uncheckedAppend(effect.releaseNonNull());
+ }
+
+ return effects;
+}
+
+void SVGFilterBuilder::setEffectInputs(FilterEffect& effect, FilterEffectVector&& inputs)
+{
+ m_inputsMap.set({ effect }, WTFMove(inputs));
+}
+
void SVGFilterBuilder::appendEffectToEffectRenderer(FilterEffect& effect, RenderObject& object)
{
m_effectRenderer.add(&object, &effect);
@@ -161,8 +198,8 @@
_expression_.append({ effect, effectGeometry(effect), level });
- for (auto& inputEffect : effect.inputEffects()) {
- if (!buildEffectExpression(inputEffect, stack, level + 1, _expression_))
+ for (auto& input : m_inputsMap.get(effect)) {
+ if (!buildEffectExpression(input, stack, level + 1, _expression_))
return false;
}
Modified: trunk/Source/WebCore/svg/graphics/filters/SVGFilterBuilder.h (287891 => 287892)
--- trunk/Source/WebCore/svg/graphics/filters/SVGFilterBuilder.h 2022-01-11 18:53:40 UTC (rev 287891)
+++ trunk/Source/WebCore/svg/graphics/filters/SVGFilterBuilder.h 2022-01-11 20:30:16 UTC (rev 287892)
@@ -25,7 +25,6 @@
#include "SVGFilterExpression.h"
#include "SVGUnitTypes.h"
#include <wtf/HashMap.h>
-#include <wtf/HashSet.h>
#include <wtf/text/AtomStringHash.h>
#include <wtf/text/WTFString.h>
@@ -46,9 +45,6 @@
SVGUnitTypes::SVGUnitType primitiveUnits() const { return m_primitiveUnits; }
void setPrimitiveUnits(SVGUnitTypes::SVGUnitType units) { m_primitiveUnits = units; }
- void add(const AtomString& id, RefPtr<FilterEffect>);
- RefPtr<FilterEffect> getEffectById(const AtomString&) const;
-
// Required to change the attributes of a filter during an svgAttributeChanged.
void appendEffectToEffectRenderer(FilterEffect&, RenderObject&);
inline FilterEffect* effectByRenderer(RenderObject* object) { return m_effectRenderer.get(object); }
@@ -58,12 +54,22 @@
bool buildExpression(SVGFilterExpression&) const;
private:
+ FilterEffect& sourceGraphic() const;
+ FilterEffect& sourceAlpha() const;
+
+ RefPtr<FilterEffect> namedEffect(const AtomString&) const;
+ std::optional<FilterEffectVector> namedEffects(Span<const AtomString>) const;
+
+ void addNamedEffect(const AtomString& id, Ref<FilterEffect>&&);
+ void setEffectInputs(FilterEffect&, FilterEffectVector&& inputs);
+
std::optional<FilterEffectGeometry> effectGeometry(FilterEffect&) const;
bool buildEffectExpression(FilterEffect&, FilterEffectVector& stack, unsigned level, SVGFilterExpression&) const;
- HashMap<AtomString, RefPtr<FilterEffect>> m_builtinEffects;
- HashMap<AtomString, RefPtr<FilterEffect>> m_namedEffects;
+ HashMap<AtomString, Ref<FilterEffect>> m_builtinEffects;
+ HashMap<AtomString, Ref<FilterEffect>> m_namedEffects;
HashMap<RenderObject*, FilterEffect*> m_effectRenderer;
+ HashMap<Ref<FilterEffect>, FilterEffectVector> m_inputsMap;
RefPtr<FilterEffect> m_lastEffect;