1 /* 2 Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 2004, 2005 Rob Buis <buis@kde.org> 4 2005 Eric Seidel <eric@webkit.org> 5 2006 Apple Computer, Inc 6 7 This file is part of the KDE project 8 9 This library is free software; you can redistribute it and/or 10 modify it under the terms of the GNU Library General Public 11 License as published by the Free Software Foundation; either 12 version 2 of the License, or (at your option) any later version. 13 14 This library is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 Library General Public License for more details. 18 19 You should have received a copy of the GNU Library General Public License 20 aint with this library; see the file COPYING.LIB. If not, write to 21 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 22 Boston, MA 02110-1301, USA. 23 */ 24 25 #ifndef RenderPath_h 26 #define RenderPath_h 27 28 #if ENABLE(SVG) 29 30 #include "AffineTransform.h" 31 #include "FloatRect.h" 32 33 #include "RenderObject.h" 34 35 #include "IntRect.h" 36 #include "Path.h" 37 #include "FloatPoint.h" 38 39 namespace WebCore 40 { 41 42 class FloatPoint; 43 //class Path; 44 //class RenderSVGContainer; 45 class SVGStyledTransformableElement; 46 47 class RenderPath : public RenderObject 48 { 49 public: 50 RenderPath(RenderStyle *, SVGStyledTransformableElement *); 51 virtual ~RenderPath(); 52 53 // Hit-detection separated for the fill and the stroke 54 virtual bool fillContains(const FloatPoint &, bool requiresFill = true) const; 55 /*virtual bool strokeContains(const FloatPoint&, bool requiresStroke = true) const;*/ 56 57 // Returns an unscaled bounding box (not even including localTransform()) for this vector path 58 FloatRect relativeBBox(bool includeStroke = true) const override; 59 60 const khtml::Path &path() const; 61 void setPath(const khtml::Path &newPath); 62 isRenderPath()63 bool isRenderPath() const override 64 { 65 return true; 66 } renderName()67 const char *renderName() const override 68 { 69 return "RenderPath"; 70 } 71 72 bool calculateLocalTransform(); 73 AffineTransform localTransform() const override; 74 75 void layout() override; 76 virtual IntRect absoluteClippedOverflowRect(); 77 bool requiresLayer() const override; 78 short lineHeight(bool b) const override; 79 short baselinePosition(bool b) const override; 80 void paint(PaintInfo &, int parentX, int parentY) override; 81 82 virtual void absoluteRects(Vector<IntRect> &, int tx, int ty, bool topLevel = true); 83 /*virtual void addFocusRingRects(GraphicsContext*, int tx, int ty); 84 85 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction); 86 87 FloatRect drawMarkersIfNeeded(GraphicsContext*, const FloatRect&, const Path&) const;*/ 88 /*virtual FloatRect strokeBBox() const;*/ 89 90 private: 91 FloatPoint mapAbsolutePointToLocal(const FloatPoint &) const; 92 93 mutable khtml::Path m_path; 94 mutable FloatRect m_fillBBox; 95 mutable FloatRect m_strokeBbox; 96 FloatRect m_markerBounds; 97 AffineTransform m_localTransform; 98 IntRect m_absoluteBounds; 99 }; 100 101 } 102 103 #endif // ENABLE(SVG) 104 #endif 105 106