2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
4 * Copyright (C) 2009 Apple Inc. All rights reserved.
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.
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.
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.
26 #include "SVGLocatable.h"
27 #include "SVGParsingError.h"
28 #include "SVGPropertyInfo.h"
29 #include "StyledElement.h"
30 #include <wtf/HashMap.h>
34 class AffineTransform;
35 class CSSCursorImageValue;
37 class SVGAttributeToPropertyMap;
38 class SVGCursorElement;
39 class SVGDocumentExtensions;
40 class SVGElementInstance;
41 class SVGElementRareData;
44 class SVGElement : public StyledElement {
46 static PassRefPtr<SVGElement> create(const QualifiedName&, Document*);
47 virtual ~SVGElement();
49 String xmlbase() const;
50 void setXmlbase(const String&, ExceptionCode&);
52 SVGSVGElement* ownerSVGElement() const;
53 SVGElement* viewportElement() const;
55 SVGDocumentExtensions* accessDocumentSVGExtensions();
57 virtual bool isStyled() const { return false; }
58 virtual bool isStyledTransformable() const { return false; }
59 virtual bool isStyledLocatable() const { return false; }
60 virtual bool isSVG() const { return false; }
61 virtual bool isFilterEffect() const { return false; }
62 virtual bool isGradientStop() const { return false; }
63 virtual bool isTextContent() const { return false; }
66 virtual bool isValid() const { return true; }
68 virtual void svgAttributeChanged(const QualifiedName&) { }
70 virtual void animatedPropertyTypeForAttribute(const QualifiedName&, Vector<AnimatedPropertyType>&);
72 void sendSVGLoadEventIfPossible(bool sendParentLoadEvents = false);
74 virtual AffineTransform* supplementalTransform() { return 0; }
76 void invalidateSVGAttributes() { clearAreSVGAttributesValid(); }
78 const HashSet<SVGElementInstance*>& instancesForElement() const;
80 bool boundingBox(FloatRect&, SVGLocatable::StyleUpdateStrategy = SVGLocatable::AllowStyleUpdate);
82 void setCursorElement(SVGCursorElement*);
83 void cursorElementRemoved();
84 void setCursorImageValue(CSSCursorImageValue*);
85 void cursorImageValueRemoved();
87 SVGElement* correspondingElement();
88 void setCorrespondingElement(SVGElement*);
90 virtual void updateAnimatedSVGAttribute(const QualifiedName&) const;
92 virtual PassRefPtr<RenderStyle> customStyleForRenderer();
94 static void synchronizeRequiredFeatures(void* contextElement);
95 static void synchronizeRequiredExtensions(void* contextElement);
96 static void synchronizeSystemLanguage(void* contextElement);
98 virtual void synchronizeRequiredFeatures() { }
99 virtual void synchronizeRequiredExtensions() { }
100 virtual void synchronizeSystemLanguage() { }
102 virtual SVGAttributeToPropertyMap& localAttributeToPropertyMap();
105 SVGElement(const QualifiedName&, Document*);
107 virtual void parseMappedAttribute(Attribute*);
109 virtual void finishParsingChildren();
110 virtual void attributeChanged(Attribute*, bool preserveDecls = false);
111 virtual bool childShouldCreateRenderer(Node*) const;
113 virtual void removedFromDocument();
115 SVGElementRareData* rareSVGData() const;
116 SVGElementRareData* ensureRareSVGData();
118 void reportAttributeParsingError(SVGParsingError, Attribute*);
121 friend class SVGElementInstance;
123 virtual bool rendererIsNeeded(const NodeRenderingContext&) { return false; }
125 virtual bool isSupported(StringImpl* feature, StringImpl* version) const;
127 void mapInstanceToElement(SVGElementInstance*);
128 void removeInstanceMapping(SVGElementInstance*);
130 virtual bool haveLoadedRequiredResources();