| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 | 150 |
| 151 float offset; | 151 float offset; |
| 152 if (stop.m_position->isPercentage()) | 152 if (stop.m_position->isPercentage()) |
| 153 offset = stop.m_position->getFloatValue(CSSPrimitiveValue::CSS_P
ERCENTAGE) / 100; | 153 offset = stop.m_position->getFloatValue(CSSPrimitiveValue::CSS_P
ERCENTAGE) / 100; |
| 154 else | 154 else |
| 155 offset = stop.m_position->getFloatValue(CSSPrimitiveValue::CSS_N
UMBER); | 155 offset = stop.m_position->getFloatValue(CSSPrimitiveValue::CSS_N
UMBER); |
| 156 | 156 |
| 157 gradient->addColorStop(offset, stop.m_resolvedColor); | 157 gradient->addColorStop(offset, stop.m_resolvedColor); |
| 158 } | 158 } |
| 159 | 159 |
| 160 // The back end already sorted the stops. | |
| 161 gradient->setStopsSorted(true); | |
| 162 return; | 160 return; |
| 163 } | 161 } |
| 164 | 162 |
| 165 size_t numStops = m_stops.size(); | 163 size_t numStops = m_stops.size(); |
| 166 | 164 |
| 167 Vector<GradientStop> stops(numStops); | 165 Vector<GradientStop> stops(numStops); |
| 168 | 166 |
| 169 float gradientLength = 0; | 167 float gradientLength = 0; |
| 170 bool computedGradientLength = false; | 168 bool computedGradientLength = false; |
| 171 | 169 |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 for (size_t i = 0; i < numStops; ++i) | 380 for (size_t i = 0; i < numStops; ++i) |
| 383 stops[i].offset /= scale; | 381 stops[i].offset /= scale; |
| 384 | 382 |
| 385 gradient->setStartRadius(gradient->startRadius() * scale); | 383 gradient->setStartRadius(gradient->startRadius() * scale); |
| 386 gradient->setEndRadius(gradient->endRadius() * scale); | 384 gradient->setEndRadius(gradient->endRadius() * scale); |
| 387 } | 385 } |
| 388 } | 386 } |
| 389 | 387 |
| 390 for (unsigned i = 0; i < numStops; i++) | 388 for (unsigned i = 0; i < numStops; i++) |
| 391 gradient->addColorStop(stops[i].offset, stops[i].color); | 389 gradient->addColorStop(stops[i].offset, stops[i].color); |
| 392 | |
| 393 gradient->setStopsSorted(true); | |
| 394 } | 390 } |
| 395 | 391 |
| 396 static float positionFromValue(CSSPrimitiveValue* value, const CSSToLengthConver
sionData& conversionData, const IntSize& size, bool isHorizontal) | 392 static float positionFromValue(CSSPrimitiveValue* value, const CSSToLengthConver
sionData& conversionData, const IntSize& size, bool isHorizontal) |
| 397 { | 393 { |
| 398 if (value->isNumber()) | 394 if (value->isNumber()) |
| 399 return value->getFloatValue() * conversionData.zoom(); | 395 return value->getFloatValue() * conversionData.zoom(); |
| 400 | 396 |
| 401 int edgeDistance = isHorizontal ? size.width() : size.height(); | 397 int edgeDistance = isHorizontal ? size.width() : size.height(); |
| 402 if (value->isPercentage()) | 398 if (value->isPercentage()) |
| 403 return value->getFloatValue() / 100.f * edgeDistance; | 399 return value->getFloatValue() / 100.f * edgeDistance; |
| (...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1187 visitor->trace(m_firstRadius); | 1183 visitor->trace(m_firstRadius); |
| 1188 visitor->trace(m_secondRadius); | 1184 visitor->trace(m_secondRadius); |
| 1189 visitor->trace(m_shape); | 1185 visitor->trace(m_shape); |
| 1190 visitor->trace(m_sizingBehavior); | 1186 visitor->trace(m_sizingBehavior); |
| 1191 visitor->trace(m_endHorizontalSize); | 1187 visitor->trace(m_endHorizontalSize); |
| 1192 visitor->trace(m_endVerticalSize); | 1188 visitor->trace(m_endVerticalSize); |
| 1193 CSSGradientValue::traceAfterDispatch(visitor); | 1189 CSSGradientValue::traceAfterDispatch(visitor); |
| 1194 } | 1190 } |
| 1195 | 1191 |
| 1196 } // namespace WebCore | 1192 } // namespace WebCore |
| OLD | NEW |