| Index: Source/core/svg/SVGLinearGradientElement.cpp
|
| diff --git a/Source/core/svg/SVGLinearGradientElement.cpp b/Source/core/svg/SVGLinearGradientElement.cpp
|
| index 19df4d50b46b7eedc0f0ac5a5057ca7f93c6c38b..15c80bd4cd8c78fdd7938a9e1cb1a0ddfefb89b3 100644
|
| --- a/Source/core/svg/SVGLinearGradientElement.cpp
|
| +++ b/Source/core/svg/SVGLinearGradientElement.cpp
|
| @@ -119,10 +119,10 @@ bool SVGLinearGradientElement::collectGradientAttributes(LinearGradientAttribute
|
| {
|
| HashSet<SVGGradientElement*> processedGradients;
|
|
|
| - bool isLinear = true;
|
| SVGGradientElement* current = this;
|
| + setAttributeAnimatedLength(current, attributes);
|
|
|
| - while (current) {
|
| + do {
|
| if (!current->renderer())
|
| return false;
|
|
|
| @@ -144,27 +144,11 @@ bool SVGLinearGradientElement::collectGradientAttributes(LinearGradientAttribute
|
| attributes.setStops(stops);
|
| }
|
|
|
| - if (isLinear) {
|
| - SVGLinearGradientElement* linear = toSVGLinearGradientElement(current);
|
| -
|
| - if (!attributes.hasX1() && current->hasAttribute(SVGNames::x1Attr))
|
| - attributes.setX1(linear->x1()->currentValue());
|
| -
|
| - if (!attributes.hasY1() && current->hasAttribute(SVGNames::y1Attr))
|
| - attributes.setY1(linear->y1()->currentValue());
|
| -
|
| - if (!attributes.hasX2() && current->hasAttribute(SVGNames::x2Attr))
|
| - attributes.setX2(linear->x2()->currentValue());
|
| -
|
| - if (!attributes.hasY2() && current->hasAttribute(SVGNames::y2Attr))
|
| - attributes.setY2(linear->y2()->currentValue());
|
| - }
|
| -
|
| processedGradients.add(current);
|
|
|
| // Respect xlink:href, take attributes from referenced element
|
| Node* refNode = SVGURIReference::targetElementFromIRIString(current->hrefCurrentValue(), document());
|
| - if (refNode && (refNode->hasTagName(SVGNames::linearGradientTag) || refNode->hasTagName(SVGNames::radialGradientTag))) {
|
| + if (refNode && isSVGGradientElement(*refNode)) {
|
| current = toSVGGradientElement(refNode);
|
|
|
| // Cycle detection
|
| @@ -173,14 +157,33 @@ bool SVGLinearGradientElement::collectGradientAttributes(LinearGradientAttribute
|
| break;
|
| }
|
|
|
| - isLinear = current->hasTagName(SVGNames::linearGradientTag);
|
| - } else
|
| + if (current->hasTagName(SVGNames::linearGradientTag))
|
| + setAttributeAnimatedLength(current, attributes);
|
| + } else {
|
| current = 0;
|
| - }
|
| + }
|
| + } while (current);
|
|
|
| return true;
|
| }
|
|
|
| +void SVGLinearGradientElement::setAttributeAnimatedLength(SVGGradientElement* element, LinearGradientAttributes& attributes)
|
| +{
|
| + SVGLinearGradientElement* linear = toSVGLinearGradientElement(element);
|
| +
|
| + if (!attributes.hasX1() && element->hasAttribute(SVGNames::x1Attr))
|
| + attributes.setX1(linear->x1()->currentValue());
|
| +
|
| + if (!attributes.hasY1() && element->hasAttribute(SVGNames::y1Attr))
|
| + attributes.setY1(linear->y1()->currentValue());
|
| +
|
| + if (!attributes.hasX2() && element->hasAttribute(SVGNames::x2Attr))
|
| + attributes.setX2(linear->x2()->currentValue());
|
| +
|
| + if (!attributes.hasY2() && element->hasAttribute(SVGNames::y2Attr))
|
| + attributes.setY2(linear->y2()->currentValue());
|
| +}
|
| +
|
| bool SVGLinearGradientElement::selfHasRelativeLengths() const
|
| {
|
| return m_x1->currentValue()->isRelative()
|
|
|