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

Side by Side Diff: third_party/WebKit/Source/core/css/CSSGradientValue.cpp

Issue 2259453003: Fixed DCHECK crash for radial gradients with very large values (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplified 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2015 Google Inc. All rights reserved. 3 * Copyright (C) 2015 Google Inc. 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 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 secondRadius = radiusToCorner(secondPoint, floatSize, shape, 1152 secondRadius = radiusToCorner(secondPoint, floatSize, shape,
1153 [] (float a, float b) { return a < b; }); 1153 [] (float a, float b) { return a < b; });
1154 break; 1154 break;
1155 default: 1155 default:
1156 secondRadius = radiusToCorner(secondPoint, floatSize, shape, 1156 secondRadius = radiusToCorner(secondPoint, floatSize, shape,
1157 [] (float a, float b) { return a > b; }); 1157 [] (float a, float b) { return a > b; });
1158 break; 1158 break;
1159 } 1159 }
1160 } 1160 }
1161 1161
1162 if (std::isinf(firstRadius))
1163 firstRadius = std::numeric_limits<float>::max();
1162 DCHECK(std::isfinite(firstRadius)); 1164 DCHECK(std::isfinite(firstRadius));
1165
1166 if (std::isinf(secondRadius.width()))
1167 secondRadius.setWidth(std::numeric_limits<float>::max());
1163 DCHECK(std::isfinite(secondRadius.width())); 1168 DCHECK(std::isfinite(secondRadius.width()));
1169
1170 if (std::isinf(secondRadius.height()))
1171 secondRadius.setHeight(std::numeric_limits<float>::max());
Bugs Nash 2016/08/18 05:53:21 Would it be better to put an infinity adjustment i
sashab 2016/08/18 06:41:34 Oh wow, because of you saying that I changed this
1164 DCHECK(std::isfinite(secondRadius.height())); 1172 DCHECK(std::isfinite(secondRadius.height()));
1165 1173
1166 bool isDegenerate = !secondRadius.width() || !secondRadius.height(); 1174 bool isDegenerate = !secondRadius.width() || !secondRadius.height();
1167 RefPtr<Gradient> gradient = Gradient::create(firstPoint, firstRadius, second Point, 1175 RefPtr<Gradient> gradient = Gradient::create(firstPoint, firstRadius, second Point,
1168 isDegenerate ? 0 : secondRadius.width(), isDegenerate ? 1 : secondRadius .aspectRatio()); 1176 isDegenerate ? 0 : secondRadius.width(), isDegenerate ? 1 : secondRadius .aspectRatio());
1169 1177
1170 gradient->setSpreadMethod(m_repeating ? SpreadMethodRepeat : SpreadMethodPad ); 1178 gradient->setSpreadMethod(m_repeating ? SpreadMethodRepeat : SpreadMethodPad );
1171 gradient->setDrawsInPMColorSpace(true); 1179 gradient->setDrawsInPMColorSpace(true);
1172 1180
1173 // Now add the stops. 1181 // Now add the stops.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1227 visitor->trace(m_firstRadius); 1235 visitor->trace(m_firstRadius);
1228 visitor->trace(m_secondRadius); 1236 visitor->trace(m_secondRadius);
1229 visitor->trace(m_shape); 1237 visitor->trace(m_shape);
1230 visitor->trace(m_sizingBehavior); 1238 visitor->trace(m_sizingBehavior);
1231 visitor->trace(m_endHorizontalSize); 1239 visitor->trace(m_endHorizontalSize);
1232 visitor->trace(m_endVerticalSize); 1240 visitor->trace(m_endVerticalSize);
1233 CSSGradientValue::traceAfterDispatch(visitor); 1241 CSSGradientValue::traceAfterDispatch(visitor);
1234 } 1242 }
1235 1243
1236 } // namespace blink 1244 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698