Changeset 287892 in webkit
- Timestamp:
- Jan 11, 2022, 12:30:16 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 54 edited
-
ChangeLog (modified) (1 diff)
-
platform/graphics/filters/FilterEffect.cpp (modified) (1 diff)
-
platform/graphics/filters/FilterEffect.h (modified) (4 diffs)
-
platform/graphics/filters/SourceAlpha.cpp (modified) (3 diffs)
-
platform/graphics/filters/SourceAlpha.h (modified) (1 diff)
-
rendering/CSSFilter.cpp (modified) (7 diffs)
-
rendering/svg/RenderSVGResourceFilter.cpp (modified) (1 diff)
-
rendering/svg/SVGRenderTreeAsText.cpp (modified) (1 diff)
-
svg/SVGFEBlendElement.cpp (modified) (3 diffs)
-
svg/SVGFEBlendElement.h (modified) (2 diffs)
-
svg/SVGFEColorMatrixElement.cpp (modified) (4 diffs)
-
svg/SVGFEColorMatrixElement.h (modified) (2 diffs)
-
svg/SVGFEComponentTransferElement.cpp (modified) (5 diffs)
-
svg/SVGFEComponentTransferElement.h (modified) (2 diffs)
-
svg/SVGFECompositeElement.cpp (modified) (3 diffs)
-
svg/SVGFECompositeElement.h (modified) (2 diffs)
-
svg/SVGFEConvolveMatrixElement.cpp (modified) (8 diffs)
-
svg/SVGFEConvolveMatrixElement.h (modified) (2 diffs)
-
svg/SVGFEDiffuseLightingElement.cpp (modified) (4 diffs)
-
svg/SVGFEDiffuseLightingElement.h (modified) (2 diffs)
-
svg/SVGFEDisplacementMapElement.cpp (modified) (3 diffs)
-
svg/SVGFEDisplacementMapElement.h (modified) (2 diffs)
-
svg/SVGFEDistantLightElement.cpp (modified) (1 diff)
-
svg/SVGFEDistantLightElement.h (modified) (1 diff)
-
svg/SVGFEDropShadowElement.cpp (modified) (4 diffs)
-
svg/SVGFEDropShadowElement.h (modified) (2 diffs)
-
svg/SVGFEFloodElement.cpp (modified) (3 diffs)
-
svg/SVGFEFloodElement.h (modified) (2 diffs)
-
svg/SVGFEGaussianBlurElement.cpp (modified) (3 diffs)
-
svg/SVGFEGaussianBlurElement.h (modified) (2 diffs)
-
svg/SVGFEImageElement.cpp (modified) (3 diffs)
-
svg/SVGFEImageElement.h (modified) (2 diffs)
-
svg/SVGFELightElement.h (modified) (1 diff)
-
svg/SVGFEMergeElement.cpp (modified) (3 diffs)
-
svg/SVGFEMergeElement.h (modified) (2 diffs)
-
svg/SVGFEMorphologyElement.cpp (modified) (3 diffs)
-
svg/SVGFEMorphologyElement.h (modified) (2 diffs)
-
svg/SVGFEOffsetElement.cpp (modified) (3 diffs)
-
svg/SVGFEOffsetElement.h (modified) (2 diffs)
-
svg/SVGFEPointLightElement.cpp (modified) (1 diff)
-
svg/SVGFEPointLightElement.h (modified) (1 diff)
-
svg/SVGFESpecularLightingElement.cpp (modified) (4 diffs)
-
svg/SVGFESpecularLightingElement.h (modified) (2 diffs)
-
svg/SVGFESpotLightElement.cpp (modified) (2 diffs)
-
svg/SVGFESpotLightElement.h (modified) (1 diff)
-
svg/SVGFETileElement.cpp (modified) (3 diffs)
-
svg/SVGFETileElement.h (modified) (2 diffs)
-
svg/SVGFETurbulenceElement.cpp (modified) (2 diffs)
-
svg/SVGFETurbulenceElement.h (modified) (2 diffs)
-
svg/SVGFilterPrimitiveStandardAttributes.h (modified) (3 diffs)
-
svg/graphics/filters/SVGFilter.cpp (modified) (1 diff)
-
svg/graphics/filters/SVGFilter.h (modified) (1 diff)
-
svg/graphics/filters/SVGFilterBuilder.cpp (modified) (7 diffs)
-
svg/graphics/filters/SVGFilterBuilder.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r287889 r287892 1 2022-01-11 Said Abou-Hallawa <said@apple.com> 2 3 [GPU Process] Remove the dependency from FilterEffect to its inputs 4 https://bugs.webkit.org/show_bug.cgi?id=232841 5 rdar://85425930 6 7 Reviewed by Darin Adler. 8 9 This is the last clean-up in the FilterEffect code. It will make the 10 FilterEffect objects in the GPUProcess resemble exactly their counterpart 11 ones in the WebProcess from now on. 12 13 For CSSFilter, we do not need to set the input effects because every 14 FilterFunction is the input of its successor. Passing the previous result 15 FilterImage to the apply() method of the current FilterFunction is enough 16 to get the filter applied correctly. 17 18 For SVGFilter, we need the filter effect inputs only when building the 19 SVGFilterExpression. So we can build a HashMap in SVGFilterBuilder which 20 maps a FilterEffect to its input FilterEffectVector. To make the change 21 clearer, the SVGFExxxElement classes will implement two methods: 22 1. filterEffectInputsNames() which returns the names of the input FilterEffects. 23 2. filterEffect() which returns the FilterEffect representing this element. 24 SVGFilterBuilder::buildFilterEffects() converts the names to FilterEffects. 25 26 No need to initialize the SourceGraphic of the referenced SVGFilter with 27 the FilterEffect of its previous FilterFunction. The referenced SVGFilter 28 will create its own native SourceGraphic. This SourceGraphic will copy 29 the input FilterImage to the result FilterImage. 30 31 * platform/graphics/filters/FilterEffect.cpp: 32 (WebCore::FilterEffect::inputEffect const): Deleted. 33 * platform/graphics/filters/FilterEffect.h: 34 (WebCore::FilterEffect::inputEffects): Deleted. 35 * platform/graphics/filters/SourceAlpha.cpp: 36 (WebCore::SourceAlpha::create): 37 (WebCore::SourceAlpha::SourceAlpha): 38 * platform/graphics/filters/SourceAlpha.h: 39 * rendering/CSSFilter.cpp: 40 (WebCore::createSVGFilter): 41 (WebCore::CSSFilter::buildFilterFunctions): 42 * rendering/svg/RenderSVGResourceFilter.cpp: 43 (WebCore::RenderSVGResourceFilter::applyResource): 44 * rendering/svg/SVGRenderTreeAsText.cpp: 45 (WebCore::writeSVGResourceContainer): 46 * svg/SVGFEBlendElement.cpp: 47 (WebCore::SVGFEBlendElement::filterEffect const): 48 (WebCore::SVGFEBlendElement::build const): Deleted. 49 * svg/SVGFEBlendElement.h: 50 * svg/SVGFEColorMatrixElement.cpp: 51 (WebCore::SVGFEColorMatrixElement::filterEffect const): 52 (WebCore::SVGFEColorMatrixElement::build const): Deleted. 53 * svg/SVGFEColorMatrixElement.h: 54 * svg/SVGFEComponentTransferElement.cpp: 55 (WebCore::SVGFEComponentTransferElement::filterEffect const): 56 (WebCore::SVGFEComponentTransferElement::build const): Deleted. 57 * svg/SVGFEComponentTransferElement.h: 58 * svg/SVGFECompositeElement.cpp: 59 (WebCore::SVGFECompositeElement::filterEffect const): 60 (WebCore::SVGFECompositeElement::build const): Deleted. 61 * svg/SVGFECompositeElement.h: 62 * svg/SVGFEConvolveMatrixElement.cpp: 63 (WebCore::SVGFEConvolveMatrixElement::filterEffect const): 64 (WebCore::SVGFEConvolveMatrixElement::build const): Deleted. 65 * svg/SVGFEConvolveMatrixElement.h: 66 * svg/SVGFEDiffuseLightingElement.cpp: 67 (WebCore::SVGFEDiffuseLightingElement::filterEffect const): 68 (WebCore::SVGFEDiffuseLightingElement::build const): Deleted. 69 * svg/SVGFEDiffuseLightingElement.h: 70 * svg/SVGFEDisplacementMapElement.cpp: 71 (WebCore::SVGFEDisplacementMapElement::filterEffect const): 72 (WebCore::SVGFEDisplacementMapElement::build const): Deleted. 73 * svg/SVGFEDisplacementMapElement.h: 74 * svg/SVGFEDistantLightElement.cpp: 75 (WebCore::SVGFEDistantLightElement::lightSource const): 76 * svg/SVGFEDistantLightElement.h: 77 * svg/SVGFEDropShadowElement.cpp: 78 (WebCore::SVGFEDropShadowElement::filterEffect const): 79 (WebCore::SVGFEDropShadowElement::build const): Deleted. 80 * svg/SVGFEDropShadowElement.h: 81 * svg/SVGFEFloodElement.cpp: 82 (WebCore::SVGFEFloodElement::filterEffect const): 83 (WebCore::SVGFEFloodElement::build const): Deleted. 84 * svg/SVGFEFloodElement.h: 85 * svg/SVGFEGaussianBlurElement.cpp: 86 (WebCore::SVGFEGaussianBlurElement::filterEffect const): 87 (WebCore::SVGFEGaussianBlurElement::build const): Deleted. 88 * svg/SVGFEGaussianBlurElement.h: 89 * svg/SVGFEImageElement.cpp: 90 (WebCore::SVGFEImageElement::filterEffect const): 91 (WebCore::SVGFEImageElement::build const): Deleted. 92 * svg/SVGFEImageElement.h: 93 * svg/SVGFELightElement.h: 94 * svg/SVGFEMergeElement.cpp: 95 (WebCore::SVGFEMergeElement::filterEffectInputsNames const): 96 (WebCore::SVGFEMergeElement::filterEffect const): 97 (WebCore::SVGFEMergeElement::build const): Deleted. 98 * svg/SVGFEMergeElement.h: 99 * svg/SVGFEMorphologyElement.cpp: 100 (WebCore::SVGFEMorphologyElement::filterEffect const): 101 (WebCore::SVGFEMorphologyElement::build const): Deleted. 102 * svg/SVGFEMorphologyElement.h: 103 * svg/SVGFEOffsetElement.cpp: 104 (WebCore::SVGFEOffsetElement::filterEffect const): 105 (WebCore::SVGFEOffsetElement::build const): Deleted. 106 * svg/SVGFEOffsetElement.h: 107 * svg/SVGFEPointLightElement.cpp: 108 (WebCore::SVGFEPointLightElement::lightSource const): 109 * svg/SVGFEPointLightElement.h: 110 * svg/SVGFESpecularLightingElement.cpp: 111 (WebCore::SVGFESpecularLightingElement::filterEffect const): 112 (WebCore::SVGFESpecularLightingElement::build const): Deleted. 113 * svg/SVGFESpecularLightingElement.h: 114 * svg/SVGFESpotLightElement.cpp: 115 (WebCore::SVGFESpotLightElement::lightSource const): 116 * svg/SVGFESpotLightElement.h: 117 * svg/SVGFETileElement.cpp: 118 (WebCore::SVGFETileElement::filterEffect const): 119 (WebCore::SVGFETileElement::build const): Deleted. 120 * svg/SVGFETileElement.h: 121 * svg/SVGFETurbulenceElement.cpp: 122 (WebCore::SVGFETurbulenceElement::filterEffect const): 123 (WebCore::SVGFETurbulenceElement::build const): Deleted. 124 * svg/SVGFETurbulenceElement.h: 125 * svg/SVGFilterPrimitiveStandardAttributes.h: 126 (WebCore::SVGFilterPrimitiveStandardAttributes::filterEffectInputsNames const): 127 * svg/graphics/filters/SVGFilter.cpp: 128 (WebCore::SVGFilter::create): 129 * svg/graphics/filters/SVGFilter.h: 130 * svg/graphics/filters/SVGFilterBuilder.cpp: 131 (WebCore::SVGFilterBuilder::setupBuiltinEffects): 132 (WebCore::SVGFilterBuilder::buildFilterEffects): 133 (WebCore::SVGFilterBuilder::sourceGraphic const): 134 (WebCore::SVGFilterBuilder::sourceAlpha const): 135 (WebCore::SVGFilterBuilder::addNamedEffect): 136 (WebCore::SVGFilterBuilder::namedEffect const): 137 (WebCore::SVGFilterBuilder::namedEffects const): 138 (WebCore::SVGFilterBuilder::setEffectInputs): 139 (WebCore::SVGFilterBuilder::buildEffectExpression const): 140 (WebCore::SVGFilterBuilder::add): Deleted. 141 (WebCore::SVGFilterBuilder::getEffectById const): Deleted. 142 * svg/graphics/filters/SVGFilterBuilder.h: 143 1 144 2022-01-11 Sam Weinig <weinig@apple.com> 2 145 -
trunk/Source/WebCore/platform/graphics/filters/FilterEffect.cpp
r287782 r287892 150 150 } 151 151 152 FilterEffect& FilterEffect::inputEffect(unsigned number) const153 {154 ASSERT_WITH_SECURITY_IMPLICATION(number < m_inputEffects.size());155 return m_inputEffects.at(number);156 }157 158 152 TextStream& FilterEffect::externalRepresentation(TextStream& ts, FilterRepresentation representation) const 159 153 { -
trunk/Source/WebCore/platform/graphics/filters/FilterEffect.h
r287782 r287892 24 24 25 25 #include "DestinationColorSpace.h" 26 #include "FilterEffectVector.h"27 26 #include "FilterFunction.h" 28 #include "FilterImage.h"29 27 #include "FilterImageVector.h" 30 #include <wtf/Vector.h>31 28 32 29 namespace WTF { … … 39 36 class FilterEffectApplier; 40 37 class FilterEffectGeometry; 38 class FilterResults; 41 39 42 40 class FilterEffect : public FilterFunction { … … 44 42 45 43 public: 46 FilterImageVector takeImageInputs(FilterImageVector& stack) const;47 48 FilterEffectVector& inputEffects() { return m_inputEffects; }49 FilterEffect& inputEffect(unsigned) const;50 51 RefPtr<FilterImage> apply(const Filter&, const FilterImageVector& inputs, FilterResults&, const std::optional<FilterEffectGeometry>& = std::nullopt);52 53 44 const DestinationColorSpace& operatingColorSpace() const { return m_operatingColorSpace; } 54 45 virtual void setOperatingColorSpace(const DestinationColorSpace& colorSpace) { m_operatingColorSpace = colorSpace; } 46 47 FilterImageVector takeImageInputs(FilterImageVector& stack) const; 48 RefPtr<FilterImage> apply(const Filter&, const FilterImageVector& inputs, FilterResults&, const std::optional<FilterEffectGeometry>& = std::nullopt); 55 49 56 50 WTF::TextStream& externalRepresentation(WTF::TextStream&, FilterRepresentation) const override; … … 81 75 RefPtr<FilterImage> apply(const Filter&, FilterImage& input, FilterResults&) override; 82 76 83 FilterEffectVector m_inputEffects;84 85 77 DestinationColorSpace m_operatingColorSpace { DestinationColorSpace::SRGB() }; 86 78 }; -
trunk/Source/WebCore/platform/graphics/filters/SourceAlpha.cpp
r286864 r287892 1 1 /* 2 2 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 3 * Copyright (C) 2021 Apple Inc. All rights reserved.3 * Copyright (C) 2021-2022 Apple Inc. All rights reserved. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 22 22 #include "SourceAlpha.h" 23 23 24 #include "ImageBuffer.h"25 24 #include "SourceAlphaSoftwareApplier.h" 26 25 #include <wtf/text/TextStream.h> … … 28 27 namespace WebCore { 29 28 30 Ref<SourceAlpha> SourceAlpha::create( )29 Ref<SourceAlpha> SourceAlpha::create(const DestinationColorSpace& colorSpace) 31 30 { 32 return adoptRef(*new SourceAlpha( ));31 return adoptRef(*new SourceAlpha(colorSpace)); 33 32 } 34 33 35 Ref<SourceAlpha> SourceAlpha::create(FilterEffect& sourceEffect) 36 { 37 return adoptRef(*new SourceAlpha(sourceEffect)); 38 } 39 40 SourceAlpha::SourceAlpha() 34 SourceAlpha::SourceAlpha(const DestinationColorSpace& colorSpace) 41 35 : FilterEffect(FilterEffect::Type::SourceAlpha) 42 36 { 43 } 44 45 SourceAlpha::SourceAlpha(FilterEffect& sourceEffect) 46 : FilterEffect(FilterEffect::Type::SourceAlpha) 47 { 48 setOperatingColorSpace(sourceEffect.operatingColorSpace()); 49 inputEffects().append(sourceEffect); 37 setOperatingColorSpace(colorSpace); 50 38 } 51 39 -
trunk/Source/WebCore/platform/graphics/filters/SourceAlpha.h
r286765 r287892 27 27 class SourceAlpha : public FilterEffect { 28 28 public: 29 WEBCORE_EXPORT static Ref<SourceAlpha> create(); 30 static Ref<SourceAlpha> create(FilterEffect&); 29 WEBCORE_EXPORT static Ref<SourceAlpha> create(const DestinationColorSpace& = DestinationColorSpace::SRGB()); 31 30 32 31 static AtomString effectName() { return FilterEffect::sourceAlphaName(); } 33 32 34 33 private: 35 SourceAlpha(); 36 explicit SourceAlpha(FilterEffect&); 34 explicit SourceAlpha(const DestinationColorSpace&); 37 35 38 36 std::unique_ptr<FilterEffectApplier> createApplier(const Filter&) const override; -
trunk/Source/WebCore/rendering/CSSFilter.cpp
r287782 r287892 219 219 } 220 220 221 static RefPtr<SVGFilter> createSVGFilter(CSSFilter& filter, const ReferenceFilterOperation& filterOperation, RenderElement& renderer, const FloatRect& targetBoundingBox , FilterEffect& previousEffect)221 static RefPtr<SVGFilter> createSVGFilter(CSSFilter& filter, const ReferenceFilterOperation& filterOperation, RenderElement& renderer, const FloatRect& targetBoundingBox) 222 222 { 223 223 auto& referencedSVGResources = renderer.ensureReferencedSVGResources(); … … 233 233 234 234 SVGFilterBuilder builder; 235 return SVGFilter::create(*filterElement, builder, filter.renderingMode(), filter.filterScale(), filter.clipOperation(), targetBoundingBox, previousEffect);235 return SVGFilter::create(*filterElement, builder, filter.renderingMode(), filter.filterScale(), filter.clipOperation(), targetBoundingBox, targetBoundingBox); 236 236 } 237 237 … … 241 241 m_outsets = { }; 242 242 243 RefPtr<FilterEffect> previousEffect = SourceGraphic::create();244 243 RefPtr<SVGFilter> filter; 245 244 … … 293 292 294 293 case FilterOperation::REFERENCE: 295 filter = createSVGFilter(*this, downcast<ReferenceFilterOperation>(*operation), renderer, targetBoundingBox , *previousEffect);294 filter = createSVGFilter(*this, downcast<ReferenceFilterOperation>(*operation), renderer, targetBoundingBox); 296 295 effect = nullptr; 297 296 break; … … 301 300 } 302 301 303 if ((filter || effect) && m_functions.isEmpty()) { 304 ASSERT(previousEffect->filterType() == FilterEffect::Type::SourceGraphic); 305 m_functions.append({ *previousEffect }); 306 } 302 if ((filter || effect) && m_functions.isEmpty()) 303 m_functions.append(SourceGraphic::create()); 307 304 308 305 if (filter) { … … 310 307 effect->setOperatingColorSpace(DestinationColorSpace::SRGB()); 311 308 m_functions.append(filter.releaseNonNull()); 312 previousEffect = WTFMove(effect);313 309 continue; 314 310 } … … 316 312 if (effect) { 317 313 effect->setOperatingColorSpace(DestinationColorSpace::SRGB()); 318 effect->inputEffects() = { previousEffect.releaseNonNull() }; 319 m_functions.append({ *effect }); 320 previousEffect = WTFMove(effect); 314 m_functions.append(effect.releaseNonNull()); 321 315 } 322 316 } -
trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp
r287832 r287892 130 130 // Create the SVGFilter object. 131 131 filterData->builder = makeUnique<SVGFilterBuilder>(); 132 filterData->filter = SVGFilter::create(filterElement(), *filterData->builder, renderingMode, filterScale, filterData->boundaries, targetBoundingBox);132 filterData->filter = SVGFilter::create(filterElement(), *filterData->builder, renderingMode, filterScale, Filter::ClipOperation::Intersect, filterData->boundaries, targetBoundingBox); 133 133 if (!filterData->filter) { 134 134 m_rendererFilterDataMap.remove(&renderer); -
trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp
r287832 r287892 475 475 FloatSize dummyScale(1, 1); 476 476 SVGFilterBuilder builder; 477 auto dummyFilter = SVGFilter::create(filter.filterElement(), builder, RenderingMode::Unaccelerated, dummyScale, dummyRect, dummyRect);477 auto dummyFilter = SVGFilter::create(filter.filterElement(), builder, RenderingMode::Unaccelerated, dummyScale, Filter::ClipOperation::Intersect, dummyRect, dummyRect); 478 478 if (dummyFilter) { 479 479 TextStream::IndentScope indentScope(ts); -
trunk/Source/WebCore/svg/SVGFEBlendElement.cpp
r286864 r287892 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 4 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved. 5 * Copyright (C) 2018-20 19Apple Inc. All rights reserved.5 * Copyright (C) 2018-2022 Apple Inc. All rights reserved. 6 6 * 7 7 * This library is free software; you can redistribute it and/or … … 25 25 26 26 #include "FEBlend.h" 27 #include "FilterEffect.h"28 #include "SVGFilterBuilder.h"29 27 #include "SVGNames.h" 30 28 #include <wtf/IsoMallocInlines.h> … … 101 99 } 102 100 103 RefPtr<FilterEffect> SVGFEBlendElement:: build(SVGFilterBuilder& filterBuilder) const101 RefPtr<FilterEffect> SVGFEBlendElement::filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const 104 102 { 105 auto input1 = filterBuilder.getEffectById(in1()); 106 auto input2 = filterBuilder.getEffectById(in2()); 107 108 if (!input1 || !input2) 109 return nullptr; 110 111 auto effect = FEBlend::create(mode()); 112 effect->inputEffects() = { input1.releaseNonNull(), input2.releaseNonNull() }; 113 return effect; 103 return FEBlend::create(mode()); 114 104 } 115 105 116 } 106 } // namespace WebCore -
trunk/Source/WebCore/svg/SVGFEBlendElement.h
r285796 r287892 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 4 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved. 5 * Copyright (C) 2018-20 19Apple Inc. All rights reserved.5 * Copyright (C) 2018-2022 Apple Inc. All rights reserved. 6 6 * 7 7 * This library is free software; you can redistribute it and/or … … 70 70 void svgAttributeChanged(const QualifiedName&) override; 71 71 72 RefPtr<FilterEffect> build(SVGFilterBuilder&) const override;73 72 bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName) override; 73 Vector<AtomString> filterEffectInputsNames() const override { return { in1(), in2() }; } 74 RefPtr<FilterEffect> filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const override; 74 75 75 76 PropertyRegistry m_propertyRegistry { *this }; -
trunk/Source/WebCore/svg/SVGFEColorMatrixElement.cpp
r286864 r287892 2 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018-20 19Apple Inc. All rights reserved.4 * Copyright (C) 2018-2022 Apple Inc. All rights reserved. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 23 23 #include "SVGFEColorMatrixElement.h" 24 24 25 #include "FilterEffect.h" 26 #include "SVGFilterBuilder.h" 25 #include "FEColorMatrix.h" 27 26 #include "SVGNames.h" 28 27 #include <wtf/IsoMallocInlines.h> … … 101 100 } 102 101 103 RefPtr<FilterEffect> SVGFEColorMatrixElement:: build(SVGFilterBuilder& filterBuilder) const102 RefPtr<FilterEffect> SVGFEColorMatrixElement::filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const 104 103 { 105 auto input1 = filterBuilder.getEffectById(in1());106 107 if (!input1)108 return nullptr;109 110 104 Vector<float> filterValues; 111 105 ColorMatrixType filterType = type(); … … 137 131 || (filterType == FECOLORMATRIX_TYPE_SATURATE && size != 1)) 138 132 return nullptr; 139 133 140 134 filterValues = values(); 141 135 filterValues.shrinkToFit(); 142 136 } 143 137 144 auto effect = FEColorMatrix::create(filterType, WTFMove(filterValues)); 145 effect->inputEffects() = { input1.releaseNonNull() }; 146 return effect; 138 return FEColorMatrix::create(filterType, WTFMove(filterValues)); 147 139 } 148 140 -
trunk/Source/WebCore/svg/SVGFEColorMatrixElement.h
r285796 r287892 2 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018-20 19Apple Inc. All rights reserved.4 * Copyright (C) 2018-2022 Apple Inc. All rights reserved. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 87 87 88 88 bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override; 89 RefPtr<FilterEffect> build(SVGFilterBuilder&) const override; 89 Vector<AtomString> filterEffectInputsNames() const override { return { in1() }; } 90 RefPtr<FilterEffect> filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const override; 90 91 91 92 PropertyRegistry m_propertyRegistry { *this }; -
trunk/Source/WebCore/svg/SVGFEComponentTransferElement.cpp
r286864 r287892 2 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018-20 19Apple Inc. All rights reserved.4 * Copyright (C) 2018-2022 Apple Inc. All rights reserved. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 24 24 25 25 #include "ElementIterator.h" 26 #include "F ilterEffect.h"26 #include "FEComponentTransfer.h" 27 27 #include "SVGElementTypeHelpers.h" 28 28 #include "SVGFEFuncAElement.h" … … 30 30 #include "SVGFEFuncGElement.h" 31 31 #include "SVGFEFuncRElement.h" 32 #include "SVGFilterBuilder.h"33 32 #include "SVGNames.h" 34 33 #include <wtf/IsoMallocInlines.h> … … 64 63 } 65 64 66 RefPtr<FilterEffect> SVGFEComponentTransferElement:: build(SVGFilterBuilder& filterBuilder) const65 RefPtr<FilterEffect> SVGFEComponentTransferElement::filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const 67 66 { 68 auto input1 = filterBuilder.getEffectById(in1());69 70 if (!input1)71 return nullptr;72 73 67 ComponentTransferFunction red; 74 68 ComponentTransferFunction green; … … 87 81 } 88 82 89 auto effect = FEComponentTransfer::create(red, green, blue, alpha); 90 effect->inputEffects() = { input1.releaseNonNull() }; 91 return effect; 83 return FEComponentTransfer::create(red, green, blue, alpha); 92 84 } 93 85 94 } 86 } // namespace WebCore -
trunk/Source/WebCore/svg/SVGFEComponentTransferElement.h
r285796 r287892 3 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 4 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 5 * Copyright (C) 2018-20 19Apple Inc. All rights reserved.5 * Copyright (C) 2018-2022 Apple Inc. All rights reserved. 6 6 * 7 7 * This library is free software; you can redistribute it and/or … … 44 44 void parseAttribute(const QualifiedName&, const AtomString&) override; 45 45 46 RefPtr<FilterEffect> build(SVGFilterBuilder&) const override; 46 Vector<AtomString> filterEffectInputsNames() const override { return { in1() }; } 47 RefPtr<FilterEffect> filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const override; 47 48 48 49 PropertyRegistry m_propertyRegistry { *this }; -
trunk/Source/WebCore/svg/SVGFECompositeElement.cpp
r286864 r287892 2 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018-20 19Apple Inc. All rights reserved.4 * Copyright (C) 2018-2022 Apple Inc. All rights reserved. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 23 23 #include "SVGFECompositeElement.h" 24 24 25 #include "FilterEffect.h" 26 #include "SVGFilterBuilder.h" 25 #include "FEComposite.h" 27 26 #include "SVGNames.h" 28 27 #include <wtf/IsoMallocInlines.h> … … 132 131 } 133 132 134 RefPtr<FilterEffect> SVGFECompositeElement:: build(SVGFilterBuilder& filterBuilder) const133 RefPtr<FilterEffect> SVGFECompositeElement::filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const 135 134 { 136 auto input1 = filterBuilder.getEffectById(in1()); 137 auto input2 = filterBuilder.getEffectById(in2()); 138 139 if (!input1 || !input2) 140 return nullptr; 141 142 auto effect = FEComposite::create(svgOperator(), k1(), k2(), k3(), k4()); 143 effect->inputEffects() = { input1.releaseNonNull(), input2.releaseNonNull() }; 144 return effect; 135 return FEComposite::create(svgOperator(), k1(), k2(), k3(), k4()); 145 136 } 146 137 147 } 138 } // namespace WebCore -
trunk/Source/WebCore/svg/SVGFECompositeElement.h
r285796 r287892 2 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018-20 19Apple Inc. All rights reserved.4 * Copyright (C) 2018-2022 Apple Inc. All rights reserved. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 110 110 111 111 bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override; 112 RefPtr<FilterEffect> build(SVGFilterBuilder&) const override; 112 Vector<AtomString> filterEffectInputsNames() const override { return { in1(), in2() }; } 113 RefPtr<FilterEffect> filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const override; 113 114 114 115 PropertyRegistry m_propertyRegistry { *this }; -
trunk/Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp
r286864 r287892 1 1 /* 2 2 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 3 * Copyright (C) 2018-20 19Apple Inc. All rights reserved.3 * Copyright (C) 2018-2022 Apple Inc. All rights reserved. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 22 22 #include "SVGFEConvolveMatrixElement.h" 23 23 24 #include "FilterEffect.h" 25 #include "FloatPoint.h" 26 #include "IntPoint.h" 27 #include "IntSize.h" 28 #include "SVGFilterBuilder.h" 24 #include "FEConvolveMatrix.h" 29 25 #include "SVGNames.h" 30 26 #include "SVGParserUtilities.h" … … 192 188 } 193 189 194 RefPtr<FilterEffect> SVGFEConvolveMatrixElement::build(SVGFilterBuilder& filterBuilder) const 195 { 196 auto input1 = filterBuilder.getEffectById(in1()); 197 198 if (!input1) 199 return nullptr; 200 190 RefPtr<FilterEffect> SVGFEConvolveMatrixElement::filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const 191 { 201 192 int orderXValue = orderX(); 202 193 int orderYValue = orderY(); … … 208 199 if (orderXValue < 1 || orderYValue < 1) 209 200 return nullptr; 201 210 202 auto& kernelMatrix = this->kernelMatrix(); 211 203 int kernelMatrixSize = kernelMatrix.items().size(); … … 218 210 if (hasAttribute(SVGNames::targetXAttr) && (targetXValue < 0 || targetXValue >= orderXValue)) 219 211 return nullptr; 212 220 213 // The spec says the default value is: targetX = floor ( orderX / 2 )) 221 214 if (!hasAttribute(SVGNames::targetXAttr)) … … 223 216 if (hasAttribute(SVGNames::targetYAttr) && (targetYValue < 0 || targetYValue >= orderYValue)) 224 217 return nullptr; 218 225 219 // The spec says the default value is: targetY = floor ( orderY / 2 )) 226 220 if (!hasAttribute(SVGNames::targetYAttr)) … … 240 234 if (hasAttribute(SVGNames::divisorAttr) && !divisorValue) 241 235 return nullptr; 236 242 237 if (!hasAttribute(SVGNames::divisorAttr)) { 243 238 for (int i = 0; i < kernelMatrixSize; ++i) … … 247 242 } 248 243 249 auto effect = FEConvolveMatrix::create(IntSize(orderXValue, orderYValue), divisorValue, bias(), IntPoint(targetXValue, targetYValue), edgeMode(), FloatPoint(kernelUnitLengthXValue, kernelUnitLengthYValue), preserveAlpha(), kernelMatrix); 250 effect->inputEffects() = { input1.releaseNonNull() }; 251 return effect; 244 return FEConvolveMatrix::create(IntSize(orderXValue, orderYValue), divisorValue, bias(), IntPoint(targetXValue, targetYValue), edgeMode(), FloatPoint(kernelUnitLengthXValue, kernelUnitLengthYValue), preserveAlpha(), kernelMatrix); 252 245 } 253 246 -
trunk/Source/WebCore/svg/SVGFEConvolveMatrixElement.h
r286152 r287892 1 1 /* 2 2 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 3 * Copyright (C) 2018-20 19Apple Inc. All rights reserved.3 * Copyright (C) 2018-2022 Apple Inc. All rights reserved. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 104 104 105 105 bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override; 106 RefPtr<FilterEffect> build(SVGFilterBuilder&) const override; 106 Vector<AtomString> filterEffectInputsNames() const override { return { in1() }; } 107 RefPtr<FilterEffect> filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const override; 107 108 108 109 PropertyRegistry m_propertyRegistry { *this }; -
trunk/Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp
r286864 r287892 1 1 /* 2 2 * Copyright (C) 2005 Oliver Hunt <ojh16@student.canterbury.ac.nz> 3 * Copyright (C) 2018 Apple Inc. All rights reserved.3 * Copyright (C) 2018-2022 Apple Inc. All rights reserved. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 23 23 24 24 #include "FEDiffuseLighting.h" 25 #include "FilterEffect.h"26 25 #include "RenderStyle.h" 27 26 #include "SVGFELightElement.h" 28 #include "SVGFilterBuilder.h"29 27 #include "SVGNames.h" 30 28 #include "SVGParserUtilities.h" … … 152 150 } 153 151 154 RefPtr<FilterEffect> SVGFEDiffuseLightingElement:: build(SVGFilterBuilder& filterBuilder) const152 RefPtr<FilterEffect> SVGFEDiffuseLightingElement::filterEffect(const SVGFilterBuilder& filterBuilder, const FilterEffectVector&) const 155 153 { 156 auto input1 = filterBuilder.getEffectById(in1());157 158 if (!input1)159 return nullptr;160 161 154 RefPtr lightElement = SVGFELightElement::findLightElement(this); 162 155 if (!lightElement) … … 171 164 Color color = renderer->style().colorByApplyingColorFilter(renderer->style().svgStyle().lightingColor()); 172 165 173 auto effect = FEDiffuseLighting::create(color, surfaceScale(), diffuseConstant(), kernelUnitLengthX(), kernelUnitLengthY(), WTFMove(lightSource)); 174 effect->inputEffects() = { input1.releaseNonNull() }; 175 return effect; 166 return FEDiffuseLighting::create(color, surfaceScale(), diffuseConstant(), kernelUnitLengthX(), kernelUnitLengthY(), WTFMove(lightSource)); 176 167 } 177 168 178 } 169 } // namespace WebCore -
trunk/Source/WebCore/svg/SVGFEDiffuseLightingElement.h
r285796 r287892 3 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 4 4 * Copyright (C) 2005 Oliver Hunt <oliver@nerget.com> 5 * Copyright (C) 2018-20 19Apple Inc. All rights reserved.5 * Copyright (C) 2018-2022 Apple Inc. All rights reserved. 6 6 * 7 7 * This library is free software; you can redistribute it and/or … … 59 59 60 60 bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override; 61 RefPtr<FilterEffect> build(SVGFilterBuilder&) const override; 61 Vector<AtomString> filterEffectInputsNames() const override { return { in1() }; } 62 RefPtr<FilterEffect> filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const override; 62 63 63 64 PropertyRegistry m_propertyRegistry { *this }; -
trunk/Source/WebCore/svg/SVGFEDisplacementMapElement.cpp
r286864 r287892 1 1 /* 2 2 * Copyright (C) 2006 Oliver Hunt <oliver@nerget.com> 3 * Copyright (C) 2018-20 19Apple Inc. All rights reserved.3 * Copyright (C) 2018-2022 Apple Inc. All rights reserved. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 22 22 #include "SVGFEDisplacementMapElement.h" 23 23 24 #include "FilterEffect.h" 25 #include "SVGFilterBuilder.h" 24 #include "FEDisplacementMap.h" 26 25 #include "SVGNames.h" 27 26 #include <wtf/IsoMallocInlines.h> … … 116 115 } 117 116 118 RefPtr<FilterEffect> SVGFEDisplacementMapElement:: build(SVGFilterBuilder& filterBuilder) const117 RefPtr<FilterEffect> SVGFEDisplacementMapElement::filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const 119 118 { 120 auto input1 = filterBuilder.getEffectById(in1()); 121 auto input2 = filterBuilder.getEffectById(in2()); 122 123 if (!input1 || !input2) 124 return nullptr; 125 126 auto effect = FEDisplacementMap::create(xChannelSelector(), yChannelSelector(), scale()); 127 effect->inputEffects() = { input1.releaseNonNull(), input2.releaseNonNull() }; 128 return effect; 119 return FEDisplacementMap::create(xChannelSelector(), yChannelSelector(), scale()); 129 120 } 130 121 131 } 122 } // namespace WebCore -
trunk/Source/WebCore/svg/SVGFEDisplacementMapElement.h
r285796 r287892 1 1 /* 2 2 * Copyright (C) 2006 Oliver Hunt <oliver@nerget.com> 3 * Copyright (C) 2018-20 19Apple Inc. All rights reserved.3 * Copyright (C) 2018-2022 Apple Inc. All rights reserved. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 92 92 93 93 bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName) override; 94 RefPtr<FilterEffect> build(SVGFilterBuilder&) const override; 94 Vector<AtomString> filterEffectInputsNames() const override { return { in1(), in2() }; } 95 RefPtr<FilterEffect> filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const override; 95 96 96 97 PropertyRegistry m_propertyRegistry { *this }; -
trunk/Source/WebCore/svg/SVGFEDistantLightElement.cpp
r226373 r287892 37 37 } 38 38 39 Ref<LightSource> SVGFEDistantLightElement::lightSource( SVGFilterBuilder&) const39 Ref<LightSource> SVGFEDistantLightElement::lightSource(const SVGFilterBuilder&) const 40 40 { 41 41 return DistantLightSource::create(azimuth(), elevation()); -
trunk/Source/WebCore/svg/SVGFEDistantLightElement.h
r250060 r287892 31 31 SVGFEDistantLightElement(const QualifiedName&, Document&); 32 32 33 Ref<LightSource> lightSource( SVGFilterBuilder&) const override;33 Ref<LightSource> lightSource(const SVGFilterBuilder&) const override; 34 34 }; 35 35 static_assert(sizeof(SVGFEDistantLightElement) == sizeof(SVGFELightElement)); -
trunk/Source/WebCore/svg/SVGFEDropShadowElement.cpp
r286864 r287892 1 1 /* 2 2 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 3 * Copyright (C) 2018-20 19Apple Inc. All rights reserved.3 * Copyright (C) 2018-2022 Apple Inc. All rights reserved. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 23 23 24 24 #include "RenderStyle.h" 25 #include "SVGFilterBuilder.h"26 25 #include "SVGNames.h" 27 26 #include "SVGParserUtilities.h" … … 98 97 } 99 98 100 RefPtr<FilterEffect> SVGFEDropShadowElement:: build(SVGFilterBuilder& filterBuilder) const99 RefPtr<FilterEffect> SVGFEDropShadowElement::filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const 101 100 { 102 auto input1 = filterBuilder.getEffectById(in1());103 if (!input1)104 return nullptr;105 106 101 RenderObject* renderer = this->renderer(); 107 102 if (!renderer) … … 116 111 float opacity = svgStyle.floodOpacity(); 117 112 118 auto effect = FEDropShadow::create(stdDeviationX(), stdDeviationY(), dx(), dy(), color, opacity); 119 effect->inputEffects() = { input1.releaseNonNull() }; 120 return effect; 113 return FEDropShadow::create(stdDeviationX(), stdDeviationY(), dx(), dy(), color, opacity); 121 114 } 122 115 123 } 116 } // namespace WebCore -
trunk/Source/WebCore/svg/SVGFEDropShadowElement.h
r285796 r287892 1 1 /* 2 2 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 3 * Copyright (C) 2018-20 19Apple Inc. All rights reserved.3 * Copyright (C) 2018-2022 Apple Inc. All rights reserved. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 54 54 void svgAttributeChanged(const QualifiedName&) override; 55 55 56 RefPtr<FilterEffect> build(SVGFilterBuilder&) const override; 56 Vector<AtomString> filterEffectInputsNames() const override { return { in1() }; } 57 RefPtr<FilterEffect> filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const override; 57 58 58 59 PropertyRegistry m_propertyRegistry { *this }; -
trunk/Source/WebCore/svg/SVGFEFloodElement.cpp
r285796 r287892 2 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2007, 2008 Rob Buis <buis@kde.org> 4 * Copyright (C) 2022 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 59 60 } 60 61 61 RefPtr<FilterEffect> SVGFEFloodElement:: build(SVGFilterBuilder&) const62 RefPtr<FilterEffect> SVGFEFloodElement::filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const 62 63 { 63 64 RenderObject* renderer = this->renderer(); 64 65 if (!renderer) 65 66 return nullptr; 66 67 67 68 const SVGRenderStyle& svgStyle = renderer->style().svgStyle(); 68 69 … … 73 74 } 74 75 75 } 76 } // namespace WebCore -
trunk/Source/WebCore/svg/SVGFEFloodElement.h
r285796 r287892 2 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2008 Rob Buis <buis@kde.org> 4 * Copyright (C) 2022 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 37 38 38 39 bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName) override; 39 RefPtr<FilterEffect> build(SVGFilterBuilder&) const override;40 RefPtr<FilterEffect> filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const override; 40 41 41 42 PropertyRegistry m_propertyRegistry { *this }; -
trunk/Source/WebCore/svg/SVGFEGaussianBlurElement.cpp
r286864 r287892 2 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018-20 19Apple Inc. All rights reserved.4 * Copyright (C) 2018-2022 Apple Inc. All rights reserved. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 23 23 #include "SVGFEGaussianBlurElement.h" 24 24 25 #include "FilterEffect.h" 26 #include "SVGFilterBuilder.h" 25 #include "FEGaussianBlur.h" 27 26 #include "SVGNames.h" 28 27 #include "SVGParserUtilities.h" … … 96 95 } 97 96 98 RefPtr<FilterEffect> SVGFEGaussianBlurElement:: build(SVGFilterBuilder& filterBuilder) const97 RefPtr<FilterEffect> SVGFEGaussianBlurElement::filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const 99 98 { 100 auto input1 = filterBuilder.getEffectById(in1());101 if (!input1)102 return nullptr;103 104 99 if (stdDeviationX() < 0 || stdDeviationY() < 0) 105 100 return nullptr; 106 101 107 auto effect = FEGaussianBlur::create(stdDeviationX(), stdDeviationY(), edgeMode()); 108 effect->inputEffects() = { input1.releaseNonNull() }; 109 return effect; 102 return FEGaussianBlur::create(stdDeviationX(), stdDeviationY(), edgeMode()); 110 103 } 111 104 112 } 105 } // namespace WebCore -
trunk/Source/WebCore/svg/SVGFEGaussianBlurElement.h
r286152 r287892 2 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018-20 19Apple Inc. All rights reserved.4 * Copyright (C) 2018-2022 Apple Inc. All rights reserved. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 54 54 void svgAttributeChanged(const QualifiedName&) override; 55 55 56 RefPtr<FilterEffect> build(SVGFilterBuilder&) const override; 56 Vector<AtomString> filterEffectInputsNames() const override { return { in1() }; } 57 RefPtr<FilterEffect> filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const override; 57 58 58 59 PropertyRegistry m_propertyRegistry { *this }; -
trunk/Source/WebCore/svg/SVGFEImageElement.cpp
r285796 r287892 3 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 4 4 * Copyright (C) 2010 Dirk Schulze <krit@webkit.org> 5 * Copyright (C) 2018-202 1Apple Inc. All rights reserved.5 * Copyright (C) 2018-2022 Apple Inc. All rights reserved. 6 6 * 7 7 * This library is free software; you can redistribute it and/or … … 209 209 } 210 210 211 RefPtr<FilterEffect> SVGFEImageElement:: build(SVGFilterBuilder&) const211 RefPtr<FilterEffect> SVGFEImageElement::filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const 212 212 { 213 213 if (m_cachedImage) … … 228 228 } 229 229 230 } 230 } // namespace WebCore -
trunk/Source/WebCore/svg/SVGFEImageElement.h
r285796 r287892 2 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018-202 1Apple Inc. All rights reserved.4 * Copyright (C) 2018-2022 Apple Inc. All rights reserved. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 58 58 std::tuple<RefPtr<ImageBuffer>, FloatRect> imageBufferForEffect() const; 59 59 60 RefPtr<FilterEffect> build(SVGFilterBuilder&) const override;60 RefPtr<FilterEffect> filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const override; 61 61 62 62 void clearResourceReferences(); -
trunk/Source/WebCore/svg/SVGFELightElement.h
r246490 r287892 33 33 WTF_MAKE_ISO_ALLOCATED(SVGFELightElement); 34 34 public: 35 virtual Ref<LightSource> lightSource( SVGFilterBuilder&) const = 0;35 virtual Ref<LightSource> lightSource(const SVGFilterBuilder&) const = 0; 36 36 static SVGFELightElement* findLightElement(const SVGElement*); 37 37 -
trunk/Source/WebCore/svg/SVGFEMergeElement.cpp
r286864 r287892 2 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2022 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 24 25 #include "ElementIterator.h" 25 26 #include "FEMerge.h" 26 #include "FilterEffect.h"27 27 #include "SVGElementTypeHelpers.h" 28 28 #include "SVGFEMergeNodeElement.h" 29 #include "SVGFilterBuilder.h"30 29 #include "SVGNames.h" 31 30 #include <wtf/IsoMallocInlines.h> … … 46 45 } 47 46 48 RefPtr<FilterEffect> SVGFEMergeElement::build(SVGFilterBuilder& filterBuilder) const47 Vector<AtomString> SVGFEMergeElement::filterEffectInputsNames() const 49 48 { 50 FilterEffectVector mergeInputs; 51 52 for (auto& mergeNode : childrenOfType<SVGFEMergeNodeElement>(*this)) { 53 auto mergeEffect = filterBuilder.getEffectById(mergeNode.in1()); 54 if (!mergeEffect) 55 return nullptr; 56 mergeInputs.append(mergeEffect.releaseNonNull()); 57 } 58 59 mergeInputs.shrinkToFit(); 60 61 if (mergeInputs.isEmpty()) 62 return nullptr; 63 64 auto effect = FEMerge::create(mergeInputs.size()); 65 effect->inputEffects() = WTFMove(mergeInputs); 66 return effect; 49 Vector<AtomString> inputsNames; 50 for (auto& mergeNode : childrenOfType<SVGFEMergeNodeElement>(*this)) 51 inputsNames.append(mergeNode.in1()); 52 return inputsNames; 67 53 } 68 54 55 RefPtr<FilterEffect> SVGFEMergeElement::filterEffect(const SVGFilterBuilder&, const FilterEffectVector& inputs) const 56 { 57 return FEMerge::create(inputs.size()); 69 58 } 59 60 } // namespace WebCore -
trunk/Source/WebCore/svg/SVGFEMergeElement.h
r285796 r287892 2 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2022 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 36 37 const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; } 37 38 38 RefPtr<FilterEffect> build(SVGFilterBuilder&) const override; 39 Vector<AtomString> filterEffectInputsNames() const override; 40 RefPtr<FilterEffect> filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const override; 39 41 40 42 PropertyRegistry m_propertyRegistry { *this }; -
trunk/Source/WebCore/svg/SVGFEMorphologyElement.cpp
r286864 r287892 1 1 /* 2 2 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 3 * Copyright (C) 2018-20 19Apple Inc. All rights reserved.3 * Copyright (C) 2018-2022 Apple Inc. All rights reserved. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 22 22 #include "SVGFEMorphologyElement.h" 23 23 24 #include "FilterEffect.h" 25 #include "SVGFilterBuilder.h" 24 #include "FEMorphology.h" 26 25 #include "SVGNames.h" 27 26 #include "SVGParserUtilities.h" … … 115 114 } 116 115 117 RefPtr<FilterEffect> SVGFEMorphologyElement:: build(SVGFilterBuilder& filterBuilder) const116 RefPtr<FilterEffect> SVGFEMorphologyElement::filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const 118 117 { 119 auto input1 = filterBuilder.getEffectById(in1()); 120 if (!input1) 118 if (radiusX() < 0 || radiusY() < 0) 121 119 return nullptr; 122 120 123 float xRadius = radiusX(); 124 float yRadius = radiusY(); 125 if (xRadius < 0 || yRadius < 0) 126 return nullptr; 127 128 auto effect = FEMorphology::create(svgOperator(), xRadius, yRadius); 129 effect->inputEffects() = { input1.releaseNonNull() }; 130 return effect; 121 return FEMorphology::create(svgOperator(), radiusX(), radiusY()); 131 122 } 132 123 -
trunk/Source/WebCore/svg/SVGFEMorphologyElement.h
r286152 r287892 1 1 /* 2 2 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 3 * Copyright (C) 2018-20 19Apple Inc. All rights reserved.3 * Copyright (C) 2018-2022 Apple Inc. All rights reserved. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 82 82 83 83 bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override; 84 RefPtr<FilterEffect> build(SVGFilterBuilder&) const override; 84 Vector<AtomString> filterEffectInputsNames() const override { return { in1() }; } 85 RefPtr<FilterEffect> filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const override; 85 86 86 87 PropertyRegistry m_propertyRegistry { *this }; -
trunk/Source/WebCore/svg/SVGFEOffsetElement.cpp
r286864 r287892 2 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018-20 19Apple Inc. All rights reserved.4 * Copyright (C) 2018-2022 Apple Inc. All rights reserved. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 24 24 25 25 #include "FEOffset.h" 26 #include "FilterEffect.h"27 #include "SVGFilterBuilder.h"28 26 #include "SVGNames.h" 29 27 #include <wtf/IsoMallocInlines.h> … … 82 80 } 83 81 84 RefPtr<FilterEffect> SVGFEOffsetElement:: build(SVGFilterBuilder& filterBuilder) const82 RefPtr<FilterEffect> SVGFEOffsetElement::filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const 85 83 { 86 auto input1 = filterBuilder.getEffectById(in1()); 87 if (!input1) 88 return nullptr; 89 90 auto effect = FEOffset::create(dx(), dy()); 91 effect->inputEffects() = { input1.releaseNonNull() }; 92 return effect; 84 return FEOffset::create(dx(), dy()); 93 85 } 94 86 95 } 87 } // namespace WebCore -
trunk/Source/WebCore/svg/SVGFEOffsetElement.h
r285796 r287892 2 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018-20 19Apple Inc. All rights reserved.4 * Copyright (C) 2018-2022 Apple Inc. All rights reserved. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 48 48 void svgAttributeChanged(const QualifiedName&) override; 49 49 50 RefPtr<FilterEffect> build(SVGFilterBuilder&) const override; 50 Vector<AtomString> filterEffectInputsNames() const override { return { in1() }; } 51 RefPtr<FilterEffect> filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const override; 51 52 52 53 PropertyRegistry m_propertyRegistry { *this }; -
trunk/Source/WebCore/svg/SVGFEPointLightElement.cpp
r286837 r287892 41 41 } 42 42 43 Ref<LightSource> SVGFEPointLightElement::lightSource( SVGFilterBuilder& builder) const43 Ref<LightSource> SVGFEPointLightElement::lightSource(const SVGFilterBuilder& builder) const 44 44 { 45 45 FloatPoint3D position; -
trunk/Source/WebCore/svg/SVGFEPointLightElement.h
r250060 r287892 31 31 SVGFEPointLightElement(const QualifiedName&, Document&); 32 32 33 Ref<LightSource> lightSource( SVGFilterBuilder&) const override;33 Ref<LightSource> lightSource(const SVGFilterBuilder&) const override; 34 34 }; 35 35 static_assert(sizeof(SVGFEPointLightElement) == sizeof(SVGFELightElement)); -
trunk/Source/WebCore/svg/SVGFESpecularLightingElement.cpp
r286864 r287892 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 4 * Copyright (C) 2005 Oliver Hunt <oliver@nerget.com> 5 * Copyright (C) 2018 Apple Inc. All rights reserved.5 * Copyright (C) 2018-2022 Apple Inc. All rights reserved. 6 6 * 7 7 * This library is free software; you can redistribute it and/or … … 24 24 #include "SVGFESpecularLightingElement.h" 25 25 26 #include "F ilterEffect.h"26 #include "FESpecularLighting.h" 27 27 #include "RenderStyle.h" 28 28 #include "SVGFELightElement.h" 29 #include "SVGFilterBuilder.h"30 29 #include "SVGNames.h" 31 30 #include "SVGParserUtilities.h" … … 161 160 } 162 161 163 RefPtr<FilterEffect> SVGFESpecularLightingElement:: build(SVGFilterBuilder& filterBuilder) const162 RefPtr<FilterEffect> SVGFESpecularLightingElement::filterEffect(const SVGFilterBuilder& filterBuilder, const FilterEffectVector&) const 164 163 { 165 auto input1 = filterBuilder.getEffectById(in1());166 if (!input1)167 return nullptr;168 169 164 RefPtr lightElement = SVGFELightElement::findLightElement(this); 170 165 if (!lightElement) 171 166 return nullptr; 172 167 173 168 auto lightSource = lightElement->lightSource(filterBuilder); 174 169 … … 176 171 if (!renderer) 177 172 return nullptr; 178 173 179 174 Color color = renderer->style().colorByApplyingColorFilter(renderer->style().svgStyle().lightingColor()); 180 175 181 auto effect = FESpecularLighting::create(color, surfaceScale(), specularConstant(), specularExponent(), kernelUnitLengthX(), kernelUnitLengthY(), WTFMove(lightSource)); 182 effect->inputEffects() = { input1.releaseNonNull() }; 183 return effect; 176 return FESpecularLighting::create(color, surfaceScale(), specularConstant(), specularExponent(), kernelUnitLengthX(), kernelUnitLengthY(), WTFMove(lightSource)); 184 177 } 185 178 186 } 179 } // namespace WebCore -
trunk/Source/WebCore/svg/SVGFESpecularLightingElement.h
r285796 r287892 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 4 * Copyright (C) 2005 Oliver Hunt <oliver@nerget.com> 5 * Copyright (C) 2018-20 19Apple Inc. All rights reserved.5 * Copyright (C) 2018-2022 Apple Inc. All rights reserved. 6 6 * 7 7 * This library is free software; you can redistribute it and/or … … 59 59 60 60 bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override; 61 RefPtr<FilterEffect> build(SVGFilterBuilder&) const override; 61 Vector<AtomString> filterEffectInputsNames() const override { return { in1() }; } 62 RefPtr<FilterEffect> filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const override; 62 63 63 64 PropertyRegistry m_propertyRegistry { *this }; -
trunk/Source/WebCore/svg/SVGFESpotLightElement.cpp
r286837 r287892 21 21 #include "SVGFESpotLightElement.h" 22 22 23 #include "GeometryUtilities.h"24 #include "ImageBuffer.h"25 23 #include "SVGFilterBuilder.h" 26 24 #include "SVGNames.h" … … 41 39 } 42 40 43 Ref<LightSource> SVGFESpotLightElement::lightSource( SVGFilterBuilder& builder) const41 Ref<LightSource> SVGFESpotLightElement::lightSource(const SVGFilterBuilder& builder) const 44 42 { 45 43 FloatPoint3D position; -
trunk/Source/WebCore/svg/SVGFESpotLightElement.h
r250060 r287892 31 31 SVGFESpotLightElement(const QualifiedName&, Document&); 32 32 33 Ref<LightSource> lightSource( SVGFilterBuilder&) const override;33 Ref<LightSource> lightSource(const SVGFilterBuilder&) const override; 34 34 }; 35 35 static_assert(sizeof(SVGFESpotLightElement) == sizeof(SVGFELightElement)); -
trunk/Source/WebCore/svg/SVGFETileElement.cpp
r286864 r287892 2 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved.4 * Copyright (C) 2018-2022 Apple Inc. All rights reserved. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 24 24 25 25 #include "FETile.h" 26 #include "FilterEffect.h"27 #include "SVGFilterBuilder.h"28 26 #include "SVGNames.h" 29 #include "SVGRenderStyle.h"30 27 #include <wtf/IsoMallocInlines.h> 31 28 … … 71 68 } 72 69 73 RefPtr<FilterEffect> SVGFETileElement:: build(SVGFilterBuilder& filterBuilder) const70 RefPtr<FilterEffect> SVGFETileElement::filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const 74 71 { 75 auto input1 = filterBuilder.getEffectById(in1()); 76 if (!input1) 77 return nullptr; 78 79 auto effect = FETile::create(); 80 effect->inputEffects() = { input1.releaseNonNull() }; 81 return effect; 72 return FETile::create(); 82 73 } 83 74 84 } 75 } // namespace WebCore -
trunk/Source/WebCore/svg/SVGFETileElement.h
r285796 r287892 2 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018-20 19Apple Inc. All rights reserved.4 * Copyright (C) 2018-2022 Apple Inc. All rights reserved. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 43 43 void svgAttributeChanged(const QualifiedName&) override; 44 44 45 RefPtr<FilterEffect> build(SVGFilterBuilder&) const override; 45 Vector<AtomString> filterEffectInputsNames() const override { return { in1() }; } 46 RefPtr<FilterEffect> filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const override; 46 47 47 48 PropertyRegistry m_propertyRegistry { *this }; -
trunk/Source/WebCore/svg/SVGFETurbulenceElement.cpp
r285796 r287892 2 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018-20 19Apple Inc. All rights reserved.4 * Copyright (C) 2018-2022 Apple Inc. All rights reserved. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 118 118 } 119 119 120 RefPtr<FilterEffect> SVGFETurbulenceElement:: build(SVGFilterBuilder&) const120 RefPtr<FilterEffect> SVGFETurbulenceElement::filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const 121 121 { 122 122 if (baseFrequencyX() < 0 || baseFrequencyY() < 0) 123 123 return nullptr; 124 124 125 return FETurbulence::create(type(), baseFrequencyX(), baseFrequencyY(), numOctaves(), seed(), stitchTiles() == SVG_STITCHTYPE_STITCH); 125 126 } 126 127 127 } 128 } // namespace WebCore -
trunk/Source/WebCore/svg/SVGFETurbulenceElement.h
r285796 r287892 2 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018-20 19Apple Inc. All rights reserved.4 * Copyright (C) 2018-2022 Apple Inc. All rights reserved. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 120 120 121 121 bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName) override; 122 RefPtr<FilterEffect> build(SVGFilterBuilder&) const override;122 RefPtr<FilterEffect> filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const override; 123 123 124 124 PropertyRegistry m_propertyRegistry { *this }; -
trunk/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h
r286466 r287892 2 2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018-20 19Apple Inc. All rights reserved.4 * Copyright (C) 2018-2022 Apple Inc. All rights reserved. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 37 37 WTF_MAKE_ISO_ALLOCATED(SVGFilterPrimitiveStandardAttributes); 38 38 public: 39 virtual RefPtr<FilterEffect> build(SVGFilterBuilder&) const = 0;40 // Returns true, if the new value is different from the old one.41 virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&);42 43 39 using PropertyRegistry = SVGPropertyOwnerRegistry<SVGFilterPrimitiveStandardAttributes, SVGElement>; 44 40 … … 54 50 SVGAnimatedLength& heightAnimated() { return m_height; } 55 51 SVGAnimatedString& resultAnimated() { return m_result; } 52 53 // Returns true, if the new value is different from the old one. 54 virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&); 55 virtual Vector<AtomString> filterEffectInputsNames() const { return { }; } 56 virtual RefPtr<FilterEffect> filterEffect(const SVGFilterBuilder&, const FilterEffectVector&) const = 0; 56 57 57 58 protected: -
trunk/Source/WebCore/svg/graphics/filters/SVGFilter.cpp
r287782 r287892 31 31 namespace WebCore { 32 32 33 RefPtr<SVGFilter> SVGFilter::create(SVGFilterElement& filterElement, SVGFilterBuilder& builder, RenderingMode renderingMode, const FloatSize& filterScale, ClipOperation clipOperation, const FloatRect& targetBoundingBox, FilterEffect& previousEffect) 34 { 35 return create(filterElement, builder, renderingMode, filterScale, clipOperation, targetBoundingBox, targetBoundingBox, &previousEffect); 36 } 37 38 RefPtr<SVGFilter> SVGFilter::create(SVGFilterElement& filterElement, SVGFilterBuilder& builder, RenderingMode renderingMode, const FloatSize& filterScale, const FloatRect& filterRegion, const FloatRect& targetBoundingBox) 39 { 40 return create(filterElement, builder, renderingMode, filterScale, ClipOperation::Intersect, filterRegion, targetBoundingBox, nullptr); 41 } 42 43 RefPtr<SVGFilter> SVGFilter::create(SVGFilterElement& filterElement, SVGFilterBuilder& builder, RenderingMode renderingMode, const FloatSize& filterScale, ClipOperation clipOperation, const FloatRect& filterRegion, const FloatRect& targetBoundingBox, FilterEffect* previousEffect) 33 RefPtr<SVGFilter> SVGFilter::create(SVGFilterElement& filterElement, SVGFilterBuilder& builder, RenderingMode renderingMode, const FloatSize& filterScale, ClipOperation clipOperation, const FloatRect& filterRegion, const FloatRect& targetBoundingBox) 44 34 { 45 35 auto filter = adoptRef(*new SVGFilter(renderingMode, filterScale, clipOperation, filterRegion, targetBoundingBox, filterElement.primitiveUnits())); 46 36 47 if (!previousEffect) 48 builder.setupBuiltinEffects(SourceGraphic::create()); 49 else 50 builder.setupBuiltinEffects({ *previousEffect }); 51 37 builder.setupBuiltinEffects(SourceGraphic::create()); 52 38 builder.setTargetBoundingBox(targetBoundingBox); 53 39 builder.setPrimitiveUnits(filterElement.primitiveUnits()); -
trunk/Source/WebCore/svg/graphics/filters/SVGFilter.h
r287782 r287892 37 37 class SVGFilter final : public Filter { 38 38 public: 39 static RefPtr<SVGFilter> create(SVGFilterElement&, SVGFilterBuilder&, RenderingMode, const FloatSize& filterScale, ClipOperation, const FloatRect& targetBoundingBox, FilterEffect& previousEffect); 40 static RefPtr<SVGFilter> create(SVGFilterElement&, SVGFilterBuilder&, RenderingMode, const FloatSize& filterScale, const FloatRect& filterRegion, const FloatRect& targetBoundingBox); 41 static RefPtr<SVGFilter> create(SVGFilterElement&, SVGFilterBuilder&, RenderingMode, const FloatSize& filterScale, ClipOperation, const FloatRect& filterRegion, const FloatRect& targetBoundingBox, FilterEffect* previousEffect); 39 static RefPtr<SVGFilter> create(SVGFilterElement&, SVGFilterBuilder&, RenderingMode, const FloatSize& filterScale, ClipOperation, const FloatRect& filterRegion, const FloatRect& targetBoundingBox); 42 40 WEBCORE_EXPORT static RefPtr<SVGFilter> create(const FloatRect& targetBoundingBox, SVGUnitTypes::SVGUnitType primitiveUnits, SVGFilterExpression&&); 43 41 -
trunk/Source/WebCore/svg/graphics/filters/SVGFilterBuilder.cpp
r287782 r287892 40 40 void SVGFilterBuilder::setupBuiltinEffects(Ref<FilterEffect> sourceGraphic) 41 41 { 42 m_builtinEffects.add(SourceGraphic::effectName(), sourceGraphic .ptr());43 m_builtinEffects.add(SourceAlpha::effectName(), SourceAlpha::create(sourceGraphic ));42 m_builtinEffects.add(SourceGraphic::effectName(), sourceGraphic); 43 m_builtinEffects.add(SourceAlpha::effectName(), SourceAlpha::create(sourceGraphic->operatingColorSpace())); 44 44 } 45 45 … … 84 84 return nullptr; 85 85 86 RefPtr<FilterEffect> effect;86 setEffectInputs(sourceAlpha(), FilterEffectVector { sourceGraphic() }); 87 87 88 88 for (auto& effectElement : childrenOfType<SVGFilterPrimitiveStandardAttributes>(filterElement)) { 89 effect = effectElement.build(*this); 89 auto inputs = namedEffects(effectElement.filterEffectInputsNames()); 90 if (!inputs) 91 return nullptr; 92 93 auto effect = effectElement.filterEffect(*this, *inputs); 90 94 if (!effect) 91 break;95 return nullptr; 92 96 93 97 if (auto flags = effectGeometryFlagsForElement(effectElement)) { … … 104 108 appendEffectToEffectRenderer(*effect, *renderer); 105 109 106 add(effectElement.result(), effect); 107 } 108 109 return effect; 110 } 111 112 void SVGFilterBuilder::add(const AtomString& id, RefPtr<FilterEffect> effect) 110 addNamedEffect(effectElement.result(), { *effect }); 111 setEffectInputs(*effect, WTFMove(*inputs)); 112 } 113 114 return m_lastEffect; 115 } 116 117 FilterEffect& SVGFilterBuilder::sourceGraphic() const 118 { 119 return *m_builtinEffects.get(FilterEffect::sourceGraphicName()); 120 } 121 122 FilterEffect& SVGFilterBuilder::sourceAlpha() const 123 { 124 return *m_builtinEffects.get(FilterEffect::sourceAlphaName()); 125 } 126 127 void SVGFilterBuilder::addNamedEffect(const AtomString& id, Ref<FilterEffect>&& effect) 113 128 { 114 129 if (id.isEmpty()) { 115 m_lastEffect = effect;130 m_lastEffect = WTFMove(effect); 116 131 return; 117 132 } … … 120 135 return; 121 136 122 m_lastEffect = effect;123 m_namedEffects.set(id, m_lastEffect);124 } 125 126 RefPtr<FilterEffect> SVGFilterBuilder:: getEffectById(const AtomString& id) const137 m_lastEffect = WTFMove(effect); 138 m_namedEffects.set(id, Ref { *m_lastEffect }); 139 } 140 141 RefPtr<FilterEffect> SVGFilterBuilder::namedEffect(const AtomString& id) const 127 142 { 128 143 if (id.isEmpty()) { … … 130 145 return m_lastEffect; 131 146 132 return m_builtinEffects.get(SourceGraphic::effectName());147 return &sourceGraphic(); 133 148 } 134 149 … … 137 152 138 153 return m_namedEffects.get(id); 154 } 155 156 std::optional<FilterEffectVector> SVGFilterBuilder::namedEffects(Span<const AtomString> names) const 157 { 158 FilterEffectVector effects; 159 160 effects.reserveInitialCapacity(names.size()); 161 162 for (auto& name : names) { 163 auto effect = namedEffect(name); 164 if (!effect) 165 return std::nullopt; 166 167 effects.uncheckedAppend(effect.releaseNonNull()); 168 } 169 170 return effects; 171 } 172 173 void SVGFilterBuilder::setEffectInputs(FilterEffect& effect, FilterEffectVector&& inputs) 174 { 175 m_inputsMap.set({ effect }, WTFMove(inputs)); 139 176 } 140 177 … … 162 199 expression.append({ effect, effectGeometry(effect), level }); 163 200 164 for (auto& input Effect : effect.inputEffects()) {165 if (!buildEffectExpression(input Effect, stack, level + 1, expression))201 for (auto& input : m_inputsMap.get(effect)) { 202 if (!buildEffectExpression(input, stack, level + 1, expression)) 166 203 return false; 167 204 } -
trunk/Source/WebCore/svg/graphics/filters/SVGFilterBuilder.h
r287782 r287892 26 26 #include "SVGUnitTypes.h" 27 27 #include <wtf/HashMap.h> 28 #include <wtf/HashSet.h>29 28 #include <wtf/text/AtomStringHash.h> 30 29 #include <wtf/text/WTFString.h> … … 47 46 void setPrimitiveUnits(SVGUnitTypes::SVGUnitType units) { m_primitiveUnits = units; } 48 47 49 void add(const AtomString& id, RefPtr<FilterEffect>);50 RefPtr<FilterEffect> getEffectById(const AtomString&) const;51 52 48 // Required to change the attributes of a filter during an svgAttributeChanged. 53 49 void appendEffectToEffectRenderer(FilterEffect&, RenderObject&); … … 59 55 60 56 private: 57 FilterEffect& sourceGraphic() const; 58 FilterEffect& sourceAlpha() const; 59 60 RefPtr<FilterEffect> namedEffect(const AtomString&) const; 61 std::optional<FilterEffectVector> namedEffects(Span<const AtomString>) const; 62 63 void addNamedEffect(const AtomString& id, Ref<FilterEffect>&&); 64 void setEffectInputs(FilterEffect&, FilterEffectVector&& inputs); 65 61 66 std::optional<FilterEffectGeometry> effectGeometry(FilterEffect&) const; 62 67 bool buildEffectExpression(FilterEffect&, FilterEffectVector& stack, unsigned level, SVGFilterExpression&) const; 63 68 64 HashMap<AtomString, Ref Ptr<FilterEffect>> m_builtinEffects;65 HashMap<AtomString, Ref Ptr<FilterEffect>> m_namedEffects;69 HashMap<AtomString, Ref<FilterEffect>> m_builtinEffects; 70 HashMap<AtomString, Ref<FilterEffect>> m_namedEffects; 66 71 HashMap<RenderObject*, FilterEffect*> m_effectRenderer; 72 HashMap<Ref<FilterEffect>, FilterEffectVector> m_inputsMap; 67 73 68 74 RefPtr<FilterEffect> m_lastEffect;
Note:
See TracChangeset
for help on using the changeset viewer.