SVGFilterBuilder.h [plain text]
#pragma once
#include "FilterEffect.h"
#include <wtf/HashMap.h>
#include <wtf/HashSet.h>
#include <wtf/text/AtomicStringHash.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
class RenderObject;
class SVGFilterBuilder {
public:
typedef HashSet<FilterEffect*> FilterEffectSet;
SVGFilterBuilder(RefPtr<FilterEffect> sourceGraphic);
void add(const AtomicString& id, RefPtr<FilterEffect>);
FilterEffect* getEffectById(const AtomicString& id) const;
FilterEffect* lastEffect() const { return m_lastEffect.get(); }
void appendEffectToEffectReferences(RefPtr<FilterEffect>&&, RenderObject*);
inline FilterEffectSet& effectReferences(FilterEffect* effect)
{
ASSERT(m_effectReferences.contains(effect));
return m_effectReferences.find(effect)->value;
}
inline FilterEffect* effectByRenderer(RenderObject* object) { return m_effectRenderer.get(object); }
void clearEffects();
void clearResultsRecursive(FilterEffect*);
private:
inline void addBuiltinEffects()
{
for (auto& effect : m_builtinEffects.values())
m_effectReferences.add(effect, FilterEffectSet());
}
HashMap<AtomicString, RefPtr<FilterEffect>> m_builtinEffects;
HashMap<AtomicString, RefPtr<FilterEffect>> m_namedEffects;
HashMap<RefPtr<FilterEffect>, FilterEffectSet> m_effectReferences;
HashMap<RenderObject*, FilterEffect*> m_effectRenderer;
RefPtr<FilterEffect> m_lastEffect;
};
}