|
1 /* |
|
2 Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> |
|
3 2004, 2005, 2007 Rob Buis <buis@kde.org> |
|
4 Copyright (C) 2009 Google, Inc. All rights reserved. |
|
5 Copyright (C) 2009 Apple Inc. All rights reserved. |
|
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 RenderSVGRoot_h |
|
24 #define RenderSVGRoot_h |
|
25 |
|
26 #if ENABLE(SVG) |
|
27 #include "RenderBox.h" |
|
28 #include "FloatRect.h" |
|
29 #include "SVGRenderSupport.h" |
|
30 |
|
31 namespace WebCore { |
|
32 |
|
33 class SVGStyledElement; |
|
34 class AffineTransform; |
|
35 |
|
36 class RenderSVGRoot : public RenderBox { |
|
37 public: |
|
38 RenderSVGRoot(SVGStyledElement*); |
|
39 |
|
40 const RenderObjectChildList* children() const { return &m_children; } |
|
41 RenderObjectChildList* children() { return &m_children; } |
|
42 |
|
43 bool isLayoutSizeChanged() const { return m_isLayoutSizeChanged; } |
|
44 |
|
45 private: |
|
46 virtual RenderObjectChildList* virtualChildren() { return children(); } |
|
47 virtual const RenderObjectChildList* virtualChildren() const { return children(); } |
|
48 |
|
49 virtual bool isSVGRoot() const { return true; } |
|
50 virtual const char* renderName() const { return "RenderSVGRoot"; } |
|
51 |
|
52 virtual int lineHeight(bool b, bool isRootLineBox = false) const; |
|
53 virtual int baselinePosition(bool b, bool isRootLineBox = false) const; |
|
54 virtual void calcPrefWidths(); |
|
55 virtual int calcReplacedWidth(bool includeMaxWidth = true) const; |
|
56 virtual int calcReplacedHeight() const; |
|
57 virtual void layout(); |
|
58 virtual void paint(PaintInfo&, int parentX, int parentY); |
|
59 |
|
60 virtual void destroy(); |
|
61 |
|
62 virtual const AffineTransform& localToParentTransform() const; |
|
63 |
|
64 bool fillContains(const FloatPoint&) const; |
|
65 bool strokeContains(const FloatPoint&) const; |
|
66 |
|
67 virtual FloatRect objectBoundingBox() const; |
|
68 virtual FloatRect strokeBoundingBox() const; |
|
69 virtual FloatRect repaintRectInLocalCoordinates() const; |
|
70 |
|
71 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction); |
|
72 |
|
73 virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer); |
|
74 virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& repaintRect, bool fixed); |
|
75 |
|
76 virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&) const; |
|
77 |
|
78 void calcViewport(); |
|
79 |
|
80 bool selfWillPaint() const; |
|
81 |
|
82 IntSize parentOriginToBorderBox() const; |
|
83 IntSize borderOriginToContentBox() const; |
|
84 AffineTransform localToRepaintContainerTransform(const IntPoint& parentOriginInContainer) const; |
|
85 AffineTransform localToBorderBoxTransform() const; |
|
86 |
|
87 RenderObjectChildList m_children; |
|
88 FloatSize m_viewportSize; |
|
89 mutable AffineTransform m_localToParentTransform; |
|
90 bool m_isLayoutSizeChanged : 1; |
|
91 }; |
|
92 |
|
93 inline RenderSVGRoot* toRenderSVGRoot(RenderObject* object) |
|
94 { |
|
95 ASSERT(!object || object->isSVGRoot()); |
|
96 return static_cast<RenderSVGRoot*>(object); |
|
97 } |
|
98 |
|
99 inline const RenderSVGRoot* toRenderSVGRoot(const RenderObject* object) |
|
100 { |
|
101 ASSERT(!object || object->isSVGRoot()); |
|
102 return static_cast<const RenderSVGRoot*>(object); |
|
103 } |
|
104 |
|
105 // This will catch anyone doing an unnecessary cast. |
|
106 void toRenderSVGRoot(const RenderSVGRoot*); |
|
107 |
|
108 } // namespace WebCore |
|
109 |
|
110 #endif // ENABLE(SVG) |
|
111 #endif // RenderSVGRoot_h |