|
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.seidel@kdemail.net> |
|
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 namespace WebCore { |
|
36 |
|
37 class FloatPoint; |
|
38 class Path; |
|
39 class RenderSVGContainer; |
|
40 class SVGStyledElement; |
|
41 |
|
42 class RenderPath : public RenderObject |
|
43 { |
|
44 public: |
|
45 RenderPath(RenderStyle* style, SVGStyledElement *node); |
|
46 virtual ~RenderPath(); |
|
47 |
|
48 // Hit-detection seperated for the fill and the stroke |
|
49 virtual bool fillContains(const FloatPoint&, bool requiresFill = true) const; |
|
50 virtual bool strokeContains(const FloatPoint&, bool requiresStroke = true) const; |
|
51 |
|
52 // Returns an unscaled bounding box (not even including localTransform()) for this vector path |
|
53 virtual FloatRect relativeBBox(bool includeStroke = true) const; |
|
54 |
|
55 const Path& path() const; |
|
56 void setPath(const Path& newPath); |
|
57 |
|
58 virtual bool isRenderPath() const { return true; } |
|
59 virtual const char* renderName() const { return "RenderPath"; } |
|
60 |
|
61 virtual AffineTransform localTransform() const; |
|
62 virtual void setLocalTransform(const AffineTransform& matrix); |
|
63 |
|
64 virtual void layout(); |
|
65 virtual IntRect absoluteClippedOverflowRect(); |
|
66 virtual bool requiresLayer(); |
|
67 virtual short lineHeight(bool b, bool isRootLineBox = false) const; |
|
68 virtual short baselinePosition(bool b, bool isRootLineBox = false) const; |
|
69 virtual void paint(PaintInfo&, int parentX, int parentY); |
|
70 |
|
71 virtual void absoluteRects(Vector<IntRect>&, int tx, int ty, bool topLevel = true); |
|
72 |
|
73 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction); |
|
74 |
|
75 FloatRect drawMarkersIfNeeded(GraphicsContext*, const FloatRect&, const Path&) const; |
|
76 virtual FloatRect strokeBBox() const; |
|
77 |
|
78 bool hasRelativeValues() const; |
|
79 |
|
80 private: |
|
81 FloatPoint mapAbsolutePointToLocal(const FloatPoint&) const; |
|
82 |
|
83 mutable Path m_path; |
|
84 mutable FloatRect m_fillBBox; |
|
85 mutable FloatRect m_strokeBbox; |
|
86 FloatRect m_markerBounds; |
|
87 AffineTransform m_matrix; |
|
88 IntRect m_absoluteBounds; |
|
89 }; |
|
90 |
|
91 } |
|
92 |
|
93 #endif // ENABLE(SVG) |
|
94 #endif |
|
95 |
|
96 // vim:ts=4:noet |