| 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 HashSet<SVGGradientElement*> processedGradients; | 134 HashSet<SVGGradientElement*> processedGradients; |
| 135 | 135 |
| 136 bool isRadial = true; | 136 bool isRadial = true; |
| 137 SVGGradientElement* current = this; | 137 SVGGradientElement* current = this; |
| 138 | 138 |
| 139 while (current) { | 139 while (current) { |
| 140 if (!current->renderer()) | 140 if (!current->renderer()) |
| 141 return false; | 141 return false; |
| 142 | 142 |
| 143 if (!attributes.hasSpreadMethod() && current->hasAttribute(SVGNames::spr
eadMethodAttr)) | 143 if (!attributes.hasSpreadMethod() && current->hasAttribute(SVGNames::spr
eadMethodAttr)) |
| 144 attributes.setSpreadMethod(current->spreadMethod()); | 144 attributes.setSpreadMethod(current->spreadMethodCurrentValue()); |
| 145 | 145 |
| 146 if (!attributes.hasGradientUnits() && current->hasAttribute(SVGNames::gr
adientUnitsAttr)) | 146 if (!attributes.hasGradientUnits() && current->hasAttribute(SVGNames::gr
adientUnitsAttr)) |
| 147 attributes.setGradientUnits(current->gradientUnits()); | 147 attributes.setGradientUnits(current->gradientUnitsCurrentValue()); |
| 148 | 148 |
| 149 if (!attributes.hasGradientTransform() && current->hasAttribute(SVGNames
::gradientTransformAttr)) { | 149 if (!attributes.hasGradientTransform() && current->hasAttribute(SVGNames
::gradientTransformAttr)) { |
| 150 AffineTransform transform; | 150 AffineTransform transform; |
| 151 current->gradientTransform().concatenate(transform); | 151 current->gradientTransformCurrentValue().concatenate(transform); |
| 152 attributes.setGradientTransform(transform); | 152 attributes.setGradientTransform(transform); |
| 153 } | 153 } |
| 154 | 154 |
| 155 if (!attributes.hasStops()) { | 155 if (!attributes.hasStops()) { |
| 156 const Vector<Gradient::ColorStop>& stops(current->buildStops()); | 156 const Vector<Gradient::ColorStop>& stops(current->buildStops()); |
| 157 if (!stops.isEmpty()) | 157 if (!stops.isEmpty()) |
| 158 attributes.setStops(stops); | 158 attributes.setStops(stops); |
| 159 } | 159 } |
| 160 | 160 |
| 161 if (isRadial) { | 161 if (isRadial) { |
| 162 SVGRadialGradientElement* radial = static_cast<SVGRadialGradientElem
ent*>(current); | 162 SVGRadialGradientElement* radial = static_cast<SVGRadialGradientElem
ent*>(current); |
| 163 | 163 |
| 164 if (!attributes.hasCx() && current->hasAttribute(SVGNames::cxAttr)) | 164 if (!attributes.hasCx() && current->hasAttribute(SVGNames::cxAttr)) |
| 165 attributes.setCx(radial->cx()); | 165 attributes.setCx(radial->cxCurrentValue()); |
| 166 | 166 |
| 167 if (!attributes.hasCy() && current->hasAttribute(SVGNames::cyAttr)) | 167 if (!attributes.hasCy() && current->hasAttribute(SVGNames::cyAttr)) |
| 168 attributes.setCy(radial->cy()); | 168 attributes.setCy(radial->cyCurrentValue()); |
| 169 | 169 |
| 170 if (!attributes.hasR() && current->hasAttribute(SVGNames::rAttr)) | 170 if (!attributes.hasR() && current->hasAttribute(SVGNames::rAttr)) |
| 171 attributes.setR(radial->r()); | 171 attributes.setR(radial->rCurrentValue()); |
| 172 | 172 |
| 173 if (!attributes.hasFx() && current->hasAttribute(SVGNames::fxAttr)) | 173 if (!attributes.hasFx() && current->hasAttribute(SVGNames::fxAttr)) |
| 174 attributes.setFx(radial->fx()); | 174 attributes.setFx(radial->fxCurrentValue()); |
| 175 | 175 |
| 176 if (!attributes.hasFy() && current->hasAttribute(SVGNames::fyAttr)) | 176 if (!attributes.hasFy() && current->hasAttribute(SVGNames::fyAttr)) |
| 177 attributes.setFy(radial->fy()); | 177 attributes.setFy(radial->fyCurrentValue()); |
| 178 | 178 |
| 179 if (!attributes.hasFr() && current->hasAttribute(SVGNames::frAttr)) | 179 if (!attributes.hasFr() && current->hasAttribute(SVGNames::frAttr)) |
| 180 attributes.setFr(radial->fr()); | 180 attributes.setFr(radial->frCurrentValue()); |
| 181 } | 181 } |
| 182 | 182 |
| 183 processedGradients.add(current); | 183 processedGradients.add(current); |
| 184 | 184 |
| 185 // Respect xlink:href, take attributes from referenced element | 185 // Respect xlink:href, take attributes from referenced element |
| 186 Node* refNode = SVGURIReference::targetElementFromIRIString(current->hre
f(), document()); | 186 Node* refNode = SVGURIReference::targetElementFromIRIString(current->hre
fCurrentValue(), document()); |
| 187 if (refNode && (refNode->hasTagName(SVGNames::radialGradientTag) || refN
ode->hasTagName(SVGNames::linearGradientTag))) { | 187 if (refNode && (refNode->hasTagName(SVGNames::radialGradientTag) || refN
ode->hasTagName(SVGNames::linearGradientTag))) { |
| 188 current = static_cast<SVGGradientElement*>(refNode); | 188 current = static_cast<SVGGradientElement*>(refNode); |
| 189 | 189 |
| 190 // Cycle detection | 190 // Cycle detection |
| 191 if (processedGradients.contains(current)) { | 191 if (processedGradients.contains(current)) { |
| 192 current = 0; | 192 current = 0; |
| 193 break; | 193 break; |
| 194 } | 194 } |
| 195 | 195 |
| 196 isRadial = current->hasTagName(SVGNames::radialGradientTag); | 196 isRadial = current->hasTagName(SVGNames::radialGradientTag); |
| 197 } else | 197 } else |
| 198 current = 0; | 198 current = 0; |
| 199 } | 199 } |
| 200 | 200 |
| 201 // Handle default values for fx/fy | 201 // Handle default values for fx/fy |
| 202 if (!attributes.hasFx()) | 202 if (!attributes.hasFx()) |
| 203 attributes.setFx(attributes.cx()); | 203 attributes.setFx(attributes.cx()); |
| 204 | 204 |
| 205 if (!attributes.hasFy()) | 205 if (!attributes.hasFy()) |
| 206 attributes.setFy(attributes.cy()); | 206 attributes.setFy(attributes.cy()); |
| 207 return true; | 207 return true; |
| 208 } | 208 } |
| 209 | 209 |
| 210 bool SVGRadialGradientElement::selfHasRelativeLengths() const | 210 bool SVGRadialGradientElement::selfHasRelativeLengths() const |
| 211 { | 211 { |
| 212 return cx().isRelative() | 212 return cxCurrentValue().isRelative() |
| 213 || cy().isRelative() | 213 || cyCurrentValue().isRelative() |
| 214 || r().isRelative() | 214 || rCurrentValue().isRelative() |
| 215 || fx().isRelative() | 215 || fxCurrentValue().isRelative() |
| 216 || fy().isRelative() | 216 || fyCurrentValue().isRelative() |
| 217 || fr().isRelative(); | 217 || frCurrentValue().isRelative(); |
| 218 } | 218 } |
| 219 | 219 |
| 220 } | 220 } |
| OLD | NEW |