1/* 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 4 * 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. 9 * 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. 14 * 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. 19 */ 20 21#include "config.h" 22 23#if ENABLE(SVG) && ENABLE(FILTERS) 24#include "SVGFETileElement.h" 25 26#include "Attribute.h" 27#include "FilterEffect.h" 28#include "SVGFilterBuilder.h" 29#include "SVGNames.h" 30#include "SVGRenderStyle.h" 31 32namespace WebCore { 33 34// Animated property definitions 35DEFINE_ANIMATED_STRING(SVGFETileElement, SVGNames::inAttr, In1, in1) 36 37inline SVGFETileElement::SVGFETileElement(const QualifiedName& tagName, Document* document) 38 : SVGFilterPrimitiveStandardAttributes(tagName, document) 39{ 40} 41 42PassRefPtr<SVGFETileElement> SVGFETileElement::create(const QualifiedName& tagName, Document* document) 43{ 44 return adoptRef(new SVGFETileElement(tagName, document)); 45} 46 47void SVGFETileElement::parseMappedAttribute(Attribute* attr) 48{ 49 const String& value = attr->value(); 50 if (attr->name() == SVGNames::inAttr) 51 setIn1BaseValue(value); 52 else 53 SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr); 54} 55 56void SVGFETileElement::svgAttributeChanged(const QualifiedName& attrName) 57{ 58 SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); 59 60 if (attrName == SVGNames::inAttr) 61 invalidate(); 62} 63 64void SVGFETileElement::synchronizeProperty(const QualifiedName& attrName) 65{ 66 SVGFilterPrimitiveStandardAttributes::synchronizeProperty(attrName); 67 68 if (attrName == anyQName() || attrName == SVGNames::inAttr) 69 synchronizeIn1(); 70} 71 72AttributeToPropertyTypeMap& SVGFETileElement::attributeToPropertyTypeMap() 73{ 74 DEFINE_STATIC_LOCAL(AttributeToPropertyTypeMap, s_attributeToPropertyTypeMap, ()); 75 return s_attributeToPropertyTypeMap; 76} 77 78void SVGFETileElement::fillAttributeToPropertyTypeMap() 79{ 80 AttributeToPropertyTypeMap& attributeToPropertyTypeMap = this->attributeToPropertyTypeMap(); 81 82 SVGFilterPrimitiveStandardAttributes::fillPassedAttributeToPropertyTypeMap(attributeToPropertyTypeMap); 83 attributeToPropertyTypeMap.set(SVGNames::inAttr, AnimatedString); 84} 85 86PassRefPtr<FilterEffect> SVGFETileElement::build(SVGFilterBuilder* filterBuilder, Filter* filter) 87{ 88 FilterEffect* input1 = filterBuilder->getEffectById(in1()); 89 90 if (!input1) 91 return 0; 92 93 RefPtr<FilterEffect> effect = FETile::create(filter); 94 effect->inputEffects().append(input1); 95 return effect.release(); 96} 97 98} 99 100#endif // ENABLE(SVG) 101