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

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

Issue 24350008: CSSGradientValue should check whether gradientLength is zero or not. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/fast/gradients/css3-repeating-radial-gradients-crash-expected.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 * 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 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 269
270 // Radial gradients may need to extend further than the endpoints, b ecause they have 270 // Radial gradients may need to extend further than the endpoints, b ecause they have
271 // to repeat out to the corners of the box. 271 // to repeat out to the corners of the box.
272 if (isRadialGradient()) { 272 if (isRadialGradient()) {
273 if (!computedGradientLength) { 273 if (!computedGradientLength) {
274 FloatSize gradientSize(gradientStart - gradientEnd); 274 FloatSize gradientSize(gradientStart - gradientEnd);
275 gradientLength = gradientSize.diagonalLength(); 275 gradientLength = gradientSize.diagonalLength();
276 } 276 }
277 277
278 if (maxLengthForRepeat > gradientLength) 278 if (maxLengthForRepeat > gradientLength)
279 maxExtent = maxLengthForRepeat / gradientLength; 279 maxExtent = gradientLength > 0 ? maxLengthForRepeat / gradie ntLength : 0;
280 } 280 }
281 281
282 size_t originalNumStops = numStops; 282 size_t originalNumStops = numStops;
283 size_t originalFirstStopIndex = 0; 283 size_t originalFirstStopIndex = 0;
284 284
285 // Work backwards from the first, adding stops until we get one befo re 0. 285 // Work backwards from the first, adding stops until we get one befo re 0.
286 float firstOffset = stops[0].offset; 286 float firstOffset = stops[0].offset;
287 if (firstOffset > 0) { 287 if (firstOffset > 0) {
288 float currOffset = firstOffset; 288 float currOffset = firstOffset;
289 size_t srcStopOrdinal = originalNumStops - 1; 289 size_t srcStopOrdinal = originalNumStops - 1;
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after
1164 equalHorizontalAndVerticalSize = compareCSSValuePtr(m_endHorizontalSize, other.m_endHorizontalSize) && compareCSSValuePtr(m_endVerticalSize, other.m_end VerticalSize); 1164 equalHorizontalAndVerticalSize = compareCSSValuePtr(m_endHorizontalSize, other.m_endHorizontalSize) && compareCSSValuePtr(m_endVerticalSize, other.m_end VerticalSize);
1165 else { 1165 else {
1166 equalShape = !other.m_shape; 1166 equalShape = !other.m_shape;
1167 equalSizingBehavior = !other.m_sizingBehavior; 1167 equalSizingBehavior = !other.m_sizingBehavior;
1168 equalHorizontalAndVerticalSize = !other.m_endHorizontalSize && !other.m_ endVerticalSize; 1168 equalHorizontalAndVerticalSize = !other.m_endHorizontalSize && !other.m_ endVerticalSize;
1169 } 1169 }
1170 return equalShape && equalSizingBehavior && equalHorizontalAndVerticalSize & & m_stops == other.m_stops; 1170 return equalShape && equalSizingBehavior && equalHorizontalAndVerticalSize & & m_stops == other.m_stops;
1171 } 1171 }
1172 1172
1173 } // namespace WebCore 1173 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/gradients/css3-repeating-radial-gradients-crash-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698