|
1 /* |
|
2 Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> |
|
3 2004, 2005 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 "RenderContainer.h" |
|
29 #include "RenderPath.h" |
|
30 |
|
31 namespace WebCore { |
|
32 |
|
33 enum KCAlign { |
|
34 ALIGN_NONE = 0, |
|
35 ALIGN_XMINYMIN = 1, |
|
36 ALIGN_XMIDYMIN = 2, |
|
37 ALIGN_XMAXYMIN = 3, |
|
38 ALIGN_XMINYMID = 4, |
|
39 ALIGN_XMIDYMID = 5, |
|
40 ALIGN_XMAXYMID = 6, |
|
41 ALIGN_XMINYMAX = 7, |
|
42 ALIGN_XMIDYMAX = 8, |
|
43 ALIGN_XMAXYMAX = 9 |
|
44 }; |
|
45 |
|
46 class SVGElement; |
|
47 |
|
48 class RenderSVGContainer : public RenderContainer { |
|
49 public: |
|
50 RenderSVGContainer(SVGStyledElement*); |
|
51 ~RenderSVGContainer(); |
|
52 |
|
53 // Some containers do not want it's children |
|
54 // to be drawn, because they may be 'referenced' |
|
55 // Example: <marker> children in SVG |
|
56 void setDrawsContents(bool); |
|
57 bool drawsContents() const; |
|
58 |
|
59 virtual bool isSVGContainer() const { return true; } |
|
60 virtual const char* renderName() const { return "RenderSVGContainer"; } |
|
61 |
|
62 virtual bool requiresLayer(); |
|
63 virtual short lineHeight(bool b, bool isRootLineBox = false) const; |
|
64 virtual short baselinePosition(bool b, bool isRootLineBox = false) const; |
|
65 |
|
66 virtual void layout(); |
|
67 virtual void paint(PaintInfo&, int parentX, int parentY); |
|
68 |
|
69 virtual IntRect absoluteClippedOverflowRect(); |
|
70 virtual void absoluteRects(Vector<IntRect>& rects, int tx, int ty, bool topLevel = true); |
|
71 |
|
72 virtual AffineTransform absoluteTransform() const; |
|
73 |
|
74 bool fillContains(const FloatPoint&) const; |
|
75 bool strokeContains(const FloatPoint&) const; |
|
76 FloatRect relativeBBox(bool includeStroke = true) const; |
|
77 |
|
78 virtual AffineTransform localTransform() const; |
|
79 void setLocalTransform(const AffineTransform&); |
|
80 |
|
81 FloatRect viewport() const; |
|
82 |
|
83 void setViewBox(const FloatRect&); |
|
84 FloatRect viewBox() const; |
|
85 |
|
86 void setAlign(KCAlign); |
|
87 KCAlign align() const; |
|
88 |
|
89 void setSlice(bool); |
|
90 bool slice() const; |
|
91 |
|
92 AffineTransform viewportTransform() const; |
|
93 |
|
94 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction); |
|
95 |
|
96 private: |
|
97 void calcViewport(); |
|
98 AffineTransform getAspectRatio(const FloatRect& logical, const FloatRect& physical) const; |
|
99 |
|
100 bool m_drawsContents : 1; |
|
101 bool m_slice : 1; |
|
102 AffineTransform m_matrix; |
|
103 |
|
104 FloatRect m_viewport; |
|
105 FloatRect m_viewBox; |
|
106 KCAlign m_align; |
|
107 IntRect m_absoluteBounds; |
|
108 }; |
|
109 |
|
110 } // namespace WebCore |
|
111 |
|
112 #endif // ENABLE(SVG) |
|
113 #endif // RenderSVGContainer_h |
|
114 |
|
115 // vim:ts=4:noet |