Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame^] | 1 | /* |
| 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 | |
| 24 | #if ENABLE(SVG) |
| 25 | #include "SVGNames.h" |
| 26 | #include "core/svg/SVGAnimatedBoolean.h" |
| 27 | #include "core/svg/SVGExternalResourcesRequired.h" |
| 28 | #include "core/svg/SVGLangSpace.h" |
| 29 | #include "core/svg/SVGPointList.h" |
| 30 | #include "core/svg/SVGStyledTransformableElement.h" |
| 31 | #include "core/svg/SVGTests.h" |
| 32 | |
| 33 | namespace WebCore { |
| 34 | |
| 35 | class SVGPolyElement : public SVGStyledTransformableElement |
| 36 | , public SVGTests |
| 37 | , public SVGLangSpace |
| 38 | , public SVGExternalResourcesRequired { |
| 39 | public: |
| 40 | SVGListPropertyTearOff<SVGPointList>* points(); |
| 41 | SVGListPropertyTearOff<SVGPointList>* animatedPoints(); |
| 42 | |
| 43 | SVGPointList& pointList() const { return m_points.value; } |
| 44 | |
| 45 | static const SVGPropertyInfo* pointsPropertyInfo(); |
| 46 | |
| 47 | protected: |
| 48 | SVGPolyElement(const QualifiedName&, Document*); |
| 49 | |
| 50 | private: |
| 51 | virtual bool isValid() const { return SVGTests::isValid(); } |
| 52 | virtual bool supportsFocus() const { return true; } |
| 53 | |
| 54 | bool isSupportedAttribute(const QualifiedName&); |
| 55 | virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE; |
| 56 | virtual void svgAttributeChanged(const QualifiedName&); |
| 57 | |
| 58 | virtual bool supportsMarkers() const { return true; } |
| 59 | |
| 60 | // Custom 'points' property |
| 61 | static void synchronizePoints(SVGElement* contextElement); |
| 62 | static PassRefPtr<SVGAnimatedProperty> lookupOrCreatePointsWrapper(SVGElement* contextElement); |
| 63 | |
| 64 | BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGPolyElement) |
| 65 | DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) |
| 66 | END_DECLARE_ANIMATED_PROPERTIES |
| 67 | |
| 68 | // SVGTests |
| 69 | virtual void synchronizeRequiredFeatures() { SVGTests::synchronizeRequiredFeatures(this); } |
| 70 | virtual void synchronizeRequiredExtensions() { SVGTests::synchronizeRequiredExtensions(this); } |
| 71 | virtual void synchronizeSystemLanguage() { SVGTests::synchronizeSystemLanguage(this); } |
| 72 | |
| 73 | protected: |
| 74 | mutable SVGSynchronizableAnimatedProperty<SVGPointList> m_points; |
| 75 | }; |
| 76 | |
| 77 | inline SVGPolyElement* toSVGPolyElement(SVGElement* element) |
| 78 | { |
| 79 | ASSERT_WITH_SECURITY_IMPLICATION(!element || element->hasTagName(SVGNames::polygonTag) || element->hasTagName(SVGNames::polylineTag)); |
| 80 | return static_cast<SVGPolyElement*>(element); |
| 81 | } |
| 82 | |
| 83 | } // namespace WebCore |
| 84 | |
| 85 | #endif // ENABLE(SVG) |
| 86 | #endif |