|
1 /* |
|
2 Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
|
3 2004, 2005, 2007 Rob Buis <buis@kde.org> |
|
4 |
|
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. |
|
9 |
|
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. |
|
14 |
|
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. |
|
19 */ |
|
20 |
|
21 #ifndef SVGStyledElement_h |
|
22 #define SVGStyledElement_h |
|
23 |
|
24 #if ENABLE(SVG) |
|
25 #include "HTMLNames.h" |
|
26 #include "SVGElement.h" |
|
27 #include "SVGLocatable.h" |
|
28 #include "SVGStylable.h" |
|
29 #include <wtf/HashSet.h> |
|
30 |
|
31 namespace WebCore { |
|
32 |
|
33 void mapAttributeToCSSProperty(HashMap<AtomicStringImpl*, int>* propertyNameToIdMap, const QualifiedName& attrName); |
|
34 |
|
35 class SVGStyledElement : public SVGElement, |
|
36 public SVGStylable { |
|
37 public: |
|
38 SVGStyledElement(const QualifiedName&, Document*); |
|
39 virtual ~SVGStyledElement(); |
|
40 |
|
41 virtual String title() const; |
|
42 |
|
43 bool hasRelativeLengths() const { return !m_elementsWithRelativeLengths.isEmpty(); } |
|
44 |
|
45 virtual bool isStyled() const { return true; } |
|
46 virtual bool supportsMarkers() const { return false; } |
|
47 |
|
48 virtual PassRefPtr<CSSValue> getPresentationAttribute(const String& name); |
|
49 virtual CSSStyleDeclaration* style() { return StyledElement::style(); } |
|
50 |
|
51 bool isKnownAttribute(const QualifiedName&); |
|
52 |
|
53 virtual bool rendererIsNeeded(RenderStyle*); |
|
54 |
|
55 virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; |
|
56 virtual void parseMappedAttribute(Attribute*); |
|
57 virtual void svgAttributeChanged(const QualifiedName&); |
|
58 virtual void synchronizeProperty(const QualifiedName&); |
|
59 |
|
60 virtual void insertedIntoDocument(); |
|
61 virtual void removedFromDocument(); |
|
62 virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); |
|
63 |
|
64 // Centralized place to force a manual style resolution. Hacky but needed for now. |
|
65 PassRefPtr<RenderStyle> resolveStyle(RenderStyle* parentStyle); |
|
66 |
|
67 void invalidateResourceClients(); |
|
68 |
|
69 bool instanceUpdatesBlocked() const; |
|
70 void setInstanceUpdatesBlocked(bool); |
|
71 |
|
72 virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const; |
|
73 |
|
74 protected: |
|
75 static int cssPropertyIdForSVGAttributeName(const QualifiedName&); |
|
76 void updateRelativeLengthsInformation() { updateRelativeLengthsInformation(selfHasRelativeLengths(), this); } |
|
77 void updateRelativeLengthsInformation(bool hasRelativeLengths, SVGStyledElement*); |
|
78 |
|
79 virtual bool selfHasRelativeLengths() const { return false; } |
|
80 |
|
81 private: |
|
82 HashSet<SVGStyledElement*> m_elementsWithRelativeLengths; |
|
83 DECLARE_ANIMATED_PROPERTY(SVGStyledElement, HTMLNames::classAttr, String, ClassName, className) |
|
84 }; |
|
85 |
|
86 } // namespace WebCore |
|
87 |
|
88 #endif // ENABLE(SVG) |
|
89 #endif // SVGStyledElement |