| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 boundingBoxSize); | 81 boundingBoxSize); |
| 82 m_strokeBoundingBox = m_fillBoundingBox; | 82 m_strokeBoundingBox = m_fillBoundingBox; |
| 83 if (style()->svgStyle().hasStroke()) | 83 if (style()->svgStyle().hasStroke()) |
| 84 m_strokeBoundingBox.inflate(strokeWidth() / 2); | 84 m_strokeBoundingBox.inflate(strokeWidth() / 2); |
| 85 if (element()) | 85 if (element()) |
| 86 element()->setNeedsResizeObserverUpdate(); | 86 element()->setNeedsResizeObserverUpdate(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 bool LayoutSVGRect::shapeDependentStrokeContains(const FloatPoint& point) { | 89 bool LayoutSVGRect::shapeDependentStrokeContains(const FloatPoint& point) { |
| 90 // The optimized code below does not support non-simple strokes so we need | 90 // The optimized code below does not support non-simple strokes so we need |
| 91 // to fall back to LayoutSVGShape::shapeDependentStrokeContains in these cases
. | 91 // to fall back to LayoutSVGShape::shapeDependentStrokeContains in these |
| 92 // cases. |
| 92 if (m_usePathFallback || !definitelyHasSimpleStroke()) { | 93 if (m_usePathFallback || !definitelyHasSimpleStroke()) { |
| 93 if (!hasPath()) | 94 if (!hasPath()) |
| 94 LayoutSVGShape::updateShapeFromElement(); | 95 LayoutSVGShape::updateShapeFromElement(); |
| 95 return LayoutSVGShape::shapeDependentStrokeContains(point); | 96 return LayoutSVGShape::shapeDependentStrokeContains(point); |
| 96 } | 97 } |
| 97 | 98 |
| 98 const float halfStrokeWidth = strokeWidth() / 2; | 99 const float halfStrokeWidth = strokeWidth() / 2; |
| 99 const float halfWidth = m_fillBoundingBox.width() / 2; | 100 const float halfWidth = m_fillBoundingBox.width() / 2; |
| 100 const float halfHeight = m_fillBoundingBox.height() / 2; | 101 const float halfHeight = m_fillBoundingBox.height() / 2; |
| 101 | 102 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 // An approximation of sqrt(2) is used here because at certain precise | 139 // An approximation of sqrt(2) is used here because at certain precise |
| 139 // miterlimits, the join style used might not be correct (e.g. a miterlimit | 140 // miterlimits, the join style used might not be correct (e.g. a miterlimit |
| 140 // of 1.4142135 should result in bevel joins, but may be drawn using miter | 141 // of 1.4142135 should result in bevel joins, but may be drawn using miter |
| 141 // joins). | 142 // joins). |
| 142 return svgStyle.strokeDashArray()->isEmpty() && | 143 return svgStyle.strokeDashArray()->isEmpty() && |
| 143 svgStyle.joinStyle() == MiterJoin && | 144 svgStyle.joinStyle() == MiterJoin && |
| 144 svgStyle.strokeMiterLimit() >= 1.5; | 145 svgStyle.strokeMiterLimit() >= 1.5; |
| 145 } | 146 } |
| 146 | 147 |
| 147 } // namespace blink | 148 } // namespace blink |
| OLD | NEW |