diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
commit | 32761a6cee1d0dee366b885b7b9c777e67885688 (patch) | |
tree | d6bec92bebfb216f4126356e55518842c2f476a1 /Source/WebCore/css/CSSGradientValue.cpp | |
parent | a4e969f4965059196ca948db781e52f7cfebf19e (diff) | |
download | WebKitGtk-tarball-32761a6cee1d0dee366b885b7b9c777e67885688.tar.gz |
webkitgtk-2.4.11webkitgtk-2.4.11
Diffstat (limited to 'Source/WebCore/css/CSSGradientValue.cpp')
-rw-r--r-- | Source/WebCore/css/CSSGradientValue.cpp | 292 |
1 files changed, 93 insertions, 199 deletions
diff --git a/Source/WebCore/css/CSSGradientValue.cpp b/Source/WebCore/css/CSSGradientValue.cpp index 568857e1b..151740fba 100644 --- a/Source/WebCore/css/CSSGradientValue.cpp +++ b/Source/WebCore/css/CSSGradientValue.cpp @@ -10,10 +10,10 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -27,31 +27,29 @@ #include "CSSGradientValue.h" #include "CSSCalculationValue.h" -#include "CSSToLengthConversionData.h" #include "CSSValueKeywords.h" -#include "FloatSize.h" -#include "FloatSizeHash.h" #include "Gradient.h" #include "GradientImage.h" #include "Image.h" +#include "IntSize.h" +#include "IntSizeHash.h" #include "NodeRenderStyle.h" #include "RenderElement.h" -#include "RenderView.h" #include "StyleResolver.h" #include <wtf/text/StringBuilder.h> #include <wtf/text/WTFString.h> namespace WebCore { -RefPtr<Image> CSSGradientValue::image(RenderElement* renderer, const FloatSize& size) +PassRefPtr<Image> CSSGradientValue::image(RenderElement* renderer, const IntSize& size) { if (size.isEmpty()) - return nullptr; + return 0; bool cacheable = isCacheable(); if (cacheable) { if (!clients().contains(renderer)) - return nullptr; + return 0; Image* result = cachedImageForSize(size); if (result) @@ -60,16 +58,16 @@ RefPtr<Image> CSSGradientValue::image(RenderElement* renderer, const FloatSize& RefPtr<Gradient> gradient; - if (is<CSSLinearGradientValue>(*this)) - gradient = downcast<CSSLinearGradientValue>(*this).createGradient(*renderer, size); + if (isLinearGradientValue()) + gradient = toCSSLinearGradientValue(this)->createGradient(renderer, size); else - gradient = downcast<CSSRadialGradientValue>(*this).createGradient(*renderer, size); + gradient = toCSSRadialGradientValue(this)->createGradient(renderer, size); RefPtr<GradientImage> newImage = GradientImage::create(gradient, size); if (cacheable) saveCachedImageForSize(size, newImage); - return newImage; + return newImage.release(); } // Should only ever be called for deprecated gradients. @@ -95,63 +93,45 @@ struct GradientStop { Color color; float offset; bool specified; - bool isMidpoint; GradientStop() : offset(0) , specified(false) - , isMidpoint(false) { } }; -RefPtr<CSSGradientValue> CSSGradientValue::gradientWithStylesResolved(StyleResolver* styleResolver) +PassRefPtr<CSSGradientValue> CSSGradientValue::gradientWithStylesResolved(StyleResolver* styleResolver) { bool derived = false; - for (auto& stop : m_stops) { - if (!stop.isMidpoint && styleResolver->colorFromPrimitiveValueIsDerivedFromElement(*stop.m_color)) { - stop.m_colorIsDerivedFromElement = true; + for (unsigned i = 0; i < m_stops.size(); i++) + if (styleResolver->colorFromPrimitiveValueIsDerivedFromElement(m_stops[i].m_color.get())) { + m_stops[i].m_colorIsDerivedFromElement = true; derived = true; break; } - } RefPtr<CSSGradientValue> result; if (!derived) result = this; - else if (is<CSSLinearGradientValue>(*this)) - result = downcast<CSSLinearGradientValue>(*this).clone(); - else if (is<CSSRadialGradientValue>(*this)) - result = downcast<CSSRadialGradientValue>(*this).clone(); + else if (isLinearGradientValue()) + result = toCSSLinearGradientValue(this)->clone(); + else if (isRadialGradientValue()) + result = toCSSRadialGradientValue(this)->clone(); else { ASSERT_NOT_REACHED(); - return nullptr; - } - - for (auto& stop : result->m_stops) { - if (!stop.isMidpoint) - stop.m_resolvedColor = styleResolver->colorFromPrimitiveValue(*stop.m_color); + return 0; } - return result; -} + for (unsigned i = 0; i < result->m_stops.size(); i++) + result->m_stops[i].m_resolvedColor = styleResolver->colorFromPrimitiveValue(result->m_stops[i].m_color.get()); -static inline int interpolate(int min, int max, float position) -{ - return min + static_cast<int>(position * (max - min)); + return result.release(); } -static inline Color interpolate(Color color1, Color color2, float position) +void CSSGradientValue::addStops(Gradient* gradient, RenderElement* renderer, const RenderStyle& rootStyle, float maxLengthForRepeat) { - int red = interpolate(color1.red(), color2.red(), position); - int green = interpolate(color1.green(), color2.green(), position); - int blue = interpolate(color1.blue(), color2.blue(), position); - int alpha = interpolate(color1.alpha(), color2.alpha(), position); - - return Color(red, green, blue, alpha); -} + RenderStyle& style = renderer->style(); -void CSSGradientValue::addStops(Gradient& gradient, const CSSToLengthConversionData& conversionData, float maxLengthForRepeat) -{ if (m_gradientType == CSSDeprecatedLinearGradient || m_gradientType == CSSDeprecatedRadialGradient) { sortStopsIfNeeded(); @@ -164,11 +144,11 @@ void CSSGradientValue::addStops(Gradient& gradient, const CSSToLengthConversionD else offset = stop.m_position->getFloatValue(CSSPrimitiveValue::CSS_NUMBER); - gradient.addColorStop(offset, stop.m_resolvedColor); + gradient->addColorStop(offset, stop.m_resolvedColor); } // The back end already sorted the stops. - gradient.setStopsSorted(true); + gradient->setStopsSorted(true); return; } @@ -179,35 +159,31 @@ void CSSGradientValue::addStops(Gradient& gradient, const CSSToLengthConversionD float gradientLength = 0; bool computedGradientLength = false; - FloatPoint gradientStart = gradient.p0(); + FloatPoint gradientStart = gradient->p0(); FloatPoint gradientEnd; if (isLinearGradientValue()) - gradientEnd = gradient.p1(); + gradientEnd = gradient->p1(); else if (isRadialGradientValue()) - gradientEnd = gradientStart + FloatSize(gradient.endRadius(), 0); + gradientEnd = gradientStart + FloatSize(gradient->endRadius(), 0); for (size_t i = 0; i < numStops; ++i) { const CSSGradientColorStop& stop = m_stops[i]; - stops[i].isMidpoint = stop.isMidpoint; stops[i].color = stop.m_resolvedColor; if (stop.m_position) { - const CSSPrimitiveValue& positionValue = *stop.m_position; - if (positionValue.isPercentage()) - stops[i].offset = positionValue.getFloatValue(CSSPrimitiveValue::CSS_PERCENTAGE) / 100; - else if (positionValue.isLength() || positionValue.isViewportPercentageLength() || positionValue.isCalculatedPercentageWithLength()) { + if (stop.m_position->isPercentage()) + stops[i].offset = stop.m_position->getFloatValue(CSSPrimitiveValue::CSS_PERCENTAGE) / 100; + else if (stop.m_position->isLength() || stop.m_position->isCalculatedPercentageWithLength()) { if (!computedGradientLength) { FloatSize gradientSize(gradientStart - gradientEnd); gradientLength = gradientSize.diagonalLength(); } float length; - if (positionValue.isLength()) - length = positionValue.computeLength<float>(conversionData); - else { - Ref<CalculationValue> calculationValue { positionValue.cssCalcValue()->createCalculationValue(conversionData) }; - length = calculationValue->evaluate(gradientLength); - } + if (stop.m_position->isLength()) + length = stop.m_position->computeLength<float>(&style, &rootStyle, style.effectiveZoom()); + else + length = stop.m_position->cssCalcValue()->toCalcValue(&style, &rootStyle, style.effectiveZoom())->evaluate(gradientLength); stops[i].offset = (gradientLength > 0) ? length / gradientLength : 0; } else { ASSERT_NOT_REACHED(); @@ -271,86 +247,6 @@ void CSSGradientValue::addStops(Gradient& gradient, const CSSToLengthConversionD } } - // Walk over the color stops, look for midpoints and add stops as needed. - // If mid < 50%, add 2 stops to the left and 6 to the right - // else add 6 stops to the left and 2 to the right. - // Stops on the side with the most stops start midway because the curve approximates - // a line in that region. We then add 5 more color stops on that side to minimize the change - // how the luminance changes at each of the color stops. We don't have to add as many on the other side - // since it becomes small which increases the differentation of luminance which hides the color stops. - // Even with 4 extra color stops, it *is* possible to discern the steps when the gradient is large and has - // large luminance differences between midpoint and color stop. If this becomes an issue, we can consider - // making this algorithm a bit smarter. - - // Midpoints that coincide with color stops are treated specially since they don't require - // extra stops and generate hard lines. - for (size_t x = 1; x < stops.size() - 1;) { - if (!stops[x].isMidpoint) { - ++x; - continue; - } - - // Find previous and next color so we know what to interpolate between. - // We already know they have a color since we checked for that earlier. - Color color1 = stops[x - 1].color; - Color color2 = stops[x + 1].color; - // Likewise find the position of previous and next color stop. - float offset1 = stops[x - 1].offset; - float offset2 = stops[x + 1].offset; - float offset = stops[x].offset; - - // Check if everything coincides or the midpoint is exactly in the middle. - // If so, ignore the midpoint. - if (offset - offset1 == offset2 - offset) { - stops.remove(x); - continue; - } - - // Check if we coincide with the left color stop. - if (offset1 == offset) { - // Morph the midpoint to a regular stop with the color of the next color stop. - stops[x].color = color2; - stops[x].isMidpoint = false; - continue; - } - - // Check if we coincide with the right color stop. - if (offset2 == offset) { - // Morph the midpoint to a regular stop with the color of the previous color stop. - stops[x].color = color1; - stops[x].isMidpoint = false; - continue; - } - - float midpoint = (offset - offset1) / (offset2 - offset1); - GradientStop newStops[9]; - if (midpoint > .5f) { - for (size_t y = 0; y < 7; ++y) - newStops[y].offset = offset1 + (offset - offset1) * (7 + y) / 13; - - newStops[7].offset = offset + (offset2 - offset) / 3; - newStops[8].offset = offset + (offset2 - offset) * 2 / 3; - } else { - newStops[0].offset = offset1 + (offset - offset1) / 3; - newStops[1].offset = offset1 + (offset - offset1) * 2 / 3; - - for (size_t y = 0; y < 7; ++y) - newStops[y + 2].offset = offset + (offset2 - offset) * y / 13; - } - // calculate colors - for (size_t y = 0; y < 9; ++y) { - float relativeOffset = (newStops[y].offset - offset1) / (offset2 - offset1); - float multiplier = powf(relativeOffset, logf(.5f) / logf(midpoint)); - newStops[y].color = interpolate(color1, color2, multiplier); - } - - stops.remove(x); - stops.insert(x, newStops, 9); - x += 9; - } - - numStops = stops.size(); - // If the gradient is repeating, repeat the color stops. // We can't just push this logic down into the platform-specific Gradient code, // because we have to know the extent of the gradient, and possible move the end points. @@ -375,7 +271,7 @@ void CSSGradientValue::addStops(Gradient& gradient, const CSSToLengthConversionD } if (maxLengthForRepeat > gradientLength) - maxExtent = gradientLength > 0 ? maxLengthForRepeat / gradientLength : 0; + maxExtent = maxLengthForRepeat / gradientLength; } size_t originalNumStops = numStops; @@ -435,10 +331,10 @@ void CSSGradientValue::addStops(Gradient& gradient, const CSSToLengthConversionD for (size_t i = 0; i < numStops; ++i) stops[i].offset = (stops[i].offset - firstOffset) / scale; - FloatPoint p0 = gradient.p0(); - FloatPoint p1 = gradient.p1(); - gradient.setP0(FloatPoint(p0.x() + firstOffset * (p1.x() - p0.x()), p0.y() + firstOffset * (p1.y() - p0.y()))); - gradient.setP1(FloatPoint(p1.x() + (lastOffset - 1) * (p1.x() - p0.x()), p1.y() + (lastOffset - 1) * (p1.y() - p0.y()))); + FloatPoint p0 = gradient->p0(); + FloatPoint p1 = gradient->p1(); + gradient->setP0(FloatPoint(p0.x() + firstOffset * (p1.x() - p0.x()), p0.y() + firstOffset * (p1.y() - p0.y()))); + gradient->setP1(FloatPoint(p1.x() + (lastOffset - 1) * (p1.x() - p0.x()), p1.y() + (lastOffset - 1) * (p1.y() - p0.y()))); } else { // There's a single position that is outside the scale, clamp the positions to 1. for (size_t i = 0; i < numStops; ++i) @@ -483,32 +379,32 @@ void CSSGradientValue::addStops(Gradient& gradient, const CSSToLengthConversionD for (size_t i = 0; i < numStops; ++i) stops[i].offset /= scale; - gradient.setStartRadius(gradient.startRadius() * scale); - gradient.setEndRadius(gradient.endRadius() * scale); + gradient->setStartRadius(gradient->startRadius() * scale); + gradient->setEndRadius(gradient->endRadius() * scale); } } for (unsigned i = 0; i < numStops; i++) - gradient.addColorStop(stops[i].offset, stops[i].color); + gradient->addColorStop(stops[i].offset, stops[i].color); - gradient.setStopsSorted(true); + gradient->setStopsSorted(true); } -static float positionFromValue(CSSPrimitiveValue& value, const CSSToLengthConversionData& conversionData, const FloatSize& size, bool isHorizontal) +static float positionFromValue(CSSPrimitiveValue* value, const RenderStyle& style, const RenderStyle& rootStyle, const IntSize& size, bool isHorizontal) { - if (value.isNumber()) - return value.getFloatValue() * conversionData.zoom(); + float zoomFactor = style.effectiveZoom(); + + if (value->isNumber()) + return value->getFloatValue() * zoomFactor; int edgeDistance = isHorizontal ? size.width() : size.height(); - if (value.isPercentage()) - return value.getFloatValue() / 100.f * edgeDistance; + if (value->isPercentage()) + return value->getFloatValue() / 100.f * edgeDistance; - if (value.isCalculatedPercentageWithLength()) { - Ref<CalculationValue> calculationValue { value.cssCalcValue()->createCalculationValue(conversionData) }; - return calculationValue->evaluate(edgeDistance); - } + if (value->isCalculatedPercentageWithLength()) + return value->cssCalcValue()->toCalcValue(&style, &rootStyle, style.effectiveZoom())->evaluate(edgeDistance); - switch (value.getValueID()) { + switch (value->getValueID()) { case CSSValueTop: ASSERT(!isHorizontal); return 0; @@ -525,18 +421,18 @@ static float positionFromValue(CSSPrimitiveValue& value, const CSSToLengthConver break; } - return value.computeLength<float>(conversionData); + return value->computeLength<float>(&style, &rootStyle, zoomFactor); } -FloatPoint CSSGradientValue::computeEndPoint(CSSPrimitiveValue* horizontal, CSSPrimitiveValue* vertical, const CSSToLengthConversionData& conversionData, const FloatSize& size) +FloatPoint CSSGradientValue::computeEndPoint(CSSPrimitiveValue* horizontal, CSSPrimitiveValue* vertical, const RenderStyle& style, const RenderStyle& rootStyle, const IntSize& size) { FloatPoint result; if (horizontal) - result.setX(positionFromValue(*horizontal, conversionData, size, true)); + result.setX(positionFromValue(horizontal, style, rootStyle, size, true)); if (vertical) - result.setY(positionFromValue(*vertical, conversionData, size, false)); + result.setY(positionFromValue(vertical, style, rootStyle, size, false)); return result; } @@ -662,11 +558,9 @@ String CSSLinearGradientValue::customCSSText() const const CSSGradientColorStop& stop = m_stops[i]; if (i) result.appendLiteral(", "); - if (!stop.isMidpoint) - result.append(stop.m_color->cssText()); + result.append(stop.m_color->cssText()); if (stop.m_position) { - if (!stop.isMidpoint) - result.append(' '); + result.append(' '); result.append(stop.m_position->cssText()); } } @@ -678,7 +572,7 @@ String CSSLinearGradientValue::customCSSText() const } // Compute the endpoints so that a gradient of the given angle covers a box of the given size. -static void endPointsFromAngle(float angleDeg, const FloatSize& size, FloatPoint& firstPoint, FloatPoint& secondPoint, CSSGradientType type) +static void endPointsFromAngle(float angleDeg, const IntSize& size, FloatPoint& firstPoint, FloatPoint& secondPoint, CSSGradientType type) { // Prefixed gradients use "polar coordinate" angles, rather than "bearing" angles. if (type == CSSPrefixedLinearGradient) @@ -745,11 +639,11 @@ static void endPointsFromAngle(float angleDeg, const FloatSize& size, FloatPoint firstPoint.set(halfWidth - endX, halfHeight + endY); } -Ref<Gradient> CSSLinearGradientValue::createGradient(RenderElement& renderer, const FloatSize& size) +PassRefPtr<Gradient> CSSLinearGradientValue::createGradient(RenderElement* renderer, const IntSize& size) { ASSERT(!size.isEmpty()); - CSSToLengthConversionData conversionData(&renderer.style(), renderer.document().documentElement()->renderStyle(), &renderer.view()); + RenderStyle& rootStyle = *renderer->document().documentElement()->renderStyle(); FloatPoint firstPoint; FloatPoint secondPoint; @@ -759,9 +653,9 @@ Ref<Gradient> CSSLinearGradientValue::createGradient(RenderElement& renderer, co } else { switch (m_gradientType) { case CSSDeprecatedLinearGradient: - firstPoint = computeEndPoint(m_firstX.get(), m_firstY.get(), conversionData, size); + firstPoint = computeEndPoint(m_firstX.get(), m_firstY.get(), renderer->style(), rootStyle, size); if (m_secondX || m_secondY) - secondPoint = computeEndPoint(m_secondX.get(), m_secondY.get(), conversionData, size); + secondPoint = computeEndPoint(m_secondX.get(), m_secondY.get(), renderer->style(), rootStyle, size); else { if (m_firstX) secondPoint.setX(size.width() - firstPoint.x()); @@ -770,7 +664,7 @@ Ref<Gradient> CSSLinearGradientValue::createGradient(RenderElement& renderer, co } break; case CSSPrefixedLinearGradient: - firstPoint = computeEndPoint(m_firstX.get(), m_firstY.get(), conversionData, size); + firstPoint = computeEndPoint(m_firstX.get(), m_firstY.get(), renderer->style(), rootStyle, size); if (m_firstX) secondPoint.setX(size.width() - firstPoint.x()); if (m_firstY) @@ -789,7 +683,7 @@ Ref<Gradient> CSSLinearGradientValue::createGradient(RenderElement& renderer, co float angle = 90 - rad2deg(atan2(rise, run)); endPointsFromAngle(angle, size, firstPoint, secondPoint, m_gradientType); } else if (m_firstX || m_firstY) { - secondPoint = computeEndPoint(m_firstX.get(), m_firstY.get(), conversionData, size); + secondPoint = computeEndPoint(m_firstX.get(), m_firstY.get(), renderer->style(), rootStyle, size); if (m_firstX) firstPoint.setX(size.width() - secondPoint.x()); if (m_firstY) @@ -803,12 +697,12 @@ Ref<Gradient> CSSLinearGradientValue::createGradient(RenderElement& renderer, co } - Ref<Gradient> gradient = Gradient::create(firstPoint, secondPoint); + RefPtr<Gradient> gradient = Gradient::create(firstPoint, secondPoint); // Now add the stops. - addStops(gradient, conversionData, 1); + addStops(gradient.get(), renderer, rootStyle, 1); - return gradient; + return gradient.release(); } bool CSSLinearGradientValue::equals(const CSSLinearGradientValue& other) const @@ -980,11 +874,9 @@ String CSSRadialGradientValue::customCSSText() const const CSSGradientColorStop& stop = m_stops[i]; if (i) result.appendLiteral(", "); - if (!stop.isMidpoint) - result.append(stop.m_color->cssText()); + result.append(stop.m_color->cssText()); if (stop.m_position) { - if (!stop.isMidpoint) - result.append(' '); + result.append(' '); result.append(stop.m_position->cssText()); } } @@ -995,15 +887,17 @@ String CSSRadialGradientValue::customCSSText() const return result.toString(); } -float CSSRadialGradientValue::resolveRadius(CSSPrimitiveValue& radius, const CSSToLengthConversionData& conversionData, float* widthOrHeight) +float CSSRadialGradientValue::resolveRadius(CSSPrimitiveValue* radius, const RenderStyle& style, const RenderStyle& rootStyle, float* widthOrHeight) { + float zoomFactor = style.effectiveZoom(); + float result = 0; - if (radius.isNumber()) // Can the radius be a percentage? - result = radius.getFloatValue() * conversionData.zoom(); - else if (widthOrHeight && radius.isPercentage()) - result = *widthOrHeight * radius.getFloatValue() / 100; + if (radius->isNumber()) // Can the radius be a percentage? + result = radius->getFloatValue() * zoomFactor; + else if (widthOrHeight && radius->isPercentage()) + result = *widthOrHeight * radius->getFloatValue() / 100; else - result = radius.computeLength<float>(conversionData); + result = radius->computeLength<float>(&style, &rootStyle, zoomFactor); return result; } @@ -1085,19 +979,19 @@ static inline float horizontalEllipseRadius(const FloatSize& p, float aspectRati } // FIXME: share code with the linear version -Ref<Gradient> CSSRadialGradientValue::createGradient(RenderElement& renderer, const FloatSize& size) +PassRefPtr<Gradient> CSSRadialGradientValue::createGradient(RenderElement* renderer, const IntSize& size) { ASSERT(!size.isEmpty()); - CSSToLengthConversionData conversionData(&renderer.style(), renderer.document().documentElement()->renderStyle(), &renderer.view()); + RenderStyle& rootStyle = *renderer->document().documentElement()->renderStyle(); - FloatPoint firstPoint = computeEndPoint(m_firstX.get(), m_firstY.get(), conversionData, size); + FloatPoint firstPoint = computeEndPoint(m_firstX.get(), m_firstY.get(), renderer->style(), rootStyle, size); if (!m_firstX) firstPoint.setX(size.width() / 2); if (!m_firstY) firstPoint.setY(size.height() / 2); - FloatPoint secondPoint = computeEndPoint(m_secondX.get(), m_secondY.get(), conversionData, size); + FloatPoint secondPoint = computeEndPoint(m_secondX.get(), m_secondY.get(), renderer->style(), rootStyle, size); if (!m_secondX) secondPoint.setX(size.width() / 2); if (!m_secondY) @@ -1105,18 +999,18 @@ Ref<Gradient> CSSRadialGradientValue::createGradient(RenderElement& renderer, co float firstRadius = 0; if (m_firstRadius) - firstRadius = resolveRadius(*m_firstRadius, conversionData); + firstRadius = resolveRadius(m_firstRadius.get(), renderer->style(), rootStyle); float secondRadius = 0; float aspectRatio = 1; // width / height. if (m_secondRadius) - secondRadius = resolveRadius(*m_secondRadius, conversionData); + secondRadius = resolveRadius(m_secondRadius.get(), renderer->style(), rootStyle); else if (m_endHorizontalSize) { float width = size.width(); float height = size.height(); - secondRadius = resolveRadius(*m_endHorizontalSize, conversionData, &width); + secondRadius = resolveRadius(m_endHorizontalSize.get(), renderer->style(), rootStyle, &width); if (m_endVerticalSize) - aspectRatio = secondRadius / resolveRadius(*m_endVerticalSize, conversionData, &height); + aspectRatio = secondRadius / resolveRadius(m_endVerticalSize.get(), renderer->style(), rootStyle, &height); else aspectRatio = 1; } else { @@ -1212,7 +1106,7 @@ Ref<Gradient> CSSRadialGradientValue::createGradient(RenderElement& renderer, co } } - Ref<Gradient> gradient = Gradient::create(firstPoint, firstRadius, secondPoint, secondRadius, aspectRatio); + RefPtr<Gradient> gradient = Gradient::create(firstPoint, firstRadius, secondPoint, secondRadius, aspectRatio); // addStops() only uses maxExtent for repeating gradients. float maxExtent = 0; @@ -1222,9 +1116,9 @@ Ref<Gradient> CSSRadialGradientValue::createGradient(RenderElement& renderer, co } // Now add the stops. - addStops(gradient, conversionData, maxExtent); + addStops(gradient.get(), renderer, rootStyle, maxExtent); - return gradient; + return gradient.release(); } bool CSSRadialGradientValue::equals(const CSSRadialGradientValue& other) const |