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

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: Rebased... forgot about this patch Created 4 years, 3 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/gradients/css3-radial-gradients-inf-radius-crash.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 995 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 1006
1007 } 1007 }
1008 1008
1009 result.append(')'); 1009 result.append(')');
1010 return result.toString(); 1010 return result.toString();
1011 } 1011 }
1012 1012
1013 float CSSRadialGradientValue::resolveRadius(CSSPrimitiveValue* radius, const CSS ToLengthConversionData& conversionData, float* widthOrHeight) 1013 float CSSRadialGradientValue::resolveRadius(CSSPrimitiveValue* radius, const CSS ToLengthConversionData& conversionData, float* widthOrHeight)
1014 { 1014 {
1015 float result = 0; 1015 float result = 0;
1016 if (radius->isNumber()) // Can the radius be a percentage? 1016 if (radius->isNumber())
1017 result = radius->getFloatValue() * conversionData.zoom(); 1017 result = radius->getFloatValue() * conversionData.zoom();
1018 else if (widthOrHeight && radius->isPercentage()) 1018 else if (widthOrHeight && radius->isPercentage())
1019 result = *widthOrHeight * radius->getFloatValue() / 100; 1019 result = *widthOrHeight * radius->getFloatValue() / 100;
1020 else 1020 else
1021 result = radius->computeLength<float>(conversionData); 1021 result = radius->computeLength<float>(conversionData);
1022 1022
1023 return std::max(result, 0.0f); 1023 return clampTo<float>(std::max(result, 0.0f));
1024 } 1024 }
1025 1025
1026 namespace { 1026 namespace {
1027 1027
1028 enum EndShapeType { 1028 enum EndShapeType {
1029 CircleEndShape, 1029 CircleEndShape,
1030 EllipseEndShape 1030 EllipseEndShape
1031 }; 1031 };
1032 1032
1033 // Compute the radius to the closest/farthest side (depending on the compare fun ctor). 1033 // Compute the radius to the closest/farthest side (depending on the compare fun ctor).
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1227 visitor->trace(m_firstRadius); 1227 visitor->trace(m_firstRadius);
1228 visitor->trace(m_secondRadius); 1228 visitor->trace(m_secondRadius);
1229 visitor->trace(m_shape); 1229 visitor->trace(m_shape);
1230 visitor->trace(m_sizingBehavior); 1230 visitor->trace(m_sizingBehavior);
1231 visitor->trace(m_endHorizontalSize); 1231 visitor->trace(m_endHorizontalSize);
1232 visitor->trace(m_endVerticalSize); 1232 visitor->trace(m_endVerticalSize);
1233 CSSGradientValue::traceAfterDispatch(visitor); 1233 CSSGradientValue::traceAfterDispatch(visitor);
1234 } 1234 }
1235 1235
1236 } // namespace blink 1236 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/gradients/css3-radial-gradients-inf-radius-crash.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698