OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 University of Szeged | 2 * Copyright (C) 2011 University of Szeged |
3 * Copyright (C) 2011 Renata Hodovan <reni@webkit.org> | 3 * Copyright (C) 2011 Renata Hodovan <reni@webkit.org> |
4 * All rights reserved. | 4 * All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // Before creating a new object we need to clear the cached bounding box | 47 // Before creating a new object we need to clear the cached bounding box |
48 // to avoid using garbage. | 48 // to avoid using garbage. |
49 m_fillBoundingBox = FloatRect(); | 49 m_fillBoundingBox = FloatRect(); |
50 m_innerStrokeRect = FloatRect(); | 50 m_innerStrokeRect = FloatRect(); |
51 m_outerStrokeRect = FloatRect(); | 51 m_outerStrokeRect = FloatRect(); |
52 m_usePathFallback = false; | 52 m_usePathFallback = false; |
53 SVGRectElement* rect = toSVGRectElement(element()); | 53 SVGRectElement* rect = toSVGRectElement(element()); |
54 ASSERT(rect); | 54 ASSERT(rect); |
55 | 55 |
56 SVGLengthContext lengthContext(rect); | 56 SVGLengthContext lengthContext(rect); |
57 FloatSize boundingBoxSize(rect->width()->currentValue()->value(lengthContext
), rect->height()->currentValue()->value(lengthContext)); | 57 FloatSize boundingBoxSize( |
| 58 lengthContext.valueForLength(styleRef().width(), styleRef(), SVGLengthMo
de::Width), |
| 59 lengthContext.valueForLength(styleRef().height(), styleRef(), SVGLengthM
ode::Height)); |
58 | 60 |
59 // Spec: "A negative value is an error." | 61 // Spec: "A negative value is an error." |
60 if (boundingBoxSize.width() < 0 || boundingBoxSize.height() < 0) | 62 if (boundingBoxSize.width() < 0 || boundingBoxSize.height() < 0) |
61 return; | 63 return; |
62 | 64 |
63 // Spec: "A value of zero disables rendering of the element." | 65 // Spec: "A value of zero disables rendering of the element." |
64 if (!boundingBoxSize.isEmpty()) { | 66 if (!boundingBoxSize.isEmpty()) { |
65 // Fallback to LayoutSVGShape and path-based hit detection if the rect | 67 // Fallback to LayoutSVGShape and path-based hit detection if the rect |
66 // has rounded corners or a non-scaling or non-simple stroke. | 68 // has rounded corners or a non-scaling or non-simple stroke. |
67 if (lengthContext.valueForLength(style()->svgStyle().rx(), styleRef(), S
VGLengthMode::Width) > 0 | 69 if (lengthContext.valueForLength(styleRef().svgStyle().rx(), styleRef(),
SVGLengthMode::Width) > 0 |
68 || lengthContext.valueForLength(style()->svgStyle().ry(), styleRef()
, SVGLengthMode::Height) > 0 | 70 || lengthContext.valueForLength(styleRef().svgStyle().ry(), styleRef
(), SVGLengthMode::Height) > 0 |
69 || hasNonScalingStroke() | 71 || hasNonScalingStroke() |
70 || !definitelyHasSimpleStroke()) { | 72 || !definitelyHasSimpleStroke()) { |
71 LayoutSVGShape::updateShapeFromElement(); | 73 LayoutSVGShape::updateShapeFromElement(); |
72 m_usePathFallback = true; | 74 m_usePathFallback = true; |
73 return; | 75 return; |
74 } | 76 } |
75 } | 77 } |
76 | 78 |
77 m_fillBoundingBox = FloatRect( | 79 m_fillBoundingBox = FloatRect( |
78 FloatPoint( | 80 FloatPoint( |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 // An approximation of sqrt(2) is used here because at certain precise | 136 // An approximation of sqrt(2) is used here because at certain precise |
135 // miterlimits, the join style used might not be correct (e.g. a miterlimit | 137 // miterlimits, the join style used might not be correct (e.g. a miterlimit |
136 // of 1.4142135 should result in bevel joins, but may be drawn using miter | 138 // of 1.4142135 should result in bevel joins, but may be drawn using miter |
137 // joins). | 139 // joins). |
138 return svgStyle.strokeDashArray()->isEmpty() | 140 return svgStyle.strokeDashArray()->isEmpty() |
139 && svgStyle.joinStyle() == MiterJoin | 141 && svgStyle.joinStyle() == MiterJoin |
140 && svgStyle.strokeMiterLimit() >= 1.5; | 142 && svgStyle.strokeMiterLimit() >= 1.5; |
141 } | 143 } |
142 | 144 |
143 } | 145 } |
OLD | NEW |