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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 bool LayoutSVGRect::shapeDependentFillContains(const FloatPoint& point, const Wi
ndRule fillRule) const | 112 bool LayoutSVGRect::shapeDependentFillContains(const FloatPoint& point, const Wi
ndRule fillRule) const |
113 { | 113 { |
114 if (m_usePathFallback) | 114 if (m_usePathFallback) |
115 return LayoutSVGShape::shapeDependentFillContains(point, fillRule); | 115 return LayoutSVGShape::shapeDependentFillContains(point, fillRule); |
116 return m_fillBoundingBox.contains(point.x(), point.y()); | 116 return m_fillBoundingBox.contains(point.x(), point.y()); |
117 } | 117 } |
118 | 118 |
119 // Returns true if the stroke is continuous and definitely uses miter joins. | 119 // Returns true if the stroke is continuous and definitely uses miter joins. |
120 bool LayoutSVGRect::definitelyHasSimpleStroke() const | 120 bool LayoutSVGRect::definitelyHasSimpleStroke() const |
121 { | 121 { |
122 const SVGLayoutStyle& svgStyle = style()->svgStyle(); | 122 const SVGComputedStyle& svgStyle = style()->svgStyle(); |
123 | 123 |
124 // The four angles of a rect are 90 degrees. Using the formula at: | 124 // The four angles of a rect are 90 degrees. Using the formula at: |
125 // http://www.w3.org/TR/SVG/painting.html#StrokeMiterlimitProperty | 125 // http://www.w3.org/TR/SVG/painting.html#StrokeMiterlimitProperty |
126 // when the join style of the rect is "miter", the ratio of the miterLength | 126 // when the join style of the rect is "miter", the ratio of the miterLength |
127 // to the stroke-width is found to be | 127 // to the stroke-width is found to be |
128 // miterLength / stroke-width = 1 / sin(45 degrees) | 128 // miterLength / stroke-width = 1 / sin(45 degrees) |
129 // = 1 / (1 / sqrt(2)) | 129 // = 1 / (1 / sqrt(2)) |
130 // = sqrt(2) | 130 // = sqrt(2) |
131 // = 1.414213562373095... | 131 // = 1.414213562373095... |
132 // When sqrt(2) exceeds the miterlimit, then the join style switches to | 132 // When sqrt(2) exceeds the miterlimit, then the join style switches to |
133 // "bevel". When the miterlimit is greater than or equal to sqrt(2) then | 133 // "bevel". When the miterlimit is greater than or equal to sqrt(2) then |
134 // the join style remains "miter". | 134 // the join style remains "miter". |
135 // | 135 // |
136 // 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 |
137 // 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 |
138 // 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 |
139 // joins). | 139 // joins). |
140 return svgStyle.strokeDashArray()->isEmpty() | 140 return svgStyle.strokeDashArray()->isEmpty() |
141 && svgStyle.joinStyle() == MiterJoin | 141 && svgStyle.joinStyle() == MiterJoin |
142 && svgStyle.strokeMiterLimit() >= 1.5; | 142 && svgStyle.strokeMiterLimit() >= 1.5; |
143 } | 143 } |
144 | 144 |
145 } | 145 } |
OLD | NEW |