1 /* 2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann (at) kde.org> 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis (at) 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 "SVGFEMergeNodeElement.h" 25 26 #include "Attribute.h" 27 #include "RenderObject.h" 28 #include "RenderSVGResource.h" 29 #include "SVGFilterElement.h" 30 #include "SVGNames.h" 31 32 namespace WebCore { 33 34 // Animated property definitions 35 DEFINE_ANIMATED_STRING(SVGFEMergeNodeElement, SVGNames::inAttr, In1, in1) 36 37 inline SVGFEMergeNodeElement::SVGFEMergeNodeElement(const QualifiedName& tagName, Document* document) 38 : SVGElement(tagName, document) 39 { 40 } 41 42 PassRefPtr<SVGFEMergeNodeElement> SVGFEMergeNodeElement::create(const QualifiedName& tagName, Document* document) 43 { 44 return adoptRef(new SVGFEMergeNodeElement(tagName, document)); 45 } 46 47 void SVGFEMergeNodeElement::parseMappedAttribute(Attribute* attr) 48 { 49 const String& value = attr->value(); 50 if (attr->name() == SVGNames::inAttr) 51 setIn1BaseValue(value); 52 else 53 SVGElement::parseMappedAttribute(attr); 54 } 55 56 void SVGFEMergeNodeElement::svgAttributeChanged(const QualifiedName& attrName) 57 { 58 SVGElement::svgAttributeChanged(attrName); 59 60 if (attrName != SVGNames::inAttr) 61 return; 62 63 ContainerNode* parent = parentNode(); 64 if (!parent) 65 return; 66 67 RenderObject* renderer = parent->renderer(); 68 if (!renderer || !renderer->isSVGResourceFilterPrimitive()) 69 return; 70 71 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); 72 } 73 74 AttributeToPropertyTypeMap& SVGFEMergeNodeElement::attributeToPropertyTypeMap() 75 { 76 DEFINE_STATIC_LOCAL(AttributeToPropertyTypeMap, s_attributeToPropertyTypeMap, ()); 77 return s_attributeToPropertyTypeMap; 78 } 79 80 void SVGFEMergeNodeElement::fillAttributeToPropertyTypeMap() 81 { 82 attributeToPropertyTypeMap().set(SVGNames::inAttr, AnimatedString); 83 } 84 85 void SVGFEMergeNodeElement::synchronizeProperty(const QualifiedName& attrName) 86 { 87 SVGElement::synchronizeProperty(attrName); 88 89 if (attrName == anyQName() || attrName == SVGNames::inAttr) 90 synchronizeIn1(); 91 } 92 93 } 94 95 #endif // ENABLE(SVG) 96