1/* 2 Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 2004, 2005, 2007 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) 24#include "SVGViewElement.h" 25 26#include "Attr.h" 27#include "MappedAttribute.h" 28#include "PlatformString.h" 29#include "SVGFitToViewBox.h" 30#include "SVGNames.h" 31#include "SVGStringList.h" 32#include "SVGZoomAndPan.h" 33 34namespace WebCore { 35 36SVGViewElement::SVGViewElement(const QualifiedName& tagName, Document* doc) 37 : SVGStyledElement(tagName, doc) 38 , SVGExternalResourcesRequired() 39 , SVGFitToViewBox() 40 , SVGZoomAndPan() 41{ 42} 43 44SVGViewElement::~SVGViewElement() 45{ 46} 47 48SVGStringList* SVGViewElement::viewTarget() const 49{ 50 if (!m_viewTarget) 51 m_viewTarget = SVGStringList::create(SVGNames::viewTargetAttr); 52 53 return m_viewTarget.get(); 54} 55 56void SVGViewElement::parseMappedAttribute(MappedAttribute* attr) 57{ 58 if (attr->name() == SVGNames::viewTargetAttr) 59 viewTarget()->reset(attr->value()); 60 else { 61 if (SVGExternalResourcesRequired::parseMappedAttribute(attr) 62 || SVGFitToViewBox::parseMappedAttribute(document(), attr) 63 || SVGZoomAndPan::parseMappedAttribute(attr)) 64 return; 65 66 SVGStyledElement::parseMappedAttribute(attr); 67 } 68} 69 70void SVGViewElement::synchronizeProperty(const QualifiedName& attrName) 71{ 72 SVGStyledElement::synchronizeProperty(attrName); 73 74 if (attrName == anyQName()) { 75 synchronizeExternalResourcesRequired(); 76 synchronizeViewBox(); 77 synchronizePreserveAspectRatio(); 78 return; 79 } 80 81 if (SVGExternalResourcesRequired::isKnownAttribute(attrName)) 82 synchronizeExternalResourcesRequired(); 83 else if (SVGFitToViewBox::isKnownAttribute(attrName)) { 84 synchronizeViewBox(); 85 synchronizePreserveAspectRatio(); 86 } 87} 88 89} 90 91#endif // ENABLE(SVG) 92