1 /* 2 Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann (at) kde.org> 3 2004, 2005, 2006 Rob Buis <buis (at) kde.org> 4 2005 Oliver Hunt <oliver (at) nerget.com> 5 6 This library is free software; you can redistribute it and/or 7 modify it under the terms of the GNU Library General Public 8 License as published by the Free Software Foundation; either 9 version 2 of the License, or (at your option) any later version. 10 11 This library is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 Library General Public License for more details. 15 16 You should have received a copy of the GNU Library General Public License 17 along with this library; see the file COPYING.LIB. If not, write to 18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 Boston, MA 02110-1301, USA. 20 */ 21 22 #include "config.h" 23 24 #if ENABLE(SVG) && ENABLE(FILTERS) 25 #include "SVGFELightElement.h" 26 27 #include "MappedAttribute.h" 28 #include "SVGNames.h" 29 30 namespace WebCore { 31 32 SVGFELightElement::SVGFELightElement(const QualifiedName& tagName, Document* doc) 33 : SVGElement(tagName, doc) 34 , m_specularExponent(1.0f) 35 { 36 } 37 38 SVGFELightElement::~SVGFELightElement() 39 { 40 } 41 42 void SVGFELightElement::parseMappedAttribute(MappedAttribute* attr) 43 { 44 const String& value = attr->value(); 45 if (attr->name() == SVGNames::azimuthAttr) 46 setAzimuthBaseValue(value.toFloat()); 47 else if (attr->name() == SVGNames::elevationAttr) 48 setElevationBaseValue(value.toFloat()); 49 else if (attr->name() == SVGNames::xAttr) 50 setXBaseValue(value.toFloat()); 51 else if (attr->name() == SVGNames::yAttr) 52 setYBaseValue(value.toFloat()); 53 else if (attr->name() == SVGNames::zAttr) 54 setZBaseValue(value.toFloat()); 55 else if (attr->name() == SVGNames::pointsAtXAttr) 56 setPointsAtXBaseValue(value.toFloat()); 57 else if (attr->name() == SVGNames::pointsAtYAttr) 58 setPointsAtYBaseValue(value.toFloat()); 59 else if (attr->name() == SVGNames::pointsAtZAttr) 60 setPointsAtZBaseValue(value.toFloat()); 61 else if (attr->name() == SVGNames::specularExponentAttr) 62 setSpecularExponentBaseValue(value.toFloat()); 63 else if (attr->name() == SVGNames::limitingConeAngleAttr) 64 setLimitingConeAngleBaseValue(value.toFloat()); 65 else 66 SVGElement::parseMappedAttribute(attr); 67 } 68 69 void SVGFELightElement::synchronizeProperty(const QualifiedName& attrName) 70 { 71 SVGElement::synchronizeProperty(attrName); 72 73 if (attrName == anyQName()) { 74 synchronizeAzimuth(); 75 synchronizeElevation(); 76 synchronizeX(); 77 synchronizeY(); 78 synchronizeZ(); 79 synchronizePointsAtX(); 80 synchronizePointsAtY(); 81 synchronizePointsAtZ(); 82 synchronizeSpecularExponent(); 83 synchronizeLimitingConeAngle(); 84 return; 85 } 86 87 if (attrName == SVGNames::azimuthAttr) 88 synchronizeAzimuth(); 89 else if (attrName == SVGNames::elevationAttr) 90 synchronizeElevation(); 91 else if (attrName == SVGNames::xAttr) 92 synchronizeX(); 93 else if (attrName == SVGNames::yAttr) 94 synchronizeY(); 95 else if (attrName == SVGNames::zAttr) 96 synchronizeZ(); 97 else if (attrName == SVGNames::pointsAtXAttr) 98 synchronizePointsAtX(); 99 else if (attrName == SVGNames::pointsAtYAttr) 100 synchronizePointsAtY(); 101 else if (attrName == SVGNames::pointsAtZAttr) 102 synchronizePointsAtZ(); 103 else if (attrName == SVGNames::specularExponentAttr) 104 synchronizeSpecularExponent(); 105 else if (attrName == SVGNames::limitingConeAngleAttr) 106 synchronizeLimitingConeAngle(); 107 } 108 109 } 110 111 #endif // ENABLE(SVG) 112