1 /* 2 Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann (at) kde.org> 3 2004, 2005, 2006 Rob Buis <buis (at) kde.org> 4 Copyright (C) 2009 Apple Inc. All rights reserved. 5 6 This library is free software; you can redistribute it and/or 7 modify it under the terms of the GNU Library General Public 8 License as published by the Free Software Foundation; either 9 version 2 of the License, or (at your option) any later version. 10 11 This library is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 Library General Public License for more details. 15 16 You should have received a copy of the GNU Library General Public License 17 along with this library; see the file COPYING.LIB. If not, write to 18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 Boston, MA 02110-1301, USA. 20 */ 21 22 #ifndef SVGElement_h 23 #define SVGElement_h 24 25 #if ENABLE(SVG) 26 #include "SVGDocumentExtensions.h" 27 #include "StyledElement.h" 28 29 namespace WebCore { 30 31 class CSSCursorImageValue; 32 class Document; 33 class SVGCursorElement; 34 class SVGElementInstance; 35 class SVGElementRareData; 36 class SVGSVGElement; 37 class AffineTransform; 38 39 class SVGElement : public StyledElement { 40 public: 41 static PassRefPtr<SVGElement> create(const QualifiedName&, Document*); 42 virtual ~SVGElement(); 43 44 String xmlbase() const; 45 void setXmlbase(const String&, ExceptionCode&); 46 47 SVGSVGElement* ownerSVGElement() const; 48 SVGElement* viewportElement() const; 49 50 SVGDocumentExtensions* accessDocumentSVGExtensions() const; 51 52 virtual void parseMappedAttribute(MappedAttribute*); 53 54 virtual bool isStyled() const { return false; } 55 virtual bool isStyledTransformable() const { return false; } 56 virtual bool isStyledLocatable() const { return false; } 57 virtual bool isSVG() const { return false; } 58 virtual bool isFilterEffect() const { return false; } 59 virtual bool isGradientStop() const { return false; } 60 virtual bool isTextContent() const { return false; } 61 62 // For SVGTests 63 virtual bool isValid() const { return true; } 64 65 virtual bool rendererIsNeeded(RenderStyle*) { return false; } 66 virtual bool childShouldCreateRenderer(Node*) const; 67 68 virtual void svgAttributeChanged(const QualifiedName&) { } 69 virtual void synchronizeProperty(const QualifiedName&) { } 70 71 void sendSVGLoadEventIfPossible(bool sendParentLoadEvents = false); 72 73 virtual AffineTransform* supplementalTransform() { return 0; } 74 75 void setSynchronizedSVGAttributes(bool value) { m_areSVGAttributesValid = value; } 76 77 const HashSet<SVGElementInstance*>& instancesForElement() const; 78 79 void setCursorElement(SVGCursorElement*); 80 void setCursorImageValue(CSSCursorImageValue*); 81 82 protected: 83 SVGElement(const QualifiedName&, Document*); 84 85 virtual void finishParsingChildren(); 86 virtual void insertedIntoDocument(); 87 virtual void attributeChanged(Attribute*, bool preserveDecls = false); 88 virtual void updateAnimatedSVGAttribute(const QualifiedName&) const; 89 90 SVGElementRareData* rareSVGData() const; 91 SVGElementRareData* ensureRareSVGData(); 92 93 private: 94 friend class SVGElementInstance; 95 96 virtual bool isSVGElement() const { return true; } 97 virtual bool isSupported(StringImpl* feature, StringImpl* version) const; 98 99 virtual ContainerNode* eventParentNode(); 100 virtual void buildPendingResource() { } 101 102 void mapInstanceToElement(SVGElementInstance*); 103 void removeInstanceMapping(SVGElementInstance*); 104 105 virtual bool haveLoadedRequiredResources(); 106 }; 107 108 } 109 110 // This file needs to be included after the SVGElement declaration 111 #include "SVGAnimatedProperty.h" 112 113 #endif 114 #endif 115