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 23 matching lines...) Expand all Loading... |
34 #include "core/layout/svg/SVGLayoutSupport.h" | 34 #include "core/layout/svg/SVGLayoutSupport.h" |
35 #include "core/layout/svg/SVGResources.h" | 35 #include "core/layout/svg/SVGResources.h" |
36 #include "core/layout/svg/SVGResourcesCache.h" | 36 #include "core/layout/svg/SVGResourcesCache.h" |
37 #include "core/paint/SVGShapePainter.h" | 37 #include "core/paint/SVGShapePainter.h" |
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 | 45 |
45 namespace blink { | 46 namespace blink { |
46 | 47 |
47 LayoutSVGShape::LayoutSVGShape(SVGGeometryElement* node) | 48 LayoutSVGShape::LayoutSVGShape(SVGGeometryElement* node) |
48 : LayoutSVGModelObject(node) | 49 : LayoutSVGModelObject(node) |
49 , m_needsBoundariesUpdate(false) // Default is false, the cached rects are e
mpty from the beginning. | 50 , m_needsBoundariesUpdate(false) // Default is false, the cached rects are e
mpty from the beginning. |
50 , m_needsShapeUpdate(true) // Default is true, so we grab a Path object once
from SVGGeometryElement. | 51 , m_needsShapeUpdate(true) // Default is true, so we grab a Path object once
from SVGGeometryElement. |
51 , m_needsTransformUpdate(true) // Default is true, so we grab a AffineTransf
orm object once from SVGGeometryElement. | 52 , m_needsTransformUpdate(true) // Default is true, so we grab a AffineTransf
orm object once from SVGGeometryElement. |
52 { | 53 { |
53 } | 54 } |
54 | 55 |
55 LayoutSVGShape::~LayoutSVGShape() | 56 LayoutSVGShape::~LayoutSVGShape() |
56 { | 57 { |
57 } | 58 } |
58 | 59 |
59 void LayoutSVGShape::createPath() | 60 void LayoutSVGShape::createPath() |
60 { | 61 { |
61 if (!m_path) | 62 if (!m_path) |
62 m_path = adoptPtr(new Path()); | 63 m_path = wrapUnique(new Path()); |
63 *m_path = toSVGGeometryElement(element())->asPath(); | 64 *m_path = toSVGGeometryElement(element())->asPath(); |
64 if (m_rareData.get()) | 65 if (m_rareData.get()) |
65 m_rareData->m_cachedNonScalingStrokePath.clear(); | 66 m_rareData->m_cachedNonScalingStrokePath.clear(); |
66 } | 67 } |
67 | 68 |
68 float LayoutSVGShape::dashScaleFactor() const | 69 float LayoutSVGShape::dashScaleFactor() const |
69 { | 70 { |
70 if (!isSVGPathElement(element()) | 71 if (!isSVGPathElement(element()) |
71 || !styleRef().svgStyle().strokeDashArray()->size()) | 72 || !styleRef().svgStyle().strokeDashArray()->size()) |
72 return 1; | 73 return 1; |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 | 295 |
295 float LayoutSVGShape::strokeWidth() const | 296 float LayoutSVGShape::strokeWidth() const |
296 { | 297 { |
297 SVGLengthContext lengthContext(element()); | 298 SVGLengthContext lengthContext(element()); |
298 return lengthContext.valueForLength(style()->svgStyle().strokeWidth()); | 299 return lengthContext.valueForLength(style()->svgStyle().strokeWidth()); |
299 } | 300 } |
300 | 301 |
301 LayoutSVGShapeRareData& LayoutSVGShape::ensureRareData() const | 302 LayoutSVGShapeRareData& LayoutSVGShape::ensureRareData() const |
302 { | 303 { |
303 if (!m_rareData) | 304 if (!m_rareData) |
304 m_rareData = adoptPtr(new LayoutSVGShapeRareData()); | 305 m_rareData = wrapUnique(new LayoutSVGShapeRareData()); |
305 return *m_rareData.get(); | 306 return *m_rareData.get(); |
306 } | 307 } |
307 | 308 |
308 } // namespace blink | 309 } // namespace blink |
OLD | NEW |