]> git.saurik.com Git - iphone-api.git/blob - WebCore/RenderSVGContainer.h
Adding the WebCore headers (for Cydget).
[iphone-api.git] / WebCore / RenderSVGContainer.h
1 /*
2 Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 2004, 2005, 2007 Rob Buis <buis@kde.org>
4
5 This file is part of the KDE project
6
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.
11
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.
16
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.
21 */
22
23 #ifndef RenderSVGContainer_h
24 #define RenderSVGContainer_h
25
26 #if ENABLE(SVG)
27
28 #include "RenderPath.h"
29 #include "SVGPreserveAspectRatio.h"
30
31 namespace WebCore {
32
33 class SVGElement;
34
35 class RenderSVGContainer : public RenderObject {
36 public:
37 RenderSVGContainer(SVGStyledElement*);
38 ~RenderSVGContainer();
39
40 virtual RenderObject* firstChild() const { return m_firstChild; }
41 virtual RenderObject* lastChild() const { return m_lastChild; }
42
43 int width() const { return m_width; }
44 int height() const { return m_height; }
45
46 virtual bool canHaveChildren() const;
47 virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0);
48 virtual void removeChild(RenderObject*);
49
50 virtual void destroy();
51 void destroyLeftoverChildren();
52
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);
56
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); }
60
61 virtual void calcPrefWidths() { setPrefWidthsDirty(false); }
62
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;
68
69 virtual bool isSVGContainer() const { return true; }
70 virtual const char* renderName() const { return "RenderSVGContainer"; }
71
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;
75
76 virtual void layout();
77 virtual void paint(PaintInfo&, int parentX, int parentY);
78
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);
83
84 FloatRect relativeBBox(bool includeStroke = true) const;
85
86 virtual bool calculateLocalTransform();
87 virtual TransformationMatrix localTransform() const;
88 virtual TransformationMatrix viewportTransform() const;
89
90 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
91
92 protected:
93 virtual void applyContentTransforms(PaintInfo&);
94 virtual void applyAdditionalTransforms(PaintInfo&);
95
96 void calcBounds();
97
98 virtual IntRect outlineBoundsForRepaint(RenderBox* /*repaintContainer*/) const;
99
100 private:
101 int calcReplacedWidth() const;
102 int calcReplacedHeight() const;
103
104 RenderObject* m_firstChild;
105 RenderObject* m_lastChild;
106
107 int m_width;
108 int m_height;
109
110 bool selfWillPaint() const;
111
112 bool m_drawsContents : 1;
113
114 protected:
115 IntRect m_absoluteBounds;
116 TransformationMatrix m_localTransform;
117 };
118
119 } // namespace WebCore
120
121 #endif // ENABLE(SVG)
122 #endif // RenderSVGContainer_h
123
124 // vim:ts=4:noet