2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
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.
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.
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.
21 #ifndef SVGMarkerElement_h
22 #define SVGMarkerElement_h
24 #include "bindings/core/v8/ExceptionState.h"
25 #include "core/svg/SVGAnimatedAngle.h"
26 #include "core/svg/SVGAnimatedBoolean.h"
27 #include "core/svg/SVGAnimatedEnumeration.h"
28 #include "core/svg/SVGAnimatedLength.h"
29 #include "core/svg/SVGElement.h"
30 #include "core/svg/SVGFitToViewBox.h"
34 enum SVGMarkerUnitsType {
35 SVGMarkerUnitsUnknown = 0,
36 SVGMarkerUnitsUserSpaceOnUse,
37 SVGMarkerUnitsStrokeWidth
39 template<> const SVGEnumerationStringEntries& getStaticStringEntries<SVGMarkerUnitsType>();
41 class SVGMarkerElement FINAL : public SVGElement,
42 public SVGFitToViewBox {
43 DEFINE_WRAPPERTYPEINFO();
45 // Forward declare enumerations in the W3C naming scheme, for IDL generation.
47 SVG_MARKERUNITS_UNKNOWN = SVGMarkerUnitsUnknown,
48 SVG_MARKERUNITS_USERSPACEONUSE = SVGMarkerUnitsUserSpaceOnUse,
49 SVG_MARKERUNITS_STROKEWIDTH = SVGMarkerUnitsStrokeWidth
53 SVG_MARKER_ORIENT_UNKNOWN = SVGMarkerOrientUnknown,
54 SVG_MARKER_ORIENT_AUTO = SVGMarkerOrientAuto,
55 SVG_MARKER_ORIENT_ANGLE = SVGMarkerOrientAngle
58 DECLARE_NODE_FACTORY(SVGMarkerElement);
60 AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) const;
62 void setOrientToAuto();
63 void setOrientToAngle(PassRefPtr<SVGAngleTearOff>);
65 SVGAnimatedLength* refX() const { return m_refX.get(); }
66 SVGAnimatedLength* refY() const { return m_refY.get(); }
67 SVGAnimatedLength* markerWidth() const { return m_markerWidth.get(); }
68 SVGAnimatedLength* markerHeight() const { return m_markerHeight.get(); }
69 SVGAnimatedEnumeration<SVGMarkerUnitsType>* markerUnits() { return m_markerUnits.get(); }
70 SVGAnimatedAngle* orientAngle() { return m_orientAngle.get(); }
71 SVGAnimatedEnumeration<SVGMarkerOrientType>* orientType() { return m_orientAngle->orientType(); }
74 explicit SVGMarkerElement(Document&);
76 virtual bool needsPendingResourceHandling() const OVERRIDE { return false; }
78 bool isSupportedAttribute(const QualifiedName&);
79 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
80 virtual void svgAttributeChanged(const QualifiedName&) OVERRIDE;
81 virtual void childrenChanged(const ChildrenChange&) OVERRIDE;
83 virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE;
84 virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return true; }
86 virtual bool selfHasRelativeLengths() const OVERRIDE;
88 RefPtr<SVGAnimatedLength> m_refX;
89 RefPtr<SVGAnimatedLength> m_refY;
90 RefPtr<SVGAnimatedLength> m_markerWidth;
91 RefPtr<SVGAnimatedLength> m_markerHeight;
92 RefPtr<SVGAnimatedAngle> m_orientAngle;
93 RefPtr<SVGAnimatedEnumeration<SVGMarkerUnitsType> > m_markerUnits;
98 #endif // SVGMarkerElement_h