File indexing completed on 2024-04-28 11:39:00

0001 /*
0002     Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
0003                   2004, 2005, 2007 Rob Buis <buis@kde.org>
0004 
0005     This file is part of the KDE project
0006 
0007     This library is free software; you can redistribute it and/or
0008     modify it under the terms of the GNU Library General Public
0009     License as published by the Free Software Foundation; either
0010     version 2 of the License, or (at your option) any later version.
0011 
0012     This library is distributed in the hope that it will be useful,
0013     but WITHOUT ANY WARRANTY; without even the implied warranty of
0014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0015     Library General Public License for more details.
0016 
0017     You should have received a copy of the GNU Library General Public License
0018     aint with this library; see the file COPYING.LIB.  If not, write to
0019     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0020     Boston, MA 02110-1301, USA.
0021 */
0022 
0023 #ifndef RenderSVGRoot_h
0024 #define RenderSVGRoot_h
0025 
0026 #if ENABLE(SVG)
0027 //#include "RenderContainer.h"
0028 #include "RenderBox.h"
0029 #include "FloatRect.h"
0030 
0031 namespace WebCore
0032 {
0033 
0034 class SVGStyledElement;
0035 class AffineTransform;
0036 
0037 class RenderSVGRoot : public RenderBox /*RenderContainer in WebCore*/
0038 {
0039 public:
0040     RenderSVGRoot(SVGStyledElement *);
0041     ~RenderSVGRoot();
0042 
0043     bool isSVGRoot() const override
0044     {
0045         return true;
0046     }
0047     const char *renderName() const override
0048     {
0049         return "RenderSVGRoot";
0050     }
0051 
0052     short lineHeight(bool b) const override;
0053     short baselinePosition(bool b) const override;
0054     void calcMinMaxWidth() override;
0055 
0056     void layout() override;
0057     void paint(PaintInfo &, int parentX, int parentY) override;
0058 
0059     virtual IntRect absoluteClippedOverflowRect();
0060     virtual void absoluteRects(Vector<IntRect> &rects, int tx, int ty);
0061     //virtual void addFocusRingRects(GraphicsContext*, int tx, int ty);
0062 
0063     AffineTransform absoluteTransform() const override;
0064 
0065     bool fillContains(const FloatPoint &) const;
0066     bool strokeContains(const FloatPoint &) const;
0067     FloatRect relativeBBox(bool includeStroke = true) const override;
0068 
0069     AffineTransform localTransform() const override;
0070 
0071     FloatRect viewport() const;
0072 
0073     //virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
0074 
0075 private:
0076     void calcViewport();
0077 
0078     //void applyContentTransforms(PaintInfo&, int parentX, int parentY);
0079 
0080     FloatRect m_viewport;
0081     IntRect m_absoluteBounds;
0082 };
0083 
0084 } // namespace WebCore
0085 
0086 #endif // ENABLE(SVG)
0087 #endif // RenderSVGRoot_h
0088