OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google, Inc. | 2 * Copyright (C) 2012 Google, Inc. |
3 * All rights reserved. | 3 * All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 30 matching lines...) Expand all Loading... |
41 // Before creating a new object we need to clear the cached bounding box | 41 // Before creating a new object we need to clear the cached bounding box |
42 // to avoid using garbage. | 42 // to avoid using garbage. |
43 m_fillBoundingBox = FloatRect(); | 43 m_fillBoundingBox = FloatRect(); |
44 m_strokeBoundingBox = FloatRect(); | 44 m_strokeBoundingBox = FloatRect(); |
45 m_center = FloatPoint(); | 45 m_center = FloatPoint(); |
46 m_radii = FloatSize(); | 46 m_radii = FloatSize(); |
47 m_usePathFallback = false; | 47 m_usePathFallback = false; |
48 | 48 |
49 calculateRadiiAndCenter(); | 49 calculateRadiiAndCenter(); |
50 | 50 |
51 // Spec: "A negative value is an error. A value of zero disables rendering of
the element." | 51 // Spec: "A negative value is an error. A value of zero disables rendering of |
| 52 // the element." |
52 if (m_radii.width() < 0 || m_radii.height() < 0) | 53 if (m_radii.width() < 0 || m_radii.height() < 0) |
53 return; | 54 return; |
54 | 55 |
55 if (!m_radii.isEmpty()) { | 56 if (!m_radii.isEmpty()) { |
56 // Fall back to LayoutSVGShape and path-based hit detection if the ellipse | 57 // Fall back to LayoutSVGShape and path-based hit detection if the ellipse |
57 // has a non-scaling or discontinuous stroke. | 58 // has a non-scaling or discontinuous stroke. |
58 if (hasNonScalingStroke() || !hasContinuousStroke()) { | 59 if (hasNonScalingStroke() || !hasContinuousStroke()) { |
59 LayoutSVGShape::updateShapeFromElement(); | 60 LayoutSVGShape::updateShapeFromElement(); |
60 m_usePathFallback = true; | 61 m_usePathFallback = true; |
61 return; | 62 return; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 const float yrY = center.y() / m_radii.height(); | 126 const float yrY = center.y() / m_radii.height(); |
126 return xrX * xrX + yrY * yrY <= 1.0; | 127 return xrX * xrX + yrY * yrY <= 1.0; |
127 } | 128 } |
128 | 129 |
129 bool LayoutSVGEllipse::hasContinuousStroke() const { | 130 bool LayoutSVGEllipse::hasContinuousStroke() const { |
130 const SVGComputedStyle& svgStyle = style()->svgStyle(); | 131 const SVGComputedStyle& svgStyle = style()->svgStyle(); |
131 return svgStyle.strokeDashArray()->isEmpty(); | 132 return svgStyle.strokeDashArray()->isEmpty(); |
132 } | 133 } |
133 | 134 |
134 } // namespace blink | 135 } // namespace blink |
OLD | NEW |