| 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, 2008 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2008 Rob Buis <buis@kde.org> |
| 4 * Copyright (C) 2005, 2007 Eric Seidel <eric@webkit.org> | 4 * Copyright (C) 2005, 2007 Eric Seidel <eric@webkit.org> |
| 5 * Copyright (C) 2009 Google, Inc. | 5 * Copyright (C) 2009 Google, Inc. |
| 6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> | 6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
| 7 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 7 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 8 * Copyright (C) 2009 Jeff Schiller <codedread@gmail.com> | 8 * Copyright (C) 2009 Jeff Schiller <codedread@gmail.com> |
| 9 * Copyright (C) 2011 Renata Hodovan <reni@webkit.org> | 9 * Copyright (C) 2011 Renata Hodovan <reni@webkit.org> |
| 10 * Copyright (C) 2011 University of Szeged | 10 * Copyright (C) 2011 University of Szeged |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 { | 42 { |
| 43 } | 43 } |
| 44 | 44 |
| 45 RenderSVGPath::~RenderSVGPath() | 45 RenderSVGPath::~RenderSVGPath() |
| 46 { | 46 { |
| 47 } | 47 } |
| 48 | 48 |
| 49 void RenderSVGPath::updateShapeFromElement() | 49 void RenderSVGPath::updateShapeFromElement() |
| 50 { | 50 { |
| 51 RenderSVGShape::updateShapeFromElement(); | 51 RenderSVGShape::updateShapeFromElement(); |
| 52 |
| 52 updateZeroLengthSubpaths(); | 53 updateZeroLengthSubpaths(); |
| 54 m_hitTestStrokeBoundingBox = calculateUpdatedHitTestStrokeBoundingBox(); |
| 53 | 55 |
| 54 m_strokeBoundingBox = calculateUpdatedStrokeBoundingBox(); | 56 m_strokeBoundingBox = style()->svgStyle().hasStroke() ? m_hitTestStrokeBound
ingBox : m_fillBoundingBox; |
| 57 |
| 58 if (!m_markerPositions.isEmpty()) { |
| 59 const FloatRect markerRect = this->markerRect(strokeWidth()); |
| 60 m_strokeBoundingBox.unite(markerRect); |
| 61 } |
| 55 } | 62 } |
| 56 | 63 |
| 57 FloatRect RenderSVGPath::calculateUpdatedStrokeBoundingBox() const | 64 FloatRect RenderSVGPath::calculateUpdatedHitTestStrokeBoundingBox() const |
| 58 { | 65 { |
| 59 FloatRect strokeBoundingBox = m_strokeBoundingBox; | 66 FloatRect strokeBoundingBox = m_hitTestStrokeBoundingBox; |
| 60 | 67 |
| 61 if (!m_markerPositions.isEmpty()) | 68 // FIXME: zero-length subpaths do not respect vector-effect = non-scaling-st
roke. |
| 62 strokeBoundingBox.unite(markerRect(strokeWidth())); | 69 const float strokeWidth = this->strokeWidth(); |
| 63 | 70 for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i) |
| 64 if (style()->svgStyle().hasStroke()) { | 71 strokeBoundingBox.unite(zeroLengthSubpathRect(m_zeroLengthLinecapLocatio
ns[i], strokeWidth)); |
| 65 // FIXME: zero-length subpaths do not respect vector-effect = non-scalin
g-stroke. | |
| 66 float strokeWidth = this->strokeWidth(); | |
| 67 for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i) | |
| 68 strokeBoundingBox.unite(zeroLengthSubpathRect(m_zeroLengthLinecapLoc
ations[i], strokeWidth)); | |
| 69 } | |
| 70 | 72 |
| 71 return strokeBoundingBox; | 73 return strokeBoundingBox; |
| 72 } | 74 } |
| 73 | 75 |
| 74 bool RenderSVGPath::shapeDependentStrokeContains(const FloatPoint& point) | 76 bool RenderSVGPath::shapeDependentStrokeContains(const FloatPoint& point) |
| 75 { | 77 { |
| 76 if (RenderSVGShape::shapeDependentStrokeContains(point)) | 78 if (RenderSVGShape::shapeDependentStrokeContains(point)) |
| 77 return true; | 79 return true; |
| 78 | 80 |
| 79 const SVGRenderStyle& svgStyle = style()->svgStyle(); | 81 const SVGRenderStyle& svgStyle = style()->svgStyle(); |
| 82 const float strokeWidth = this->strokeWidth(); |
| 80 for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i) { | 83 for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i) { |
| 81 ASSERT(svgStyle.hasStroke()); | 84 ASSERT(svgStyle.hasStroke()); |
| 82 float strokeWidth = this->strokeWidth(); | |
| 83 if (svgStyle.capStyle() == SquareCap) { | 85 if (svgStyle.capStyle() == SquareCap) { |
| 84 if (zeroLengthSubpathRect(m_zeroLengthLinecapLocations[i], strokeWid
th).contains(point)) | 86 if (zeroLengthSubpathRect(m_zeroLengthLinecapLocations[i], strokeWid
th).contains(point)) |
| 85 return true; | 87 return true; |
| 86 } else { | 88 } else { |
| 87 ASSERT(svgStyle.capStyle() == RoundCap); | 89 ASSERT(svgStyle.capStyle() == RoundCap); |
| 88 FloatPoint radiusVector(point.x() - m_zeroLengthLinecapLocations[i].
x(), point.y() - m_zeroLengthLinecapLocations[i].y()); | 90 FloatPoint radiusVector(point.x() - m_zeroLengthLinecapLocations[i].
x(), point.y() - m_zeroLengthLinecapLocations[i].y()); |
| 89 if (radiusVector.lengthSquared() < strokeWidth * strokeWidth * .25f) | 91 if (radiusVector.lengthSquared() < strokeWidth * strokeWidth * .25f) |
| 90 return true; | 92 return true; |
| 91 } | 93 } |
| 92 } | 94 } |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 ASSERT(resources); | 166 ASSERT(resources); |
| 165 | 167 |
| 166 RenderSVGResourceMarker* markerStart = resources->markerStart(); | 168 RenderSVGResourceMarker* markerStart = resources->markerStart(); |
| 167 | 169 |
| 168 SVGMarkerData markerData(m_markerPositions, markerStart ? markerStart->orien
tType() == SVGMarkerOrientAutoStartReverse : false); | 170 SVGMarkerData markerData(m_markerPositions, markerStart ? markerStart->orien
tType() == SVGMarkerOrientAutoStartReverse : false); |
| 169 path().apply(&markerData, SVGMarkerData::updateFromPathElement); | 171 path().apply(&markerData, SVGMarkerData::updateFromPathElement); |
| 170 markerData.pathIsDone(); | 172 markerData.pathIsDone(); |
| 171 } | 173 } |
| 172 | 174 |
| 173 } | 175 } |
| OLD | NEW |