File indexing completed on 2024-04-28 15:24:28
0001 /* 0002 Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 0003 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 0004 0005 This file is part of the KDE project 0006 0007 This library is free software; you can redistribute it and/or 0008 modify it under the terms of the GNU Library General Public 0009 License as published by the Free Software Foundation; either 0010 version 2 of the License, or (at your option) any later version. 0011 0012 This library is distributed in the hope that it will be useful, 0013 but WITHOUT ANY WARRANTY; without even the implied warranty of 0014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0015 Library General Public License for more details. 0016 0017 You should have received a copy of the GNU Library General Public License 0018 along with this library; see the file COPYING.LIB. If not, write to 0019 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0020 Boston, MA 02110-1301, USA. 0021 */ 0022 0023 #if ENABLE(SVG) 0024 #include "SVGCursorElement.h" 0025 0026 #include "Attr.h" 0027 #include "SVGNames.h" 0028 0029 namespace WebCore 0030 { 0031 0032 SVGCursorElement::SVGCursorElement(const QualifiedName &tagName, Document *doc) 0033 : SVGElement(tagName, doc) 0034 , SVGTests() 0035 , SVGExternalResourcesRequired() 0036 , SVGURIReference() 0037 , m_x(0, LengthModeWidth) 0038 , m_y(0, LengthModeHeight) 0039 { 0040 } 0041 0042 SVGCursorElement::~SVGCursorElement() 0043 { 0044 } 0045 0046 ANIMATED_PROPERTY_DEFINITIONS(SVGCursorElement, SVGLength, Length, length, X, x, SVGNames::xAttr, m_x) 0047 ANIMATED_PROPERTY_DEFINITIONS(SVGCursorElement, SVGLength, Length, length, Y, y, SVGNames::yAttr, m_y) 0048 0049 void SVGCursorElement::parseMappedAttribute(MappedAttribute *attr) 0050 { 0051 if (attr->name() == SVGNames::xAttr) { 0052 setXBaseValue(SVGLength(0, LengthModeWidth, attr->value())); 0053 } else if (attr->name() == SVGNames::yAttr) { 0054 setYBaseValue(SVGLength(0, LengthModeHeight, attr->value())); 0055 } else { 0056 if (SVGTests::parseMappedAttribute(attr)) { 0057 return; 0058 } 0059 if (SVGExternalResourcesRequired::parseMappedAttribute(attr)) { 0060 return; 0061 } 0062 if (SVGURIReference::parseMappedAttribute(attr)) { 0063 return; 0064 } 0065 0066 SVGElement::parseMappedAttribute(attr); 0067 } 0068 } 0069 0070 void SVGCursorElement::addClient(SVGElement *element) 0071 { 0072 m_clients.add(element); 0073 } 0074 0075 void SVGCursorElement::removeClient(SVGElement *element) 0076 { 0077 m_clients.remove(element); 0078 } 0079 0080 void SVGCursorElement::svgAttributeChanged(const QualifiedName &attrName) 0081 { 0082 SVGElement::svgAttributeChanged(attrName); 0083 0084 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || 0085 SVGTests::isKnownAttribute(attrName) || 0086 SVGExternalResourcesRequired::isKnownAttribute(attrName) || 0087 SVGURIReference::isKnownAttribute(attrName)) { 0088 HashSet<SVGElement *>::const_iterator it = m_clients.begin(); 0089 HashSet<SVGElement *>::const_iterator end = m_clients.end(); 0090 0091 for (; it != end; ++it) { 0092 (*it)->setChanged(); 0093 } 0094 } 0095 } 0096 0097 void SVGCursorElement::getSubresourceAttributeStrings(Vector<String> &urls) const 0098 { 0099 urls.append(href()); 0100 } 0101 0102 } 0103 0104 #endif // ENABLE(SVG)