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