36 #define ANIMATED_PROPERTY_EMPTY_DECLARATIONS(BareType, NullType, UpperProperty, LowerProperty) \
38 virtual BareType LowerProperty() const { ASSERT_NOT_REACHED(); return NullType; } \
39 virtual void set##UpperProperty(BareType) { ASSERT_NOT_REACHED(); }\
40 virtual BareType LowerProperty##BaseValue() const { ASSERT_NOT_REACHED(); return NullType; } \
41 virtual void set##UpperProperty##BaseValue(BareType) { ASSERT_NOT_REACHED(); } \
42 virtual void start##UpperProperty() const { ASSERT_NOT_REACHED(); } \
43 virtual void stop##UpperProperty() { ASSERT_NOT_REACHED(); }
45 #define ANIMATED_PROPERTY_FORWARD_DECLARATIONS(ForwardClass, BareType, UpperProperty, LowerProperty) \
47 virtual BareType LowerProperty() const { return ForwardClass::LowerProperty(); } \
48 virtual void set##UpperProperty(BareType newValue) { ForwardClass::set##UpperProperty(newValue); } \
49 virtual BareType LowerProperty##BaseValue() const { return ForwardClass::LowerProperty##BaseValue(); } \
50 virtual void set##UpperProperty##BaseValue(BareType newValue) { ForwardClass::set##UpperProperty##BaseValue(newValue); } \
51 virtual void start##UpperProperty() const { ForwardClass::start##UpperProperty(); } \
52 virtual void stop##UpperProperty() { ForwardClass::stop##UpperProperty(); }
54 #define ANIMATED_PROPERTY_DECLARATIONS_INTERNAL(ClassType, ClassStorageType, BareType, StorageType, UpperProperty, LowerProperty) \
55 class SVGAnimatedTemplate##UpperProperty \
56 : public SVGAnimatedTemplate<BareType> \
59 SVGAnimatedTemplate##UpperProperty(const ClassType*, const QualifiedName&); \
60 virtual ~SVGAnimatedTemplate##UpperProperty() { } \
61 virtual BareType baseVal() const; \
62 virtual void setBaseVal(BareType); \
63 virtual BareType animVal() const; \
64 virtual void setAnimVal(BareType); \
67 ClassStorageType m_element; \
70 BareType LowerProperty() const; \
71 void set##UpperProperty(BareType); \
72 BareType LowerProperty##BaseValue() const; \
73 void set##UpperProperty##BaseValue(BareType); \
74 PassRefPtr<SVGAnimatedTemplate##UpperProperty> LowerProperty##Animated() const; \
75 void start##UpperProperty() const; \
76 void stop##UpperProperty(); \
79 StorageType m_##LowerProperty;
81 #define ANIMATED_PROPERTY_DEFINITIONS_INTERNAL(ClassName, ClassType, BareType, UpperClassName, LowerClassName, UpperProperty, LowerProperty, AttrName, StorageGetter, ContextElement) \
82 ClassName::SVGAnimatedTemplate##UpperProperty::SVGAnimatedTemplate##UpperProperty(const ClassType* element, const QualifiedName& attributeName) \
83 : SVGAnimatedTemplate<BareType>(attributeName), m_element(const_cast<ClassType*>(element)) { } \
85 BareType ClassName::SVGAnimatedTemplate##UpperProperty::baseVal() const \
87 return m_element->LowerProperty##BaseValue(); \
89 void ClassName::SVGAnimatedTemplate##UpperProperty::setBaseVal(BareType newBaseVal) \
91 m_element->set##UpperProperty##BaseValue(newBaseVal); \
93 BareType ClassName::SVGAnimatedTemplate##UpperProperty::animVal() const \
95 return m_element->LowerProperty(); \
97 void ClassName::SVGAnimatedTemplate##UpperProperty::setAnimVal(BareType newAnimVal) \
99 m_element->set##UpperProperty(newAnimVal); \
101 BareType ClassName::LowerProperty() const \
103 return StorageGetter; \
105 void ClassName::set##UpperProperty(BareType newValue) \
107 m_##LowerProperty = newValue; \
109 BareType ClassName::LowerProperty##BaseValue() const \
111 const SVGElement* context = ContextElement; \
113 SVGDocumentExtensions* extensions = (context->document() ? context->document()->accessSVGExtensions() : 0); \
114 if (extensions && extensions->hasBaseValue<BareType>(context, AttrName)) \
115 return extensions->baseValue<BareType>(context, AttrName); \
116 return LowerProperty(); \
118 void ClassName::set##UpperProperty##BaseValue(BareType newValue) \
120 const SVGElement* context = ContextElement; \
122 SVGDocumentExtensions* extensions = (context->document() ? context->document()->accessSVGExtensions() : 0); \
123 if (extensions && extensions->hasBaseValue<BareType>(context, AttrName)) { \
124 extensions->setBaseValue<BareType>(context, AttrName, newValue); \
128 set##UpperProperty(newValue); \
131 void ClassName::start##UpperProperty() const \
133 const SVGElement* context = ContextElement; \
135 SVGDocumentExtensions* extensions = (context->document() ? context->document()->accessSVGExtensions() : 0); \
137 ASSERT(!extensions->hasBaseValue<BareType>(context, AttrName)); \
138 extensions->setBaseValue<BareType>(context, AttrName, LowerProperty()); \
142 void ClassName::stop##UpperProperty() \
144 const SVGElement* context = ContextElement; \
146 SVGDocumentExtensions* extensions = (context->document() ? context->document()->accessSVGExtensions() : 0); \
148 ASSERT(extensions->hasBaseValue<BareType>(context, AttrName)); \
149 set##UpperProperty(extensions->baseValue<BareType>(context, AttrName)); \
150 extensions->removeBaseValue<BareType>(context, AttrName); \
155 #define ANIMATED_PROPERTY_DECLARATIONS_WITH_CONTEXT(ClassName, BareType, StorageType, UpperProperty, LowerProperty) \
156 ANIMATED_PROPERTY_DECLARATIONS_INTERNAL(SVGElement, RefPtr<SVGElement>, BareType, StorageType, UpperProperty, LowerProperty)
158 #define ANIMATED_PROPERTY_DECLARATIONS(ClassName, BareType, StorageType, UpperProperty, LowerProperty) \
159 ANIMATED_PROPERTY_DECLARATIONS_INTERNAL(ClassName, RefPtr<ClassName>, BareType, StorageType, UpperProperty, LowerProperty)
161 #define ANIMATED_PROPERTY_DEFINITIONS_WITH_CONTEXT(ClassName, BareType, UpperClassName, LowerClassName, UpperProperty, LowerProperty, AttrName, StorageGetter) \
162 ANIMATED_PROPERTY_DEFINITIONS_INTERNAL(ClassName, SVGElement, BareType, UpperClassName, LowerClassName, UpperProperty, LowerProperty, AttrName.localName(), StorageGetter, contextElement()) \
163 PassRefPtr<ClassName::SVGAnimatedTemplate##UpperProperty> ClassName::LowerProperty##Animated() const \
165 const SVGElement* context = contextElement(); \
167 return lookupOrCreateWrapper<ClassName::SVGAnimatedTemplate##UpperProperty, SVGElement>(context, AttrName, AttrName.localName()); \
170 #define ANIMATED_PROPERTY_DEFINITIONS_WITH_CUSTOM_IDENTIFIER(ClassName, BareType, UpperClassName, LowerClassName, UpperProperty, LowerProperty, AttrName, AttrIdentifier, StorageGetter) \
171 ANIMATED_PROPERTY_DEFINITIONS_INTERNAL(ClassName, ClassName, BareType, UpperClassName, LowerClassName, UpperProperty, LowerProperty, AttrName.localName(), StorageGetter, this) \
172 PassRefPtr<ClassName::SVGAnimatedTemplate##UpperProperty> ClassName::LowerProperty##Animated() const \
174 return lookupOrCreateWrapper<ClassName::SVGAnimatedTemplate##UpperProperty, ClassName>(this, AttrName, AttrIdentifier); \
177 #define ANIMATED_PROPERTY_DEFINITIONS(ClassName, BareType, UpperClassName, LowerClassName, UpperProperty, LowerProperty, AttrName, StorageGetter) \
178 ANIMATED_PROPERTY_DEFINITIONS_WITH_CUSTOM_IDENTIFIER(ClassName, BareType, UpperClassName, LowerClassName, UpperProperty, LowerProperty, AttrName, AttrName.localName(), StorageGetter)
182 class SVGPreserveAspectRatio;
185 class SVGElement :
public StyledElement {
187 SVGElement(
const QualifiedName&, Document*);
188 virtual ~SVGElement();
189 virtual bool isSVGElement()
const {
return true; }
190 virtual bool isSupported(StringImpl* feature, StringImpl* version)
const;
193 void setId(
const String&, ExceptionCode&);
195 void setXmlbase(
const String&, ExceptionCode&);
197 SVGSVGElement* ownerSVGElement()
const;
198 SVGElement* viewportElement()
const;
200 virtual void parseMappedAttribute(MappedAttribute*);
202 virtual bool isStyled()
const {
return false; }
203 virtual bool isStyledTransformable()
const {
return false; }
204 virtual bool isStyledLocatable()
const {
return false; }
205 virtual bool isSVG()
const {
return false; }
206 virtual bool isFilterEffect()
const {
return false; }
207 virtual bool isGradientStop()
const {
return false; }
208 virtual bool isTextContent()
const {
return false; }
210 virtual bool isShadowNode()
const {
return false; }
211 virtual Node* shadowParentNode() {
return m_shadowParent; }
212 void setShadowParentNode(Node* node) { m_shadowParent = node; }
213 virtual Node* eventParentNode() {
return isShadowNode() ? shadowParentNode() : parentNode(); }
216 virtual bool isValid()
const {
return true; }
218 virtual void finishParsingChildren();
220 virtual void close() { finishParsingChildren(); Element::close(); }
221 virtual bool rendererIsNeeded(RenderStyle*) {
return false; }
222 virtual bool childShouldCreateRenderer(Node*)
const;
224 virtual void insertedIntoDocument();
225 virtual void buildPendingResource() { }
227 virtual void svgAttributeChanged(
const QualifiedName&) { }
228 using DOM::ElementImpl::attributeChanged;
229 virtual void attributeChanged(Attribute*,
bool preserveDecls =
false);
231 void sendSVGLoadEventIfPossible(
bool sendParentLoadEvents =
false);
233 virtual AffineTransform* supplementalTransform() {
return 0; }
239 ANIMATED_PROPERTY_EMPTY_DECLARATIONS(
String,
String(), Href, href)
242 ANIMATED_PROPERTY_EMPTY_DECLARATIONS(FloatRect, FloatRect(), ViewBox, viewBox)
243 ANIMATED_PROPERTY_EMPTY_DECLARATIONS(SVGPreserveAspectRatio*, 0, PreserveAspectRatio, preserveAspectRatio)
246 ANIMATED_PROPERTY_EMPTY_DECLARATIONS(
bool, false, ExternalResourcesRequired, externalResourcesRequired)
248 virtual
bool dispatchEvent(Event* e, ExceptionCode& ec,
bool tempEvent = false);
251 virtual
void parseAttribute(Attribute* attr) { parseMappedAttribute(attr); }
252 virtual void addCSSProperty(Attribute* attr,
int id,
const String& value);
253 virtual void addCSSProperty(Attribute* attr,
int id,
int value);
256 void addSVGEventListener(
const DOM::EventImpl::EventId& eventType,
const DOM::AttributeImpl*);
257 virtual bool haveLoadedRequiredResources();
259 Node* m_shadowParent;
264 #endif // ENABLE(SVG)
265 #endif // SVGElement_h
bool isSupported(const QString &mimeType, Mode mode=Writing)
KAction * close(const QObject *recvr, const char *slot, QObject *parent)