| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> |
| 4 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 4 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
| 5 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> | 5 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> |
| 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 { | 78 { |
| 79 if (!isSupportedAttribute(attrName)) { | 79 if (!isSupportedAttribute(attrName)) { |
| 80 SVGGradientElement::svgAttributeChanged(attrName); | 80 SVGGradientElement::svgAttributeChanged(attrName); |
| 81 return; | 81 return; |
| 82 } | 82 } |
| 83 | 83 |
| 84 SVGElement::InvalidationGuard invalidationGuard(this); | 84 SVGElement::InvalidationGuard invalidationGuard(this); |
| 85 | 85 |
| 86 updateRelativeLengthsInformation(); | 86 updateRelativeLengthsInformation(); |
| 87 | 87 |
| 88 LayoutSVGResourceContainer* renderer = toLayoutSVGResourceContainer(this->re
nderer()); | 88 LayoutSVGResourceContainer* renderer = toLayoutSVGResourceContainer(this->la
youtObject()); |
| 89 if (renderer) | 89 if (renderer) |
| 90 renderer->invalidateCacheAndMarkForLayout(); | 90 renderer->invalidateCacheAndMarkForLayout(); |
| 91 } | 91 } |
| 92 | 92 |
| 93 LayoutObject* SVGLinearGradientElement::createLayoutObject(const LayoutStyle&) | 93 LayoutObject* SVGLinearGradientElement::createLayoutObject(const LayoutStyle&) |
| 94 { | 94 { |
| 95 return new LayoutSVGResourceLinearGradient(this); | 95 return new LayoutSVGResourceLinearGradient(this); |
| 96 } | 96 } |
| 97 | 97 |
| 98 static void setGradientAttributes(SVGGradientElement* element, LinearGradientAtt
ributes& attributes, bool isLinear = true) | 98 static void setGradientAttributes(SVGGradientElement* element, LinearGradientAtt
ributes& attributes, bool isLinear = true) |
| (...skipping 28 matching lines...) Expand all Loading... |
| 127 if (!attributes.hasX2() && linear->x2()->isSpecified()) | 127 if (!attributes.hasX2() && linear->x2()->isSpecified()) |
| 128 attributes.setX2(linear->x2()->currentValue()); | 128 attributes.setX2(linear->x2()->currentValue()); |
| 129 | 129 |
| 130 if (!attributes.hasY2() && linear->y2()->isSpecified()) | 130 if (!attributes.hasY2() && linear->y2()->isSpecified()) |
| 131 attributes.setY2(linear->y2()->currentValue()); | 131 attributes.setY2(linear->y2()->currentValue()); |
| 132 } | 132 } |
| 133 } | 133 } |
| 134 | 134 |
| 135 bool SVGLinearGradientElement::collectGradientAttributes(LinearGradientAttribute
s& attributes) | 135 bool SVGLinearGradientElement::collectGradientAttributes(LinearGradientAttribute
s& attributes) |
| 136 { | 136 { |
| 137 if (!renderer()) | 137 if (!layoutObject()) |
| 138 return false; | 138 return false; |
| 139 | 139 |
| 140 WillBeHeapHashSet<RawPtrWillBeMember<SVGGradientElement>> processedGradients
; | 140 WillBeHeapHashSet<RawPtrWillBeMember<SVGGradientElement>> processedGradients
; |
| 141 SVGGradientElement* current = this; | 141 SVGGradientElement* current = this; |
| 142 | 142 |
| 143 setGradientAttributes(current, attributes); | 143 setGradientAttributes(current, attributes); |
| 144 processedGradients.add(current); | 144 processedGradients.add(current); |
| 145 | 145 |
| 146 while (true) { | 146 while (true) { |
| 147 // Respect xlink:href, take attributes from referenced element | 147 // Respect xlink:href, take attributes from referenced element |
| 148 Node* refNode = SVGURIReference::targetElementFromIRIString(current->hre
f()->currentValue()->value(), treeScope()); | 148 Node* refNode = SVGURIReference::targetElementFromIRIString(current->hre
f()->currentValue()->value(), treeScope()); |
| 149 if (refNode && isSVGGradientElement(*refNode)) { | 149 if (refNode && isSVGGradientElement(*refNode)) { |
| 150 current = toSVGGradientElement(refNode); | 150 current = toSVGGradientElement(refNode); |
| 151 | 151 |
| 152 // Cycle detection | 152 // Cycle detection |
| 153 if (processedGradients.contains(current)) | 153 if (processedGradients.contains(current)) |
| 154 return true; | 154 return true; |
| 155 | 155 |
| 156 if (!current->renderer()) | 156 if (!current->layoutObject()) |
| 157 return false; | 157 return false; |
| 158 | 158 |
| 159 setGradientAttributes(current, attributes, isSVGLinearGradientElemen
t(*current)); | 159 setGradientAttributes(current, attributes, isSVGLinearGradientElemen
t(*current)); |
| 160 processedGradients.add(current); | 160 processedGradients.add(current); |
| 161 } else { | 161 } else { |
| 162 return true; | 162 return true; |
| 163 } | 163 } |
| 164 } | 164 } |
| 165 | 165 |
| 166 ASSERT_NOT_REACHED(); | 166 ASSERT_NOT_REACHED(); |
| 167 return false; | 167 return false; |
| 168 } | 168 } |
| 169 | 169 |
| 170 bool SVGLinearGradientElement::selfHasRelativeLengths() const | 170 bool SVGLinearGradientElement::selfHasRelativeLengths() const |
| 171 { | 171 { |
| 172 return m_x1->currentValue()->isRelative() | 172 return m_x1->currentValue()->isRelative() |
| 173 || m_y1->currentValue()->isRelative() | 173 || m_y1->currentValue()->isRelative() |
| 174 || m_x2->currentValue()->isRelative() | 174 || m_x2->currentValue()->isRelative() |
| 175 || m_y2->currentValue()->isRelative(); | 175 || m_y2->currentValue()->isRelative(); |
| 176 } | 176 } |
| 177 | 177 |
| 178 } // namespace blink | 178 } // namespace blink |
| OLD | NEW |