Chromium Code Reviews| 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_hitTestStrokeBoundingBox.unite(markerRect); | |
|
fs
2015/01/23 11:26:48
This line not needed. (Markers not "sensitive" to
| |
| 61 m_strokeBoundingBox.unite(markerRect); | |
| 62 } | |
| 55 } | 63 } |
| 56 | 64 |
| 57 FloatRect RenderSVGPath::calculateUpdatedStrokeBoundingBox() const | 65 FloatRect RenderSVGPath::calculateUpdatedHitTestStrokeBoundingBox() const |
| 58 { | 66 { |
| 59 FloatRect strokeBoundingBox = m_strokeBoundingBox; | 67 FloatRect strokeBoundingBox = m_hitTestStrokeBoundingBox; |
| 60 | 68 |
| 61 if (!m_markerPositions.isEmpty()) | 69 // FIXME: zero-length subpaths do not respect vector-effect = non-scaling-st roke. |
| 62 strokeBoundingBox.unite(markerRect(strokeWidth())); | 70 const float strokeWidth = this->strokeWidth(); |
| 63 | 71 for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i) |
| 64 if (style()->svgStyle().hasStroke()) { | 72 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 | 73 |
| 71 return strokeBoundingBox; | 74 return strokeBoundingBox; |
| 72 } | 75 } |
| 73 | 76 |
| 74 bool RenderSVGPath::shapeDependentStrokeContains(const FloatPoint& point) | 77 bool RenderSVGPath::shapeDependentStrokeContains(const FloatPoint& point) |
| 75 { | 78 { |
| 76 if (RenderSVGShape::shapeDependentStrokeContains(point)) | 79 if (RenderSVGShape::shapeDependentStrokeContains(point)) |
| 77 return true; | 80 return true; |
| 78 | 81 |
| 79 const SVGRenderStyle& svgStyle = style()->svgStyle(); | 82 const SVGRenderStyle& svgStyle = style()->svgStyle(); |
| 83 const float strokeWidth = this->strokeWidth(); | |
| 80 for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i) { | 84 for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i) { |
| 81 ASSERT(svgStyle.hasStroke()); | 85 ASSERT(svgStyle.hasStroke()); |
| 82 float strokeWidth = this->strokeWidth(); | |
| 83 if (svgStyle.capStyle() == SquareCap) { | 86 if (svgStyle.capStyle() == SquareCap) { |
| 84 if (zeroLengthSubpathRect(m_zeroLengthLinecapLocations[i], strokeWid th).contains(point)) | 87 if (zeroLengthSubpathRect(m_zeroLengthLinecapLocations[i], strokeWid th).contains(point)) |
| 85 return true; | 88 return true; |
| 86 } else { | 89 } else { |
| 87 ASSERT(svgStyle.capStyle() == RoundCap); | 90 ASSERT(svgStyle.capStyle() == RoundCap); |
| 88 FloatPoint radiusVector(point.x() - m_zeroLengthLinecapLocations[i]. x(), point.y() - m_zeroLengthLinecapLocations[i].y()); | 91 FloatPoint radiusVector(point.x() - m_zeroLengthLinecapLocations[i]. x(), point.y() - m_zeroLengthLinecapLocations[i].y()); |
| 89 if (radiusVector.lengthSquared() < strokeWidth * strokeWidth * .25f) | 92 if (radiusVector.lengthSquared() < strokeWidth * strokeWidth * .25f) |
| 90 return true; | 93 return true; |
| 91 } | 94 } |
| 92 } | 95 } |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 164 ASSERT(resources); | 167 ASSERT(resources); |
| 165 | 168 |
| 166 RenderSVGResourceMarker* markerStart = resources->markerStart(); | 169 RenderSVGResourceMarker* markerStart = resources->markerStart(); |
| 167 | 170 |
| 168 SVGMarkerData markerData(m_markerPositions, markerStart ? markerStart->orien tType() == SVGMarkerOrientAutoStartReverse : false); | 171 SVGMarkerData markerData(m_markerPositions, markerStart ? markerStart->orien tType() == SVGMarkerOrientAutoStartReverse : false); |
| 169 path().apply(&markerData, SVGMarkerData::updateFromPathElement); | 172 path().apply(&markerData, SVGMarkerData::updateFromPathElement); |
| 170 markerData.pathIsDone(); | 173 markerData.pathIsDone(); |
| 171 } | 174 } |
| 172 | 175 |
| 173 } | 176 } |
| OLD | NEW |