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; }
70 virtual void determineIfLayoutSizeChanged() { }
73 void updateCachedBoundaries();
76 RenderObjectChildList m_children;
77 FloatRect m_objectBoundingBox;
78 FloatRect m_strokeBoundingBox;
79 FloatRect m_repaintBoundingBox;
80 bool m_needsBoundariesUpdate : 1;
83 inline RenderSVGContainer* toRenderSVGContainer(RenderObject* object)
85 // Note: isSVGContainer is also true for RenderSVGViewportContainer, which is not derived from this.
86 ASSERT(!object || (object->isSVGContainer() && strcmp(object->renderName(), "RenderSVGViewportContainer")));
87 return static_cast<RenderSVGContainer*>(object);
90 inline const RenderSVGContainer* toRenderSVGContainer(const RenderObject* object)
92 // Note: isSVGContainer is also true for RenderSVGViewportContainer, which is not derived from this.
93 ASSERT(!object || (object->isSVGContainer() && strcmp(object->renderName(), "RenderSVGViewportContainer")));
94 return static_cast<const RenderSVGContainer*>(object);
97 // This will catch anyone doing an unnecessary cast.
98 void toRenderSVGContainer(const RenderSVGContainer*);
100 } // namespace WebCore
102 #endif // ENABLE(SVG)
103 #endif // RenderSVGContainer_h