OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org> | 4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org> |
5 * Copyright (C) 2006 Apple Computer, Inc | 5 * Copyright (C) 2006 Apple Computer, Inc |
6 * Copyright (C) 2009 Google, Inc. | 6 * Copyright (C) 2009 Google, Inc. |
7 * Copyright (C) 2011 Renata Hodovan <reni@webkit.org> | 7 * Copyright (C) 2011 Renata Hodovan <reni@webkit.org> |
8 * Copyright (C) 2011 University of Szeged | 8 * Copyright (C) 2011 University of Szeged |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 12 matching lines...) Expand all Loading... |
23 * Boston, MA 02110-1301, USA. | 23 * Boston, MA 02110-1301, USA. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef RenderSVGShape_h | 26 #ifndef RenderSVGShape_h |
27 #define RenderSVGShape_h | 27 #define RenderSVGShape_h |
28 | 28 |
29 #if ENABLE(SVG) | 29 #if ENABLE(SVG) |
30 #include "AffineTransform.h" | 30 #include "AffineTransform.h" |
31 #include "FloatRect.h" | 31 #include "FloatRect.h" |
32 #include "RenderSVGModelObject.h" | 32 #include "RenderSVGModelObject.h" |
33 #include "SVGMarkerLayoutInfo.h" | 33 #include "SVGMarkerData.h" |
34 #include "StrokeStyleApplier.h" | 34 #include "StrokeStyleApplier.h" |
35 #include <wtf/OwnPtr.h> | 35 #include <wtf/OwnPtr.h> |
36 #include <wtf/Vector.h> | 36 #include <wtf/Vector.h> |
37 | 37 |
38 namespace WebCore { | 38 namespace WebCore { |
39 | 39 |
40 class FloatPoint; | 40 class FloatPoint; |
41 class GraphicsContextStateSaver; | 41 class GraphicsContextStateSaver; |
42 class RenderSVGContainer; | 42 class RenderSVGContainer; |
43 class RenderSVGPath; | 43 class RenderSVGPath; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 protected: | 86 protected: |
87 virtual void createShape(); | 87 virtual void createShape(); |
88 virtual bool isEmpty() const; | 88 virtual bool isEmpty() const; |
89 virtual FloatRect objectBoundingBox() const; | 89 virtual FloatRect objectBoundingBox() const; |
90 virtual FloatRect strokeBoundingBox() const { return m_strokeAndMarkerBoundi
ngBox; } | 90 virtual FloatRect strokeBoundingBox() const { return m_strokeAndMarkerBoundi
ngBox; } |
91 void setStrokeAndMarkerBoundingBox(FloatRect rect) { m_strokeAndMarkerBoundi
ngBox = rect; } | 91 void setStrokeAndMarkerBoundingBox(FloatRect rect) { m_strokeAndMarkerBoundi
ngBox = rect; } |
92 virtual bool shapeDependentStrokeContains(const FloatPoint&) const; | 92 virtual bool shapeDependentStrokeContains(const FloatPoint&) const; |
93 virtual bool shapeDependentFillContains(const FloatPoint&, const WindRule) c
onst; | 93 virtual bool shapeDependentFillContains(const FloatPoint&, const WindRule) c
onst; |
94 float strokeWidth() const; | 94 float strokeWidth() const; |
95 void setIsPaintingFallback(bool isFallback) { m_fillFallback = isFallback; } | 95 void setIsPaintingFallback(bool isFallback) { m_fillFallback = isFallback; } |
96 FloatRect calculateMarkerBoundsIfNeeded(); | |
97 void processZeroLengthSubpaths(); | |
98 | |
99 bool hasPath() const { return m_path.get(); } | 96 bool hasPath() const { return m_path.get(); } |
100 | 97 |
101 private: | 98 private: |
102 // Hit-detection separated for the fill and the stroke | 99 // Hit-detection separated for the fill and the stroke |
103 bool fillContains(const FloatPoint&, bool requiresFill = true, const WindRul
e fillRule = RULE_NONZERO); | 100 bool fillContains(const FloatPoint&, bool requiresFill = true, const WindRul
e fillRule = RULE_NONZERO); |
104 bool strokeContains(const FloatPoint&, bool requiresStroke = true); | 101 bool strokeContains(const FloatPoint&, bool requiresStroke = true); |
105 | 102 |
106 virtual FloatRect repaintRectInLocalCoordinates() const { return m_repaintBo
undingBox; } | 103 virtual FloatRect repaintRectInLocalCoordinates() const { return m_repaintBo
undingBox; } |
107 virtual const AffineTransform& localToParentTransform() const { return m_loc
alTransform; } | 104 virtual const AffineTransform& localToParentTransform() const { return m_loc
alTransform; } |
108 virtual AffineTransform localTransform() const { return m_localTransform; } | 105 virtual AffineTransform localTransform() const { return m_localTransform; } |
109 | 106 |
110 virtual bool isSVGShape() const { return true; } | 107 virtual bool isSVGShape() const { return true; } |
111 virtual const char* renderName() const { return "RenderSVGShape"; } | 108 virtual const char* renderName() const { return "RenderSVGShape"; } |
112 virtual bool isRoundedRect() { return false; } | 109 virtual bool isRoundedRect() { return false; } |
113 | 110 |
114 virtual void layout(); | 111 virtual void layout(); |
115 virtual void paint(PaintInfo&, const LayoutPoint&); | 112 virtual void paint(PaintInfo&, const LayoutPoint&); |
116 virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint&); | 113 virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint&); |
117 | 114 |
118 virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const F
loatPoint& pointInParent, HitTestAction); | 115 virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const F
loatPoint& pointInParent, HitTestAction); |
119 | 116 |
120 void updateCachedBoundaries(); | 117 void updateCachedBoundaries(); |
121 | 118 |
122 Path* zeroLengthLinecapPath(const FloatPoint&); | 119 Path* zeroLengthLinecapPath(const FloatPoint&); |
123 bool setupNonScalingStrokeTransform(AffineTransform&, GraphicsContextStateSa
ver&); | 120 bool setupNonScalingStrokeTransform(AffineTransform&, GraphicsContextStateSa
ver&); |
124 Path* nonScalingStrokePath(const Path*, const AffineTransform&); | 121 Path* nonScalingStrokePath(const Path*, const AffineTransform&); |
125 bool shouldStrokeZeroLengthSubpath() const; | 122 bool shouldStrokeZeroLengthSubpath() const; |
126 FloatRect zeroLengthSubpathRect(const FloatPoint&, float) const; | 123 FloatRect zeroLengthSubpathRect(const FloatPoint&, float) const; |
| 124 void processZeroLengthSubpaths(); |
| 125 |
| 126 bool shouldGenerateMarkerPositions() const; |
| 127 FloatRect markerRect(float strokeWidth) const; |
| 128 void processMarkerPositions(); |
127 | 129 |
128 void fillShape(RenderStyle*, GraphicsContext*, Path*, RenderSVGShape*); | 130 void fillShape(RenderStyle*, GraphicsContext*, Path*, RenderSVGShape*); |
129 void strokePath(RenderStyle*, GraphicsContext*, Path*, RenderSVGResource*, | 131 void strokePath(RenderStyle*, GraphicsContext*, Path*, RenderSVGResource*, |
130 const Color&, bool, const AffineTransform&, int); | 132 const Color&, bool, const AffineTransform&, int); |
131 void fillAndStrokePath(GraphicsContext*); | 133 void fillAndStrokePath(GraphicsContext*); |
132 void inflateWithStrokeAndMarkerBounds(); | 134 void inflateWithStrokeAndMarkerBounds(); |
| 135 void drawMarkers(PaintInfo&); |
133 | 136 |
134 private: | 137 private: |
135 FloatRect m_fillBoundingBox; | 138 FloatRect m_fillBoundingBox; |
136 FloatRect m_strokeAndMarkerBoundingBox; | 139 FloatRect m_strokeAndMarkerBoundingBox; |
137 FloatRect m_repaintBoundingBox; | 140 FloatRect m_repaintBoundingBox; |
138 SVGMarkerLayoutInfo m_markerLayoutInfo; | |
139 AffineTransform m_localTransform; | 141 AffineTransform m_localTransform; |
140 OwnPtr<Path> m_path; | 142 OwnPtr<Path> m_path; |
141 Vector<FloatPoint> m_zeroLengthLinecapLocations; | 143 Vector<FloatPoint> m_zeroLengthLinecapLocations; |
| 144 Vector<MarkerPosition> m_markerPositions; |
142 | 145 |
143 bool m_needsBoundariesUpdate : 1; | 146 bool m_needsBoundariesUpdate : 1; |
144 bool m_needsShapeUpdate : 1; | 147 bool m_needsShapeUpdate : 1; |
145 bool m_needsTransformUpdate : 1; | 148 bool m_needsTransformUpdate : 1; |
146 bool m_fillFallback : 1; | 149 bool m_fillFallback : 1; |
147 }; | 150 }; |
148 | 151 |
149 inline RenderSVGShape* toRenderSVGShape(RenderObject* object) | 152 inline RenderSVGShape* toRenderSVGShape(RenderObject* object) |
150 { | 153 { |
151 ASSERT(!object || object->isSVGShape()); | 154 ASSERT(!object || object->isSVGShape()); |
152 return static_cast<RenderSVGShape*>(object); | 155 return static_cast<RenderSVGShape*>(object); |
153 } | 156 } |
154 | 157 |
155 inline const RenderSVGShape* toRenderSVGShape(const RenderObject* object) | 158 inline const RenderSVGShape* toRenderSVGShape(const RenderObject* object) |
156 { | 159 { |
157 ASSERT(!object || object->isSVGShape()); | 160 ASSERT(!object || object->isSVGShape()); |
158 return static_cast<const RenderSVGShape*>(object); | 161 return static_cast<const RenderSVGShape*>(object); |
159 } | 162 } |
160 | 163 |
161 // This will catch anyone doing an unnecessary cast. | 164 // This will catch anyone doing an unnecessary cast. |
162 void toRenderSVGShape(const RenderSVGShape*); | 165 void toRenderSVGShape(const RenderSVGShape*); |
163 | 166 |
164 } | 167 } |
165 | 168 |
166 #endif // ENABLE(SVG) | 169 #endif // ENABLE(SVG) |
167 #endif | 170 #endif |
OLD | NEW |