| OLD | NEW |
| 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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 else | 251 else |
| 252 stops[i].color = resolveStopColor(stop.m_color.get(), object); | 252 stops[i].color = resolveStopColor(stop.m_color.get(), object); |
| 253 | 253 |
| 254 if (stop.m_position) { | 254 if (stop.m_position) { |
| 255 if (stop.m_position->isPercentage()) | 255 if (stop.m_position->isPercentage()) |
| 256 stops[i].offset = stop.m_position->getFloatValue(CSSPrimitiveVal
ue::CSS_PERCENTAGE) / 100; | 256 stops[i].offset = stop.m_position->getFloatValue(CSSPrimitiveVal
ue::CSS_PERCENTAGE) / 100; |
| 257 else if (stop.m_position->isLength() || stop.m_position->isCalculate
dPercentageWithLength()) { | 257 else if (stop.m_position->isLength() || stop.m_position->isCalculate
dPercentageWithLength()) { |
| 258 if (!computedGradientLength) { | 258 if (!computedGradientLength) { |
| 259 FloatSize gradientSize(gradientStart - gradientEnd); | 259 FloatSize gradientSize(gradientStart - gradientEnd); |
| 260 gradientLength = gradientSize.diagonalLength(); | 260 gradientLength = gradientSize.diagonalLength(); |
| 261 computedGradientLength = true; |
| 261 } | 262 } |
| 262 float length; | 263 float length; |
| 263 if (stop.m_position->isLength()) | 264 if (stop.m_position->isLength()) |
| 264 length = stop.m_position->computeLength<float>(conversionDat
a); | 265 length = stop.m_position->computeLength<float>(conversionDat
a); |
| 265 else | 266 else |
| 266 length = stop.m_position->cssCalcValue()->toCalcValue(conver
sionData)->evaluate(gradientLength); | 267 length = stop.m_position->cssCalcValue()->toCalcValue(conver
sionData)->evaluate(gradientLength); |
| 267 stops[i].offset = (gradientLength > 0) ? length / gradientLength
: 0; | 268 stops[i].offset = (gradientLength > 0) ? length / gradientLength
: 0; |
| 268 } else { | 269 } else { |
| 269 ASSERT_NOT_REACHED(); | 270 ASSERT_NOT_REACHED(); |
| 270 stops[i].offset = 0; | 271 stops[i].offset = 0; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 stops.shrink(1); | 347 stops.shrink(1); |
| 347 } else { | 348 } else { |
| 348 float maxExtent = 1; | 349 float maxExtent = 1; |
| 349 | 350 |
| 350 // Radial gradients may need to extend further than the endpoints, b
ecause they have | 351 // Radial gradients may need to extend further than the endpoints, b
ecause they have |
| 351 // to repeat out to the corners of the box. | 352 // to repeat out to the corners of the box. |
| 352 if (isRadialGradientValue()) { | 353 if (isRadialGradientValue()) { |
| 353 if (!computedGradientLength) { | 354 if (!computedGradientLength) { |
| 354 FloatSize gradientSize(gradientStart - gradientEnd); | 355 FloatSize gradientSize(gradientStart - gradientEnd); |
| 355 gradientLength = gradientSize.diagonalLength(); | 356 gradientLength = gradientSize.diagonalLength(); |
| 357 computedGradientLength = true; |
| 356 } | 358 } |
| 357 | 359 |
| 358 if (maxLengthForRepeat > gradientLength) | 360 if (maxLengthForRepeat > gradientLength) |
| 359 maxExtent = gradientLength > 0 ? maxLengthForRepeat / gradie
ntLength : 0; | 361 maxExtent = gradientLength > 0 ? maxLengthForRepeat / gradie
ntLength : 0; |
| 360 } | 362 } |
| 361 | 363 |
| 362 size_t originalNumStops = numStops; | 364 size_t originalNumStops = numStops; |
| 363 size_t originalFirstStopIndex = 0; | 365 size_t originalFirstStopIndex = 0; |
| 364 | 366 |
| 365 // Work backwards from the first, adding stops until we get one befo
re 0. | 367 // Work backwards from the first, adding stops until we get one befo
re 0. |
| (...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1280 visitor->trace(m_firstRadius); | 1282 visitor->trace(m_firstRadius); |
| 1281 visitor->trace(m_secondRadius); | 1283 visitor->trace(m_secondRadius); |
| 1282 visitor->trace(m_shape); | 1284 visitor->trace(m_shape); |
| 1283 visitor->trace(m_sizingBehavior); | 1285 visitor->trace(m_sizingBehavior); |
| 1284 visitor->trace(m_endHorizontalSize); | 1286 visitor->trace(m_endHorizontalSize); |
| 1285 visitor->trace(m_endVerticalSize); | 1287 visitor->trace(m_endVerticalSize); |
| 1286 CSSGradientValue::traceAfterDispatch(visitor); | 1288 CSSGradientValue::traceAfterDispatch(visitor); |
| 1287 } | 1289 } |
| 1288 | 1290 |
| 1289 } // namespace blink | 1291 } // namespace blink |
| OLD | NEW |