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 27 matching lines...) Expand all Loading... |
38 #include "core/svg/SVGGeometryElement.h" | 38 #include "core/svg/SVGGeometryElement.h" |
39 #include "core/svg/SVGLengthContext.h" | 39 #include "core/svg/SVGLengthContext.h" |
40 #include "core/svg/SVGPathElement.h" | 40 #include "core/svg/SVGPathElement.h" |
41 #include "platform/geometry/FloatPoint.h" | 41 #include "platform/geometry/FloatPoint.h" |
42 #include "platform/graphics/StrokeData.h" | 42 #include "platform/graphics/StrokeData.h" |
43 #include "wtf/MathExtras.h" | 43 #include "wtf/MathExtras.h" |
44 #include "wtf/PtrUtil.h" | 44 #include "wtf/PtrUtil.h" |
45 | 45 |
46 namespace blink { | 46 namespace blink { |
47 | 47 |
48 void LayoutSVGShape::adjustVisualRectForRasterEffects( | 48 bool LayoutSVGShape::adjustVisualRectForRasterEffects( |
49 LayoutRect& visualRect) const { | 49 LayoutRect& visualRect) const { |
50 // Account for raster expansions due to SVG stroke hairline raster effects. | 50 // Account for raster expansions due to SVG stroke hairline raster effects. |
51 if (styleRef().svgStyle().hasVisibleStroke()) { | 51 if (!visualRect.isEmpty() && styleRef().svgStyle().hasVisibleStroke()) { |
52 float pad = 0.5f; | 52 LayoutUnit pad(0.5f); |
53 if (styleRef().svgStyle().capStyle() != ButtCap) | 53 if (styleRef().svgStyle().capStyle() != ButtCap) |
54 pad += 0.5f; | 54 pad += 0.5f; |
55 visualRect.inflate(LayoutUnit(pad)); | 55 visualRect.inflate(pad); |
| 56 return true; |
56 } | 57 } |
| 58 return false; |
57 } | 59 } |
58 | 60 |
59 LayoutSVGShape::LayoutSVGShape(SVGGeometryElement* node) | 61 LayoutSVGShape::LayoutSVGShape(SVGGeometryElement* node) |
60 : LayoutSVGModelObject(node), | 62 : LayoutSVGModelObject(node), |
61 // Default is false, the cached rects are empty from the beginning. | 63 // Default is false, the cached rects are empty from the beginning. |
62 m_needsBoundariesUpdate(false), | 64 m_needsBoundariesUpdate(false), |
63 // Default is true, so we grab a Path object once from SVGGeometryElement. | 65 // Default is true, so we grab a Path object once from SVGGeometryElement. |
64 m_needsShapeUpdate(true), | 66 m_needsShapeUpdate(true), |
65 // Default is true, so we grab a AffineTransform object once from | 67 // Default is true, so we grab a AffineTransform object once from |
66 // SVGGeometryElement. | 68 // SVGGeometryElement. |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 return lengthContext.valueForLength(style()->svgStyle().strokeWidth()); | 329 return lengthContext.valueForLength(style()->svgStyle().strokeWidth()); |
328 } | 330 } |
329 | 331 |
330 LayoutSVGShapeRareData& LayoutSVGShape::ensureRareData() const { | 332 LayoutSVGShapeRareData& LayoutSVGShape::ensureRareData() const { |
331 if (!m_rareData) | 333 if (!m_rareData) |
332 m_rareData = wrapUnique(new LayoutSVGShapeRareData()); | 334 m_rareData = wrapUnique(new LayoutSVGShapeRareData()); |
333 return *m_rareData.get(); | 335 return *m_rareData.get(); |
334 } | 336 } |
335 | 337 |
336 } // namespace blink | 338 } // namespace blink |
OLD | NEW |