• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 RenderSVGContainer_h
24 #define RenderSVGContainer_h
25 
26 #if ENABLE(SVG)
27 
28 #include "RenderSVGModelObject.h"
29 
30 namespace WebCore {
31 
32 class SVGElement;
33 
34 class RenderSVGContainer : public RenderSVGModelObject {
35 public:
36     RenderSVGContainer(SVGStyledElement*);
37 
children()38     const RenderObjectChildList* children() const { return &m_children; }
children()39     RenderObjectChildList* children() { return &m_children; }
40 
41     // <marker> uses these methods to only allow drawing children during a special marker draw time
42     void setDrawsContents(bool);
43     bool drawsContents() const;
44 
45 protected:
46     virtual void paint(PaintInfo&, int parentX, int parentY);
47 
48 private:
virtualChildren()49     virtual RenderObjectChildList* virtualChildren() { return children(); }
virtualChildren()50     virtual const RenderObjectChildList* virtualChildren() const { return children(); }
51 
isSVGContainer()52     virtual bool isSVGContainer() const { return true; }
renderName()53     virtual const char* renderName() const { return "RenderSVGContainer"; }
54 
55     virtual void layout();
56 
57     virtual void addFocusRingRects(GraphicsContext*, int tx, int ty);
58 
59     virtual FloatRect objectBoundingBox() const;
60     virtual FloatRect repaintRectInLocalCoordinates() const;
61 
62     virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction);
63 
64     // Allow RenderSVGTransformableContainer to hook in at the right time in layout()
calculateLocalTransform()65     virtual void calculateLocalTransform() { }
66 
67     // Allow RenderSVGViewportContainer to hook in at the right times in layout(), paint() and nodeAtFloatPoint()
calcViewport()68     virtual void calcViewport() { }
applyViewportClip(PaintInfo &)69     virtual void applyViewportClip(PaintInfo&) { }
pointIsInsideViewportClip(const FloatPoint &)70     virtual bool pointIsInsideViewportClip(const FloatPoint& /*pointInParent*/) { return true; }
71 
72     bool selfWillPaint() const;
73 
74     RenderObjectChildList m_children;
75     bool m_drawsContents : 1;
76 };
77 
toRenderSVGContainer(RenderObject * object)78 inline RenderSVGContainer* toRenderSVGContainer(RenderObject* object)
79 {
80     // Note: isSVGContainer is also true for RenderSVGViewportContainer, which is not derived from this.
81     ASSERT(!object || object->isSVGContainer() && strcmp(object->renderName(), "RenderSVGViewportContainer"));
82     return static_cast<RenderSVGContainer*>(object);
83 }
84 
toRenderSVGContainer(const RenderObject * object)85 inline const RenderSVGContainer* toRenderSVGContainer(const RenderObject* object)
86 {
87     // Note: isSVGContainer is also true for RenderSVGViewportContainer, which is not derived from this.
88     ASSERT(!object || object->isSVGContainer() && strcmp(object->renderName(), "RenderSVGViewportContainer"));
89     return static_cast<const RenderSVGContainer*>(object);
90 }
91 
92 // This will catch anyone doing an unnecessary cast.
93 void toRenderSVGContainer(const RenderSVGContainer*);
94 
95 } // namespace WebCore
96 
97 #endif // ENABLE(SVG)
98 #endif // RenderSVGContainer_h
99 
100 // vim:ts=4:noet
101