File indexing completed on 2025-04-27 10:07:42
0001 /* 0002 Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 0003 2004, 2005 Rob Buis <buis@kde.org> 0004 2005 Eric Seidel <eric@webkit.org> 0005 2006 Apple Computer, Inc 0006 0007 This file is part of the KDE project 0008 0009 This library is free software; you can redistribute it and/or 0010 modify it under the terms of the GNU Library General Public 0011 License as published by the Free Software Foundation; either 0012 version 2 of the License, or (at your option) any later version. 0013 0014 This library is distributed in the hope that it will be useful, 0015 but WITHOUT ANY WARRANTY; without even the implied warranty of 0016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0017 Library General Public License for more details. 0018 0019 You should have received a copy of the GNU Library General Public License 0020 aint with this library; see the file COPYING.LIB. If not, write to 0021 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0022 Boston, MA 02110-1301, USA. 0023 */ 0024 0025 #ifndef RenderPath_h 0026 #define RenderPath_h 0027 0028 #if ENABLE(SVG) 0029 0030 #include "AffineTransform.h" 0031 #include "FloatRect.h" 0032 0033 #include "RenderObject.h" 0034 0035 #include "IntRect.h" 0036 #include "Path.h" 0037 #include "FloatPoint.h" 0038 0039 namespace WebCore 0040 { 0041 0042 class FloatPoint; 0043 //class Path; 0044 //class RenderSVGContainer; 0045 class SVGStyledTransformableElement; 0046 0047 class RenderPath : public RenderObject 0048 { 0049 public: 0050 RenderPath(RenderStyle *, SVGStyledTransformableElement *); 0051 virtual ~RenderPath(); 0052 0053 // Hit-detection separated for the fill and the stroke 0054 virtual bool fillContains(const FloatPoint &, bool requiresFill = true) const; 0055 /*virtual bool strokeContains(const FloatPoint&, bool requiresStroke = true) const;*/ 0056 0057 // Returns an unscaled bounding box (not even including localTransform()) for this vector path 0058 FloatRect relativeBBox(bool includeStroke = true) const override; 0059 0060 const khtml::Path &path() const; 0061 void setPath(const khtml::Path &newPath); 0062 0063 bool isRenderPath() const override 0064 { 0065 return true; 0066 } 0067 const char *renderName() const override 0068 { 0069 return "RenderPath"; 0070 } 0071 0072 bool calculateLocalTransform(); 0073 AffineTransform localTransform() const override; 0074 0075 void layout() override; 0076 virtual IntRect absoluteClippedOverflowRect(); 0077 bool requiresLayer() const override; 0078 short lineHeight(bool b) const override; 0079 short baselinePosition(bool b) const override; 0080 void paint(PaintInfo &, int parentX, int parentY) override; 0081 0082 virtual void absoluteRects(Vector<IntRect> &, int tx, int ty, bool topLevel = true); 0083 /*virtual void addFocusRingRects(GraphicsContext*, int tx, int ty); 0084 0085 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction); 0086 0087 FloatRect drawMarkersIfNeeded(GraphicsContext*, const FloatRect&, const Path&) const;*/ 0088 /*virtual FloatRect strokeBBox() const;*/ 0089 0090 private: 0091 FloatPoint mapAbsolutePointToLocal(const FloatPoint &) const; 0092 0093 mutable khtml::Path m_path; 0094 mutable FloatRect m_fillBBox; 0095 mutable FloatRect m_strokeBbox; 0096 FloatRect m_markerBounds; 0097 AffineTransform m_localTransform; 0098 IntRect m_absoluteBounds; 0099 }; 0100 0101 } 0102 0103 #endif // ENABLE(SVG) 0104 #endif 0105