1/* 2 Copyright (C) 2007 Rob Buis <buis@kde.org> 3 4 This library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Library General Public 6 License as published by the Free Software Foundation; either 7 version 2 of the License, or (at your option) any later version. 8 9 This library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Library General Public License for more details. 13 14 You should have received a copy of the GNU Library General Public License 15 along with this library; see the file COPYING.LIB. If not, write to 16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 Boston, MA 02110-1301, USA. 18*/ 19 20#ifndef SVGViewSpec_h 21#define SVGViewSpec_h 22 23#if ENABLE(SVG) 24#include "SVGFitToViewBox.h" 25#include "SVGZoomAndPan.h" 26 27#include <wtf/RefPtr.h> 28 29namespace WebCore { 30 31 class SVGElement; 32 class SVGSVGElement; 33 class SVGTransformList; 34 35 class SVGViewSpec : public SVGFitToViewBox, 36 public SVGZoomAndPan, 37 public Noncopyable { 38 public: 39 SVGViewSpec(const SVGSVGElement*); 40 virtual ~SVGViewSpec(); 41 42 bool parseViewSpec(const String&); 43 44 void setTransform(const String&); 45 SVGTransformList* transform() const { return m_transform.get(); } 46 47 void setViewBoxString(const String&); 48 49 void setPreserveAspectRatioString(const String&); 50 51 void setViewTargetString(const String&); 52 String viewTargetString() const { return m_viewTargetString; } 53 SVGElement* viewTarget() const; 54 55 SVGSVGElement* contextElement() const { return const_cast<SVGSVGElement*>(m_contextElement); } 56 57 private: 58 const SVGSVGElement* m_contextElement; 59 60 // SVGFitToViewBox 61 DECLARE_ANIMATED_PROPERTY(SVGViewSpec, SVGNames::viewBoxAttr, FloatRect, ViewBox, viewBox) 62 DECLARE_ANIMATED_PROPERTY(SVGViewSpec, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio, PreserveAspectRatio, preserveAspectRatio) 63 64 mutable RefPtr<SVGTransformList> m_transform; 65 String m_viewTargetString; 66 }; 67 68} // namespace WebCore 69 70#endif // ENABLE(SVG) 71#endif 72