| 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 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 default: | 903 default: |
| 904 ASSERT_NOT_REACHED(); | 904 ASSERT_NOT_REACHED(); |
| 905 } | 905 } |
| 906 } | 906 } |
| 907 | 907 |
| 908 GradientDesc desc(firstPoint, secondPoint, | 908 GradientDesc desc(firstPoint, secondPoint, |
| 909 m_repeating ? SpreadMethodRepeat : SpreadMethodPad); | 909 m_repeating ? SpreadMethodRepeat : SpreadMethodPad); |
| 910 addStops(desc, conversionData, object); | 910 addStops(desc, conversionData, object); |
| 911 | 911 |
| 912 RefPtr<Gradient> gradient = | 912 RefPtr<Gradient> gradient = |
| 913 Gradient::create(desc.p0, desc.p1, desc.spreadMethod, | 913 Gradient::createLinear(desc.p0, desc.p1, desc.spreadMethod, |
| 914 Gradient::ColorInterpolation::Premultiplied); | 914 Gradient::ColorInterpolation::Premultiplied); |
| 915 | 915 |
| 916 // Now add the stops. | 916 // Now add the stops. |
| 917 gradient->addColorStops(desc.stops); | 917 gradient->addColorStops(desc.stops); |
| 918 | 918 |
| 919 return gradient.release(); | 919 return gradient.release(); |
| 920 } | 920 } |
| 921 | 921 |
| 922 bool CSSLinearGradientValue::equals(const CSSLinearGradientValue& other) const { | 922 bool CSSLinearGradientValue::equals(const CSSLinearGradientValue& other) const { |
| 923 if (m_gradientType == CSSDeprecatedLinearGradient) | 923 if (m_gradientType == CSSDeprecatedLinearGradient) |
| 924 return other.m_gradientType == m_gradientType && | 924 return other.m_gradientType == m_gradientType && |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1259 DCHECK(std::isfinite(firstRadius)); | 1259 DCHECK(std::isfinite(firstRadius)); |
| 1260 DCHECK(std::isfinite(secondRadius.width())); | 1260 DCHECK(std::isfinite(secondRadius.width())); |
| 1261 DCHECK(std::isfinite(secondRadius.height())); | 1261 DCHECK(std::isfinite(secondRadius.height())); |
| 1262 | 1262 |
| 1263 bool isDegenerate = !secondRadius.width() || !secondRadius.height(); | 1263 bool isDegenerate = !secondRadius.width() || !secondRadius.height(); |
| 1264 GradientDesc desc(firstPoint, secondPoint, firstRadius, | 1264 GradientDesc desc(firstPoint, secondPoint, firstRadius, |
| 1265 isDegenerate ? 0 : secondRadius.width(), | 1265 isDegenerate ? 0 : secondRadius.width(), |
| 1266 m_repeating ? SpreadMethodRepeat : SpreadMethodPad); | 1266 m_repeating ? SpreadMethodRepeat : SpreadMethodPad); |
| 1267 addStops(desc, conversionData, object); | 1267 addStops(desc, conversionData, object); |
| 1268 | 1268 |
| 1269 RefPtr<Gradient> gradient = Gradient::create( | 1269 RefPtr<Gradient> gradient = Gradient::createRadial( |
| 1270 desc.p0, desc.r0, desc.p1, desc.r1, | 1270 desc.p0, desc.r0, desc.p1, desc.r1, |
| 1271 isDegenerate ? 1 : secondRadius.aspectRatio(), desc.spreadMethod, | 1271 isDegenerate ? 1 : secondRadius.aspectRatio(), desc.spreadMethod, |
| 1272 Gradient::ColorInterpolation::Premultiplied); | 1272 Gradient::ColorInterpolation::Premultiplied); |
| 1273 | 1273 |
| 1274 // Now add the stops. | 1274 // Now add the stops. |
| 1275 gradient->addColorStops(desc.stops); | 1275 gradient->addColorStops(desc.stops); |
| 1276 | 1276 |
| 1277 return gradient.release(); | 1277 return gradient.release(); |
| 1278 } | 1278 } |
| 1279 | 1279 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1362 return result.toString(); | 1362 return result.toString(); |
| 1363 } | 1363 } |
| 1364 | 1364 |
| 1365 PassRefPtr<Gradient> CSSConicGradientValue::createGradient( | 1365 PassRefPtr<Gradient> CSSConicGradientValue::createGradient( |
| 1366 const CSSToLengthConversionData& conversionData, | 1366 const CSSToLengthConversionData& conversionData, |
| 1367 const IntSize& size, | 1367 const IntSize& size, |
| 1368 const LayoutObject& object) { | 1368 const LayoutObject& object) { |
| 1369 DCHECK(!size.isEmpty()); | 1369 DCHECK(!size.isEmpty()); |
| 1370 | 1370 |
| 1371 // TODO(fmalita): implement | 1371 // TODO(fmalita): implement |
| 1372 return Gradient::create(FloatPoint(), FloatPoint()); | 1372 return Gradient::createLinear(FloatPoint(), FloatPoint()); |
| 1373 } | 1373 } |
| 1374 | 1374 |
| 1375 bool CSSConicGradientValue::equals(const CSSConicGradientValue& other) const { | 1375 bool CSSConicGradientValue::equals(const CSSConicGradientValue& other) const { |
| 1376 return m_repeating == other.m_repeating && | 1376 return m_repeating == other.m_repeating && |
| 1377 dataEquivalent(m_firstX, other.m_firstX) && | 1377 dataEquivalent(m_firstX, other.m_firstX) && |
| 1378 dataEquivalent(m_firstY, other.m_firstY) && | 1378 dataEquivalent(m_firstY, other.m_firstY) && |
| 1379 dataEquivalent(m_fromAngle, other.m_fromAngle) && | 1379 dataEquivalent(m_fromAngle, other.m_fromAngle) && |
| 1380 m_stops == other.m_stops; | 1380 m_stops == other.m_stops; |
| 1381 } | 1381 } |
| 1382 | 1382 |
| 1383 DEFINE_TRACE_AFTER_DISPATCH(CSSConicGradientValue) { | 1383 DEFINE_TRACE_AFTER_DISPATCH(CSSConicGradientValue) { |
| 1384 visitor->trace(m_fromAngle); | 1384 visitor->trace(m_fromAngle); |
| 1385 CSSGradientValue::traceAfterDispatch(visitor); | 1385 CSSGradientValue::traceAfterDispatch(visitor); |
| 1386 } | 1386 } |
| 1387 | 1387 |
| 1388 } // namespace blink | 1388 } // namespace blink |
| OLD | NEW |