blob: b8abfd113a35c2eecedc961977380a21ae5794a9 [file] [log] [blame]
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +01001/*
2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 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#ifndef SVGPolyElement_h
22#define SVGPolyElement_h
23
Torne (Richard Coles)5d92fed2014-06-20 14:52:37 +010024#include "core/SVGNames.h"
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010025#include "core/svg/SVGAnimatedBoolean.h"
Torne (Richard Coles)09380292014-02-21 12:17:33 +000026#include "core/svg/SVGAnimatedPointList.h"
Torne (Richard Coles)51b29062013-11-28 11:56:03 +000027#include "core/svg/SVGGeometryElement.h"
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010028
29namespace WebCore {
30
Torne (Richard Coles)09380292014-02-21 12:17:33 +000031class SVGPolyElement : public SVGGeometryElement {
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010032public:
Torne (Richard Coles)09380292014-02-21 12:17:33 +000033 SVGAnimatedPointList* points() { return m_points.get(); }
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010034
Torne (Richard Coles)09380292014-02-21 12:17:33 +000035 PassRefPtr<SVGPointListTearOff> pointsFromJavascript() { return m_points->baseVal(); }
36 PassRefPtr<SVGPointListTearOff> animatedPoints() { return m_points->animVal(); }
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010037
38protected:
Torne (Richard Coles)8abfc582013-09-12 12:10:38 +010039 SVGPolyElement(const QualifiedName&, Document&);
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010040
41private:
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010042 bool isSupportedAttribute(const QualifiedName&);
Torne (Richard Coles)09380292014-02-21 12:17:33 +000043 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE FINAL;
44 virtual void svgAttributeChanged(const QualifiedName&) OVERRIDE FINAL;
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010045
Torne (Richard Coles)a854de02013-12-18 16:25:25 +000046private:
Torne (Richard Coles)09380292014-02-21 12:17:33 +000047 RefPtr<SVGAnimatedPointList> m_points;
48
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010049};
50
Torne (Richard Coles)a854de02013-12-18 16:25:25 +000051inline bool isSVGPolyElement(const Node& node)
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010052{
Torne (Richard Coles)a854de02013-12-18 16:25:25 +000053 return node.hasTagName(SVGNames::polygonTag) || node.hasTagName(SVGNames::polylineTag);
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010054}
55
Torne (Richard Coles)d5428f32014-03-18 10:21:16 +000056DEFINE_ELEMENT_TYPE_CASTS_WITH_FUNCTION(SVGPolyElement);
Torne (Richard Coles)a854de02013-12-18 16:25:25 +000057
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010058} // namespace WebCore
59
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010060#endif