fix logic
[personal-kdelibs.git] / khtml / rendering / RenderSVGContainer.h
blob9e78a2dceaf1ba1fed0e7074cb9cd6e24de03a56
1 /*
2 Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 2004, 2005, 2007 Rob Buis <buis@kde.org>
5 This file is part of the KDE project
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
17 You should have received a copy of the GNU Library General Public License
18 aint with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA.
23 #ifndef RenderSVGContainer_h
24 #define RenderSVGContainer_h
26 #if ENABLE(SVG)
28 #include "RenderPath.h"
29 #include "SVGPreserveAspectRatio.h"
31 namespace WebCore {
33 class SVGElement;
35 class RenderSVGContainer : public RenderObject {
36 public:
37 RenderSVGContainer(SVGStyledElement*);
38 ~RenderSVGContainer();
40 virtual RenderObject* firstChild() const { return m_firstChild; }
41 virtual RenderObject* lastChild() const { return m_lastChild; }
43 virtual short/*khtml*/ int width() const { return m_width; }
44 virtual int height() const { return m_height; }
46 virtual bool canHaveChildren() const;
47 virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0);
48 virtual void removeChild(RenderObject*);
50 virtual void destroy();
51 void destroyLeftoverChildren();
53 virtual RenderObject* removeChildNode(RenderObject*, bool fullRemove = true);
54 virtual void appendChildNode(RenderObject*, bool fullAppend = true);
55 virtual void insertChildNode(RenderObject* child, RenderObject* before, bool fullInsert = true);
57 // Designed for speed. Don't waste time doing a bunch of work like layer updating and repainting when we know that our
58 // change in parentage is not going to affect anything.
59 virtual void moveChildNode(RenderObject* child) { appendChildNode(child->parent()->removeChildNode(child/*, false*/)/*, false*/); }
61 virtual void calcMinMaxWidth() { setMinMaxKnown(); }
63 // Some containers do not want it's children
64 // to be drawn, because they may be 'referenced'
65 // Example: <marker> children in SVG
66 void setDrawsContents(bool);
67 bool drawsContents() const;
69 virtual bool isSVGContainer() const { return true; }
70 virtual const char* renderName() const { return "RenderSVGContainer"; }
72 virtual bool requiresLayer();
73 virtual short lineHeight(bool b, bool isRootLineBox = false) const;
74 virtual short baselinePosition(bool b, bool isRootLineBox = false) const;
76 virtual void layout();
77 virtual void paint(PaintInfo&, int parentX, int parentY);
79 virtual IntRect absoluteClippedOverflowRect();
80 virtual void absoluteRects(Vector<IntRect>& rects, int tx, int ty, bool topLevel = true);
81 virtual void addFocusRingRects(GraphicsContext*, int tx, int ty);
83 FloatRect relativeBBox(bool includeStroke = true) const;
85 virtual bool calculateLocalTransform();
86 virtual AffineTransform localTransform() const;
87 virtual AffineTransform viewportTransform() const;
89 /*virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);*/
91 virtual bool childAllowed() const { return true; }
93 protected:
94 virtual void applyContentTransforms(PaintInfo&);
95 virtual void applyAdditionalTransforms(PaintInfo&);
97 void calcBounds();
99 private:
100 int calcReplacedWidth() const;
101 int calcReplacedHeight() const;
103 RenderObject* m_firstChild;
104 RenderObject* m_lastChild;
106 int m_width;
107 int m_height;
109 bool selfWillPaint() const;
111 bool m_drawsContents : 1;
113 protected:
114 IntRect m_absoluteBounds;
115 AffineTransform m_localTransform;
118 } // namespace WebCore
120 #endif // ENABLE(SVG)
121 #endif // RenderSVGContainer_h
123 // vim:ts=4:noet