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 31namespace WebCore { 32 33class SVGStyledElement; 34class AffineTransform; 35 36class RenderSVGRoot : public RenderBox, protected SVGRenderBase { 37public: 38 RenderSVGRoot(SVGStyledElement*); 39 40 const RenderObjectChildList* children() const { return &m_children; } 41 RenderObjectChildList* children() { return &m_children; } 42 43private: 44 virtual RenderObjectChildList* virtualChildren() { return children(); } 45 virtual const RenderObjectChildList* virtualChildren() const { return children(); } 46 47 virtual bool isSVGRoot() const { return true; } 48 virtual const char* renderName() const { return "RenderSVGRoot"; } 49 50 virtual int lineHeight(bool b, bool isRootLineBox = false) const; 51 virtual int baselinePosition(bool b, bool isRootLineBox = false) const; 52 virtual void calcPrefWidths(); 53 54 virtual void layout(); 55 virtual void paint(PaintInfo&, int parentX, int parentY); 56 57 virtual const AffineTransform& localToParentTransform() const; 58 59 bool fillContains(const FloatPoint&) const; 60 bool strokeContains(const FloatPoint&) const; 61 62 virtual FloatRect objectBoundingBox() const; 63 virtual FloatRect strokeBoundingBox() const { return computeContainerBoundingBox(this, true); } 64 virtual FloatRect repaintRectInLocalCoordinates() const; 65 66 // FIXME: This override should be removed. 67 virtual AffineTransform localTransform() const; 68 69 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction); 70 71 virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& repaintRect, bool fixed); 72 73 virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&) const; 74 75 void calcViewport(); 76 77 bool selfWillPaint() const; 78 79 IntSize parentOriginToBorderBox() const; 80 IntSize borderOriginToContentBox() const; 81 AffineTransform localToRepaintContainerTransform(const IntPoint& parentOriginInContainer) const; 82 AffineTransform localToBorderBoxTransform() const; 83 84 RenderObjectChildList m_children; 85 FloatSize m_viewportSize; 86 mutable AffineTransform m_localToParentTransform; 87}; 88 89inline RenderSVGRoot* toRenderSVGRoot(RenderObject* object) 90{ 91 ASSERT(!object || object->isSVGRoot()); 92 return static_cast<RenderSVGRoot*>(object); 93} 94 95inline const RenderSVGRoot* toRenderSVGRoot(const RenderObject* object) 96{ 97 ASSERT(!object || object->isSVGRoot()); 98 return static_cast<const RenderSVGRoot*>(object); 99} 100 101// This will catch anyone doing an unnecessary cast. 102void toRenderSVGRoot(const RenderSVGRoot*); 103 104} // namespace WebCore 105 106#endif // ENABLE(SVG) 107#endif // RenderSVGRoot_h 108 109// vim:ts=4:noet 110