| Index: third_party/WebKit/Source/core/css/CSSGradientValue.cpp
|
| diff --git a/third_party/WebKit/Source/core/css/CSSGradientValue.cpp b/third_party/WebKit/Source/core/css/CSSGradientValue.cpp
|
| index 32f7a3546eb6ebf8412f6d717dd472c7fe6b8e2c..1b0e22dae9e3c47a657e04097b91d5c75dfbc28a 100644
|
| --- a/third_party/WebKit/Source/core/css/CSSGradientValue.cpp
|
| +++ b/third_party/WebKit/Source/core/css/CSSGradientValue.cpp
|
| @@ -72,10 +72,20 @@ PassRefPtr<Image> CSSGradientValue::image(const LayoutObject& layoutObject, cons
|
|
|
| const ComputedStyle* rootStyle = layoutObject.document().documentElement()->computedStyle();
|
| CSSToLengthConversionData conversionData(layoutObject.style(), rootStyle, layoutObject.view(), layoutObject.style()->effectiveZoom());
|
| - if (isLinearGradientValue())
|
| +
|
| + switch (getClassType()) {
|
| + case LinearGradientClass:
|
| gradient = toCSSLinearGradientValue(this)->createGradient(conversionData, size, layoutObject);
|
| - else
|
| + break;
|
| + case RadialGradientClass:
|
| gradient = toCSSRadialGradientValue(this)->createGradient(conversionData, size, layoutObject);
|
| + break;
|
| + case ConicGradientClass:
|
| + gradient = toCSSConicGradientValue(this)->createGradient(conversionData, size, layoutObject);
|
| + break;
|
| + default:
|
| + ASSERT_NOT_REACHED();
|
| + }
|
|
|
| RefPtr<Image> newImage = GradientGeneratedImage::create(gradient, size);
|
| if (cacheable)
|
| @@ -461,7 +471,7 @@ void CSSGradientValue::addStops(Gradient* gradient, const CSSToLengthConversionD
|
| // Negative offsets are only an issue for non-repeating radial gradients: linear gradient
|
| // points can be repositioned arbitrarily, and for repeating radial gradients we shift
|
| // the radii into equivalent positive values.
|
| - if (isRadialGradientValue() && !m_repeating)
|
| + if ((isRadialGradientValue() && !m_repeating) || isConicGradientValue())
|
| clampNegativeOffsets(stops);
|
|
|
| if (normalizeAndAddStops(stops, gradient)) {
|
| @@ -1222,4 +1232,43 @@ DEFINE_TRACE_AFTER_DISPATCH(CSSRadialGradientValue)
|
| CSSGradientValue::traceAfterDispatch(visitor);
|
| }
|
|
|
| +String CSSConicGradientValue::customCSSText() const
|
| +{
|
| + StringBuilder result;
|
| +
|
| + return result.toString();
|
| +}
|
| +
|
| +PassRefPtr<Gradient> CSSConicGradientValue::createGradient(const CSSToLengthConversionData& conversionData, const IntSize& size, const LayoutObject& object)
|
| +{
|
| + ASSERT(!size.isEmpty());
|
| +
|
| + FloatPoint point = computeEndPoint(m_firstX.get(), m_firstY.get(), conversionData, size);
|
| + if (!m_firstX)
|
| + point.setX(size.width() / 2);
|
| + if (!m_firstY)
|
| + point.setY(size.height() / 2);
|
| +
|
| + RefPtr<Gradient> gradient = Gradient::create(point, 0); // TODO: angle
|
| + gradient->setSpreadMethod(m_repeating ? SpreadMethodRepeat : SpreadMethodPad);
|
| + gradient->setDrawsInPMColorSpace(true);
|
| +
|
| + addStops(gradient.get(), conversionData, object);
|
| +
|
| + return gradient.release();
|
| +}
|
| +
|
| +bool CSSConicGradientValue::equals(const CSSConicGradientValue& other) const
|
| +{
|
| +
|
| + return compareCSSValuePtr(m_firstX, other.m_firstX)
|
| + && compareCSSValuePtr(m_firstY, other.m_firstY)
|
| + && m_stops == other.m_stops;
|
| +}
|
| +
|
| +DEFINE_TRACE_AFTER_DISPATCH(CSSConicGradientValue)
|
| +{
|
| + CSSGradientValue::traceAfterDispatch(visitor);
|
| +}
|
| +
|
| } // namespace blink
|
|
|