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 "SVGAnimatedPropertyMacros.h"
26 #include "HTMLNames.h"
27 #include "SVGLocatable.h"
28 #include "SVGStylable.h"
29 #include <wtf/HashSet.h>
33 void mapAttributeToCSSProperty(HashMap<AtomicStringImpl*, int>* propertyNameToIdMap, const QualifiedName& attrName);
35 class SVGStyledElement : public SVGElement,
38 virtual ~SVGStyledElement();
40 virtual String title() const;
42 bool hasRelativeLengths() const { return !m_elementsWithRelativeLengths.isEmpty(); }
44 virtual bool supportsMarkers() const { return false; }
46 virtual PassRefPtr<CSSValue> getPresentationAttribute(const String& name);
48 bool isKnownAttribute(const QualifiedName&);
50 // Centralized place to force a manual style resolution. Hacky but needed for now.
51 PassRefPtr<RenderStyle> resolveStyle(RenderStyle* parentStyle);
53 bool instanceUpdatesBlocked() const;
54 void setInstanceUpdatesBlocked(bool);
56 virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const;
58 virtual CSSStyleDeclaration* style() { return StyledElement::style(); }
61 SVGStyledElement(const QualifiedName&, Document*);
63 virtual bool rendererIsNeeded(RenderStyle*);
65 virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
66 virtual void parseMappedAttribute(Attribute*);
67 virtual void svgAttributeChanged(const QualifiedName&);
68 virtual void synchronizeProperty(const QualifiedName&);
70 virtual void attach();
71 virtual void insertedIntoDocument();
72 virtual void removedFromDocument();
73 virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
75 static int cssPropertyIdForSVGAttributeName(const QualifiedName&);
76 void updateRelativeLengthsInformation() { updateRelativeLengthsInformation(selfHasRelativeLengths(), this); }
77 void updateRelativeLengthsInformation(bool hasRelativeLengths, SVGStyledElement*);
79 virtual bool selfHasRelativeLengths() const { return false; }
82 virtual bool isStyled() const { return true; }
84 HashSet<SVGStyledElement*> m_elementsWithRelativeLengths;
86 DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGStyledElement, HTMLNames::classAttr, String, ClassName, className)
89 } // namespace WebCore
92 #endif // SVGStyledElement