OLD | NEW |
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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 float leftDist = offset - offsetLeft; | 183 float leftDist = offset - offsetLeft; |
184 float rightDist = offsetRight - offset; | 184 float rightDist = offsetRight - offset; |
185 float totalDist = offsetRight - offsetLeft; | 185 float totalDist = offsetRight - offsetLeft; |
186 | 186 |
187 Color leftColor = stops[x - 1].color; | 187 Color leftColor = stops[x - 1].color; |
188 Color rightColor = stops[x + 1].color; | 188 Color rightColor = stops[x + 1].color; |
189 | 189 |
190 ASSERT(offsetLeft <= offset && offset <= offsetRight); | 190 ASSERT(offsetLeft <= offset && offset <= offsetRight); |
191 | 191 |
192 if (WebCoreFloatNearlyEqual(leftDist, rightDist)) { | 192 if (WebCoreFloatNearlyEqual(leftDist, rightDist)) { |
193 stops.remove(x); | 193 stops.erase(x); |
194 --indexOffset; | 194 --indexOffset; |
195 continue; | 195 continue; |
196 } | 196 } |
197 | 197 |
198 if (WebCoreFloatNearlyEqual(leftDist, .0f)) { | 198 if (WebCoreFloatNearlyEqual(leftDist, .0f)) { |
199 stops[x].color = rightColor; | 199 stops[x].color = rightColor; |
200 continue; | 200 continue; |
201 } | 201 } |
202 | 202 |
203 if (WebCoreFloatNearlyEqual(rightDist, .0f)) { | 203 if (WebCoreFloatNearlyEqual(rightDist, .0f)) { |
(...skipping 20 matching lines...) Expand all Loading... |
224 // pointRelativeOffset^(ln(0.5)/ln(hintRelativeOffset)). | 224 // pointRelativeOffset^(ln(0.5)/ln(hintRelativeOffset)). |
225 float hintRelativeOffset = leftDist / totalDist; | 225 float hintRelativeOffset = leftDist / totalDist; |
226 for (size_t y = 0; y < 9; ++y) { | 226 for (size_t y = 0; y < 9; ++y) { |
227 float pointRelativeOffset = (newStops[y].offset - offsetLeft) / totalDist; | 227 float pointRelativeOffset = (newStops[y].offset - offsetLeft) / totalDist; |
228 float weighting = | 228 float weighting = |
229 powf(pointRelativeOffset, logf(.5f) / logf(hintRelativeOffset)); | 229 powf(pointRelativeOffset, logf(.5f) / logf(hintRelativeOffset)); |
230 newStops[y].color = blend(leftColor, rightColor, weighting); | 230 newStops[y].color = blend(leftColor, rightColor, weighting); |
231 } | 231 } |
232 | 232 |
233 // Replace the color hint with the new color stops. | 233 // Replace the color hint with the new color stops. |
234 stops.remove(x); | 234 stops.erase(x); |
235 stops.insert(x, newStops, 9); | 235 stops.insert(x, newStops, 9); |
236 indexOffset += 8; | 236 indexOffset += 8; |
237 } | 237 } |
238 } | 238 } |
239 | 239 |
240 static Color resolveStopColor(const CSSValue& stopColor, | 240 static Color resolveStopColor(const CSSValue& stopColor, |
241 const LayoutObject& object) { | 241 const LayoutObject& object) { |
242 return object.document().textLinkColors().colorFromCSSValue( | 242 return object.document().textLinkColors().colorFromCSSValue( |
243 stopColor, object.resolveColor(CSSPropertyColor)); | 243 stopColor, object.resolveColor(CSSPropertyColor)); |
244 } | 244 } |
(...skipping 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1339 visitor->trace(m_firstRadius); | 1339 visitor->trace(m_firstRadius); |
1340 visitor->trace(m_secondRadius); | 1340 visitor->trace(m_secondRadius); |
1341 visitor->trace(m_shape); | 1341 visitor->trace(m_shape); |
1342 visitor->trace(m_sizingBehavior); | 1342 visitor->trace(m_sizingBehavior); |
1343 visitor->trace(m_endHorizontalSize); | 1343 visitor->trace(m_endHorizontalSize); |
1344 visitor->trace(m_endVerticalSize); | 1344 visitor->trace(m_endVerticalSize); |
1345 CSSGradientValue::traceAfterDispatch(visitor); | 1345 CSSGradientValue::traceAfterDispatch(visitor); |
1346 } | 1346 } |
1347 | 1347 |
1348 } // namespace blink | 1348 } // namespace blink |
OLD | NEW |