2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 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.
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 * along 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 "RenderSVGModelObject.h"
34 class RenderSVGContainer : public RenderSVGModelObject {
36 explicit RenderSVGContainer(SVGStyledElement*);
37 virtual ~RenderSVGContainer();
39 const RenderObjectChildList* children() const { return &m_children; }
40 RenderObjectChildList* children() { return &m_children; }
42 virtual void paint(PaintInfo&, const LayoutPoint&);
43 virtual void setNeedsBoundariesUpdate() { m_needsBoundariesUpdate = true; }
46 virtual RenderObjectChildList* virtualChildren() { return children(); }
47 virtual const RenderObjectChildList* virtualChildren() const { return children(); }
49 virtual bool isSVGContainer() const { return true; }
50 virtual const char* renderName() const { return "RenderSVGContainer"; }
52 virtual void layout();
54 virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint&);
56 virtual FloatRect objectBoundingBox() const { return m_objectBoundingBox; }
57 virtual FloatRect strokeBoundingBox() const { return m_strokeBoundingBox; }
58 virtual FloatRect repaintRectInLocalCoordinates() const { return m_repaintBoundingBox; }
60 virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction);
62 // Allow RenderSVGTransformableContainer to hook in at the right time in layout()
63 virtual bool calculateLocalTransform() { return false; }
65 // Allow RenderSVGViewportContainer to hook in at the right times in layout(), paint() and nodeAtFloatPoint()
66 virtual void calcViewport() { }
67 virtual void applyViewportClip(PaintInfo&) { }
68 virtual bool pointIsInsideViewportClip(const FloatPoint& /*pointInParent*/) { return true; }
71 void updateCachedBoundaries();
74 RenderObjectChildList m_children;
75 FloatRect m_objectBoundingBox;
76 FloatRect m_strokeBoundingBox;
77 FloatRect m_repaintBoundingBox;
78 bool m_needsBoundariesUpdate : 1;
81 inline RenderSVGContainer* toRenderSVGContainer(RenderObject* object)
83 // Note: isSVGContainer is also true for RenderSVGViewportContainer, which is not derived from this.
84 ASSERT(!object || (object->isSVGContainer() && strcmp(object->renderName(), "RenderSVGViewportContainer")));
85 return static_cast<RenderSVGContainer*>(object);
88 inline const RenderSVGContainer* toRenderSVGContainer(const RenderObject* object)
90 // Note: isSVGContainer is also true for RenderSVGViewportContainer, which is not derived from this.
91 ASSERT(!object || (object->isSVGContainer() && strcmp(object->renderName(), "RenderSVGViewportContainer")));
92 return static_cast<const RenderSVGContainer*>(object);
95 // This will catch anyone doing an unnecessary cast.
96 void toRenderSVGContainer(const RenderSVGContainer*);
98 } // namespace WebCore
100 #endif // ENABLE(SVG)
101 #endif // RenderSVGContainer_h