Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Unified Diff: third_party/WebKit/Source/core/css/CSSGradientValue.cpp

Issue 2221793004: Fixed crash with zero/infinite aspect ratio radial gradients (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added layout test Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/gradients/css3-radial-gradients-zero-radius-crash.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/CSSGradientValue.cpp
diff --git a/third_party/WebKit/Source/core/css/CSSGradientValue.cpp b/third_party/WebKit/Source/core/css/CSSGradientValue.cpp
index 462ce6bd931298b3d642ada4f9ac88befcc57d7f..098778139fd5821e766fb34032e65386750974c8 100644
--- a/third_party/WebKit/Source/core/css/CSSGradientValue.cpp
+++ b/third_party/WebKit/Source/core/css/CSSGradientValue.cpp
@@ -1053,6 +1053,11 @@ FloatSize radiusToSide(const FloatPoint& point, const FloatSize& size, EndShapeT
// width/height given by aspectRatio.
inline FloatSize ellipseRadius(const FloatPoint& p, float aspectRatio)
{
+ // If the aspectRatio is 0 or infinite, the ellipse is completely flat.
+ // TODO(sashab): Implement Degenerate Radial Gradients, see crbug.com/635727.
+ if (aspectRatio == 0 || std::isinf(aspectRatio))
+ return FloatSize(0, 0);
+
// x^2/a^2 + y^2/b^2 = 1
// a/b = aspectRatio, b = a/aspectRatio
// a = sqrt(x^2 + y^2/(1/r^2))
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/gradients/css3-radial-gradients-zero-radius-crash.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698