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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 m_fillBoundingBox = calculateObjectBoundingBox(); | 78 m_fillBoundingBox = calculateObjectBoundingBox(); |
79 m_strokeBoundingBox = calculateStrokeBoundingBox(); | 79 m_strokeBoundingBox = calculateStrokeBoundingBox(); |
80 if (element()) | 80 if (element()) |
81 element()->setNeedsResizeObserverUpdate(); | 81 element()->setNeedsResizeObserverUpdate(); |
82 } | 82 } |
83 | 83 |
84 FloatRect LayoutSVGShape::hitTestStrokeBoundingBox() const { | 84 FloatRect LayoutSVGShape::hitTestStrokeBoundingBox() const { |
85 if (style()->svgStyle().hasStroke()) | 85 if (style()->svgStyle().hasStroke()) |
86 return m_strokeBoundingBox; | 86 return m_strokeBoundingBox; |
87 | 87 |
88 // Implementation of http://dev.w3.org/fxtf/css-masking-1/#compute-stroke-boun
ding-box | 88 // Implementation of |
| 89 // http://dev.w3.org/fxtf/css-masking-1/#compute-stroke-bounding-box |
89 // for the <rect> / <ellipse> / <circle> case except that we ignore whether | 90 // for the <rect> / <ellipse> / <circle> case except that we ignore whether |
90 // the stroke is none. | 91 // the stroke is none. |
91 | 92 |
92 FloatRect box = m_fillBoundingBox; | 93 FloatRect box = m_fillBoundingBox; |
93 const float strokeWidth = this->strokeWidth(); | 94 const float strokeWidth = this->strokeWidth(); |
94 box.inflate(strokeWidth / 2); | 95 box.inflate(strokeWidth / 2); |
95 return box; | 96 return box; |
96 } | 97 } |
97 | 98 |
98 bool LayoutSVGShape::shapeDependentStrokeContains(const FloatPoint& point) { | 99 bool LayoutSVGShape::shapeDependentStrokeContains(const FloatPoint& point) { |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 | 208 |
208 rareData.m_cachedNonScalingStrokePath = *path; | 209 rareData.m_cachedNonScalingStrokePath = *path; |
209 rareData.m_cachedNonScalingStrokePath.transform(strokeTransform); | 210 rareData.m_cachedNonScalingStrokePath.transform(strokeTransform); |
210 rareData.m_cachedNonScalingStrokeTransform = strokeTransform; | 211 rareData.m_cachedNonScalingStrokeTransform = strokeTransform; |
211 return &rareData.m_cachedNonScalingStrokePath; | 212 return &rareData.m_cachedNonScalingStrokePath; |
212 } | 213 } |
213 | 214 |
214 AffineTransform LayoutSVGShape::nonScalingStrokeTransform() const { | 215 AffineTransform LayoutSVGShape::nonScalingStrokeTransform() const { |
215 AffineTransform t = toSVGGraphicsElement(element())->getScreenCTM( | 216 AffineTransform t = toSVGGraphicsElement(element())->getScreenCTM( |
216 SVGGraphicsElement::DisallowStyleUpdate); | 217 SVGGraphicsElement::DisallowStyleUpdate); |
217 // Width of non-scaling stroke is independent of translation, so zero it out h
ere. | 218 // Width of non-scaling stroke is independent of translation, so zero it out |
| 219 // here. |
218 t.setE(0); | 220 t.setE(0); |
219 t.setF(0); | 221 t.setF(0); |
220 return t; | 222 return t; |
221 } | 223 } |
222 | 224 |
223 void LayoutSVGShape::paint(const PaintInfo& paintInfo, | 225 void LayoutSVGShape::paint(const PaintInfo& paintInfo, |
224 const LayoutPoint&) const { | 226 const LayoutPoint&) const { |
225 SVGShapePainter(*this).paint(paintInfo); | 227 SVGShapePainter(*this).paint(paintInfo); |
226 } | 228 } |
227 | 229 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 return lengthContext.valueForLength(style()->svgStyle().strokeWidth()); | 316 return lengthContext.valueForLength(style()->svgStyle().strokeWidth()); |
315 } | 317 } |
316 | 318 |
317 LayoutSVGShapeRareData& LayoutSVGShape::ensureRareData() const { | 319 LayoutSVGShapeRareData& LayoutSVGShape::ensureRareData() const { |
318 if (!m_rareData) | 320 if (!m_rareData) |
319 m_rareData = wrapUnique(new LayoutSVGShapeRareData()); | 321 m_rareData = wrapUnique(new LayoutSVGShapeRareData()); |
320 return *m_rareData.get(); | 322 return *m_rareData.get(); |
321 } | 323 } |
322 | 324 |
323 } // namespace blink | 325 } // namespace blink |
OLD | NEW |