2
* Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3
* Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org>
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.
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.
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.
21
#ifndef SVGStyledElement_h
22
#define SVGStyledElement_h
25
#include "CSSPropertyNames.h"
26
#include "SVGAnimatedString.h"
27
#include "SVGLocatable.h"
28
#include "SVGStylable.h"
29
#include <wtf/HashSet.h>
33
void mapAttributeToCSSProperty(HashMap<AtomicStringImpl*, CSSPropertyID>* propertyNameToIdMap, const QualifiedName& attrName);
35
class SVGStyledElement : public SVGElement,
38
virtual String title() const;
40
bool hasRelativeLengths() const { return !m_elementsWithRelativeLengths.isEmpty(); }
42
virtual bool supportsMarkers() const { return false; }
44
virtual PassRefPtr<CSSValue> getPresentationAttribute(const String& name);
46
bool isKnownAttribute(const QualifiedName&);
48
bool instanceUpdatesBlocked() const;
49
void setInstanceUpdatesBlocked(bool);
51
virtual void animatedPropertyTypeForAttribute(const QualifiedName&, Vector<AnimatedPropertyType>&);
52
static bool isAnimatableCSSProperty(const QualifiedName&);
54
virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const;
56
virtual CSSStyleDeclaration* style() { return StyledElement::style(); }
57
virtual bool needsPendingResourceHandling() const { return true; }
60
SVGStyledElement(const QualifiedName&, Document*, ConstructionType = CreateSVGElement);
61
virtual bool rendererIsNeeded(const NodeRenderingContext&);
63
virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
64
virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
65
virtual void collectStyleForPresentationAttribute(const Attribute&, StylePropertySet*) OVERRIDE;
66
virtual void svgAttributeChanged(const QualifiedName&) OVERRIDE;
68
virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
69
virtual void removedFrom(ContainerNode*) OVERRIDE;
70
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
72
static CSSPropertyID cssPropertyIdForSVGAttributeName(const QualifiedName&);
73
void updateRelativeLengthsInformation() { updateRelativeLengthsInformation(selfHasRelativeLengths(), this); }
74
void updateRelativeLengthsInformation(bool hasRelativeLengths, SVGStyledElement*);
76
virtual bool selfHasRelativeLengths() const { return false; }
79
virtual bool isStyled() const { return true; }
81
virtual bool isKeyboardFocusable(KeyboardEvent*) const;
82
virtual bool isMouseFocusable() const;
84
void buildPendingResourcesIfNeeded();
86
HashSet<SVGStyledElement*> m_elementsWithRelativeLengths;
88
BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGStyledElement)
89
DECLARE_ANIMATED_STRING(ClassName, className)
90
END_DECLARE_ANIMATED_PROPERTIES
93
inline SVGStyledElement* toSVGStyledElement(Node* node)
95
ASSERT(!node || (node->isStyledElement() && node->isSVGElement()));
96
return static_cast<SVGStyledElement*>(node);
99
} // namespace WebCore
101
#endif // ENABLE(SVG)
102
#endif // SVGStyledElement