blob: 28e6f03011f73c573c0dd1fe3e7ab7209fd914cf [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)53e740f2013-05-09 18:38:43 +010024#include "SVGNames.h"
25#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)09380292014-02-21 12:17:33 +000042 virtual bool supportsFocus() const OVERRIDE FINAL { return hasFocusEventListeners(); }
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010043
44 bool isSupportedAttribute(const QualifiedName&);
Torne (Richard Coles)09380292014-02-21 12:17:33 +000045 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE FINAL;
46 virtual void svgAttributeChanged(const QualifiedName&) OVERRIDE FINAL;
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010047
Torne (Richard Coles)09380292014-02-21 12:17:33 +000048 virtual bool supportsMarkers() const OVERRIDE FINAL { return true; }
Torne (Richard Coles)a854de02013-12-18 16:25:25 +000049
50private:
Torne (Richard Coles)09380292014-02-21 12:17:33 +000051 RefPtr<SVGAnimatedPointList> m_points;
52
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010053 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGPolyElement)
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010054 END_DECLARE_ANIMATED_PROPERTIES
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010055};
56
Torne (Richard Coles)a854de02013-12-18 16:25:25 +000057inline bool isSVGPolyElement(const Node& node)
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010058{
Torne (Richard Coles)a854de02013-12-18 16:25:25 +000059 return node.hasTagName(SVGNames::polygonTag) || node.hasTagName(SVGNames::polylineTag);
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010060}
61
Torne (Richard Coles)a854de02013-12-18 16:25:25 +000062DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(SVGPolyElement);
63
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010064} // namespace WebCore
65
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010066#endif