2 Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 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 "StyledElement.h"
27 #include "SVGAnimatedProperty.h"
28 #include "SynchronizablePropertyController.h"
32 class CSSCursorImageValue
;
34 class SVGCursorElement
;
35 class SVGDocumentExtensions
;
36 class SVGElementInstance
;
38 class TransformationMatrix
;
40 class SVGElement
: public StyledElement
{
42 static PassRefPtr
<SVGElement
> create(const QualifiedName
&, Document
*);
43 virtual ~SVGElement();
45 String
xmlbase() const;
46 void setXmlbase(const String
&, ExceptionCode
&);
48 SVGSVGElement
* ownerSVGElement() const;
49 SVGElement
* viewportElement() const;
51 SVGDocumentExtensions
* accessDocumentSVGExtensions() const;
53 virtual void parseMappedAttribute(MappedAttribute
*);
55 virtual bool isStyled() const { return false; }
56 virtual bool isStyledTransformable() const { return false; }
57 virtual bool isStyledLocatable() const { return false; }
58 virtual bool isSVG() const { return false; }
59 virtual bool isFilterEffect() const { return false; }
60 virtual bool isGradientStop() const { return false; }
61 virtual bool isTextContent() const { return false; }
63 void setShadowParentNode(ContainerNode
* node
) { m_shadowParent
= node
; }
66 virtual bool isValid() const { return true; }
68 virtual bool rendererIsNeeded(RenderStyle
*) { return false; }
69 virtual bool childShouldCreateRenderer(Node
*) const;
71 virtual void svgAttributeChanged(const QualifiedName
&) { }
73 void sendSVGLoadEventIfPossible(bool sendParentLoadEvents
= false);
75 virtual TransformationMatrix
* supplementalTransform() { return 0; }
77 virtual void setSynchronizedSVGAttributes(bool) const;
79 HashSet
<SVGElementInstance
*> instancesForElement() const;
81 void setCursorElement(SVGCursorElement
* cursorElement
) { m_cursorElement
= cursorElement
; }
82 void setCursorImageValue(CSSCursorImageValue
* cursorImageValue
) { m_cursorImageValue
= cursorImageValue
; }
84 SynchronizablePropertyController
& propertyController() const { return m_propertyController
; }
87 SVGElement(const QualifiedName
&, Document
*);
89 virtual void finishParsingChildren();
90 virtual void insertedIntoDocument();
91 virtual void attributeChanged(Attribute
*, bool preserveDecls
= false);
92 virtual void updateAnimatedSVGAttribute(const String
&) const;
95 friend class SVGElementInstance
;
97 virtual bool isSVGElement() const { return true; }
99 virtual bool isSupported(StringImpl
* feature
, StringImpl
* version
) const;
101 virtual bool isShadowNode() const { return m_shadowParent
; }
102 virtual Node
* shadowParentNode() { return m_shadowParent
; }
103 virtual ContainerNode
* eventParentNode();
105 virtual void buildPendingResource() { }
107 void mapInstanceToElement(SVGElementInstance
*);
108 void removeInstanceMapping(SVGElementInstance
*);
110 virtual bool haveLoadedRequiredResources();
112 ContainerNode
* m_shadowParent
;
113 mutable SynchronizablePropertyController m_propertyController
;
115 SVGCursorElement
* m_cursorElement
;
116 CSSCursorImageValue
* m_cursorImageValue
;
118 HashSet
<SVGElementInstance
*> m_elementInstances
;
121 } // namespace WebCore
123 #endif // ENABLE(SVG)
124 #endif // SVGElement_h