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 "SVGStylable.h" 28 29namespace WebCore { 30 31 class SVGResource; 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 bool hasRelativeValues() const { return false; } 42 virtual bool isStyled() const { return true; } 43 virtual bool supportsMarkers() const { return false; } 44 45 virtual PassRefPtr<CSSValue> getPresentationAttribute(const String& name); 46 virtual CSSStyleDeclaration* style() { return StyledElement::style(); } 47 48 bool isKnownAttribute(const QualifiedName&); 49 50 virtual bool rendererIsNeeded(RenderStyle*); 51 virtual SVGResource* canvasResource(const RenderObject*) { return 0; } 52 53 virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; 54 virtual void parseMappedAttribute(MappedAttribute*); 55 virtual void svgAttributeChanged(const QualifiedName&); 56 virtual void synchronizeProperty(const QualifiedName&); 57 58 virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); 59 60 // Centralized place to force a manual style resolution. Hacky but needed for now. 61 PassRefPtr<RenderStyle> resolveStyle(RenderStyle* parentStyle); 62 63 void invalidateResourcesInAncestorChain() const; 64 void invalidateResources(); 65 66 virtual void detach(); 67 68 bool instanceUpdatesBlocked() const; 69 void setInstanceUpdatesBlocked(bool); 70 71 protected: 72 static int cssPropertyIdForSVGAttributeName(const QualifiedName&); 73 74 virtual void invalidateCanvasResources(); 75 76 private: 77 DECLARE_ANIMATED_PROPERTY(SVGStyledElement, HTMLNames::classAttr, String, ClassName, className) 78 }; 79 80} // namespace WebCore 81 82#endif // ENABLE(SVG) 83#endif // SVGStyledElement 84