| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. | 2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above | 8 * 1. Redistributions of source code must retain the above |
| 9 * copyright notice, this list of conditions and the following | 9 * copyright notice, this list of conditions and the following |
| 10 * disclaimer. | 10 * disclaimer. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 * OF THE POSSIBILITY OF SUCH DAMAGE. | 27 * OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 */ | 28 */ |
| 29 | 29 |
| 30 #include "core/layout/shapes/RectangleShape.h" | 30 #include "core/layout/shapes/RectangleShape.h" |
| 31 | 31 |
| 32 #include "wtf/MathExtras.h" | 32 #include "wtf/MathExtras.h" |
| 33 | 33 |
| 34 namespace blink { | 34 namespace blink { |
| 35 | 35 |
| 36 static inline float ellipseXIntercept(float y, float rx, float ry) { | 36 static inline float ellipseXIntercept(float y, float rx, float ry) { |
| 37 ASSERT(ry > 0); | 37 DCHECK_GT(ry, 0); |
| 38 return rx * sqrt(1 - (y * y) / (ry * ry)); | 38 return rx * sqrt(1 - (y * y) / (ry * ry)); |
| 39 } | 39 } |
| 40 | 40 |
| 41 FloatRect RectangleShape::shapeMarginBounds() const { | 41 FloatRect RectangleShape::shapeMarginBounds() const { |
| 42 ASSERT(shapeMargin() >= 0); | 42 DCHECK_GE(shapeMargin(), 0); |
| 43 if (!shapeMargin()) | 43 if (!shapeMargin()) |
| 44 return m_bounds; | 44 return m_bounds; |
| 45 | 45 |
| 46 float boundsX = x() - shapeMargin(); | 46 float boundsX = x() - shapeMargin(); |
| 47 float boundsY = y() - shapeMargin(); | 47 float boundsY = y() - shapeMargin(); |
| 48 float boundsWidth = width() + shapeMargin() * 2; | 48 float boundsWidth = width() + shapeMargin() * 2; |
| 49 float boundsHeight = height() + shapeMargin() * 2; | 49 float boundsHeight = height() + shapeMargin() * 2; |
| 50 return FloatRect(boundsX, boundsY, boundsWidth, boundsHeight); | 50 return FloatRect(boundsX, boundsY, boundsWidth, boundsHeight); |
| 51 } | 51 } |
| 52 | 52 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 88 |
| 89 void RectangleShape::buildDisplayPaths(DisplayPaths& paths) const { | 89 void RectangleShape::buildDisplayPaths(DisplayPaths& paths) const { |
| 90 paths.shape.addRoundedRect(m_bounds, m_radii); | 90 paths.shape.addRoundedRect(m_bounds, m_radii); |
| 91 if (shapeMargin()) | 91 if (shapeMargin()) |
| 92 paths.marginShape.addRoundedRect( | 92 paths.marginShape.addRoundedRect( |
| 93 shapeMarginBounds(), FloatSize(m_radii.width() + shapeMargin(), | 93 shapeMarginBounds(), FloatSize(m_radii.width() + shapeMargin(), |
| 94 m_radii.height() + shapeMargin())); | 94 m_radii.height() + shapeMargin())); |
| 95 } | 95 } |
| 96 | 96 |
| 97 } // namespace blink | 97 } // namespace blink |
| OLD | NEW |