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
28 #include "RenderPath.h"
29 #include "SVGPreserveAspectRatio.h"
35 class RenderSVGContainer
: public RenderObject
{
37 RenderSVGContainer(SVGStyledElement
*);
38 ~RenderSVGContainer();
40 virtual RenderObject
* firstChild() const { return m_firstChild
; }
41 virtual RenderObject
* lastChild() const { return m_lastChild
; }
43 int width() const { return m_width
; }
44 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 calcPrefWidths() { setPrefWidthsDirty(false); }
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() const { return false; }
73 virtual int lineHeight(bool b
, bool isRootLineBox
= false) const;
74 virtual int baselinePosition(bool b
, bool isRootLineBox
= false) const;
76 virtual void layout();
77 virtual void paint(PaintInfo
&, int parentX
, int parentY
);
79 virtual IntRect
clippedOverflowRectForRepaint(RenderBox
* repaintContainer
);
80 virtual void absoluteRects(Vector
<IntRect
>& rects
, int tx
, int ty
, bool topLevel
= true);
81 virtual void absoluteQuads(Vector
<FloatQuad
>&, bool topLevel
= true);
82 virtual void addFocusRingRects(GraphicsContext
*, int tx
, int ty
);
84 FloatRect
relativeBBox(bool includeStroke
= true) const;
86 virtual bool calculateLocalTransform();
87 virtual TransformationMatrix
localTransform() const;
88 virtual TransformationMatrix
viewportTransform() const;
90 virtual bool nodeAtPoint(const HitTestRequest
&, HitTestResult
&, int x
, int y
, int tx
, int ty
, HitTestAction
);
93 virtual void applyContentTransforms(PaintInfo
&);
94 virtual void applyAdditionalTransforms(PaintInfo
&);
98 virtual IntRect
outlineBoundsForRepaint(RenderBox
* /*repaintContainer*/) const;
101 int calcReplacedWidth() const;
102 int calcReplacedHeight() const;
104 RenderObject
* m_firstChild
;
105 RenderObject
* m_lastChild
;
110 bool selfWillPaint() const;
112 bool m_drawsContents
: 1;
115 IntRect m_absoluteBounds
;
116 TransformationMatrix m_localTransform
;
119 } // namespace WebCore
121 #endif // ENABLE(SVG)
122 #endif // RenderSVGContainer_h