2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
23 #if ENABLE(SVG) && ENABLE(FILTERS)
24 #include "SVGFETileElement.h"
26 #include "Attribute.h"
27 #include "FilterEffect.h"
28 #include "SVGElementInstance.h"
29 #include "SVGFilterBuilder.h"
31 #include "SVGRenderStyle.h"
35 // Animated property definitions
36 DEFINE_ANIMATED_STRING(SVGFETileElement, SVGNames::inAttr, In1, in1)
38 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFETileElement)
39 REGISTER_LOCAL_ANIMATED_PROPERTY(in1)
40 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes)
41 END_REGISTER_ANIMATED_PROPERTIES
43 inline SVGFETileElement::SVGFETileElement(const QualifiedName& tagName, Document* document)
44 : SVGFilterPrimitiveStandardAttributes(tagName, document)
46 ASSERT(hasTagName(SVGNames::feTileTag));
47 registerAnimatedPropertiesForSVGFETileElement();
50 PassRefPtr<SVGFETileElement> SVGFETileElement::create(const QualifiedName& tagName, Document* document)
52 return adoptRef(new SVGFETileElement(tagName, document));
55 bool SVGFETileElement::isSupportedAttribute(const QualifiedName& attrName)
57 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
58 if (supportedAttributes.isEmpty())
59 supportedAttributes.add(SVGNames::inAttr);
60 return supportedAttributes.contains(attrName);
63 void SVGFETileElement::parseMappedAttribute(Attribute* attr)
65 if (!isSupportedAttribute(attr->name())) {
66 SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr);
70 if (attr->name() == SVGNames::inAttr) {
71 setIn1BaseValue(attr->value());
78 void SVGFETileElement::svgAttributeChanged(const QualifiedName& attrName)
80 if (!isSupportedAttribute(attrName)) {
81 SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName);
85 SVGElementInstance::InvalidationGuard invalidationGuard(this);
87 if (attrName == SVGNames::inAttr) {
95 PassRefPtr<FilterEffect> SVGFETileElement::build(SVGFilterBuilder* filterBuilder, Filter* filter)
97 FilterEffect* input1 = filterBuilder->getEffectById(in1());
102 RefPtr<FilterEffect> effect = FETile::create(filter);
103 effect->inputEffects().append(input1);
104 return effect.release();
109 #endif // ENABLE(SVG)