Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: Source/core/svg/SVGLinearGradientElement.cpp

Issue 19097005: Remove one SVG animated type special case from the bindings generator (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix the regressions Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 HashSet<SVGGradientElement*> processedGradients; 123 HashSet<SVGGradientElement*> processedGradients;
124 124
125 bool isLinear = true; 125 bool isLinear = true;
126 SVGGradientElement* current = this; 126 SVGGradientElement* current = this;
127 127
128 while (current) { 128 while (current) {
129 if (!current->renderer()) 129 if (!current->renderer())
130 return false; 130 return false;
131 131
132 if (!attributes.hasSpreadMethod() && current->hasAttribute(SVGNames::spr eadMethodAttr)) 132 if (!attributes.hasSpreadMethod() && current->hasAttribute(SVGNames::spr eadMethodAttr))
133 attributes.setSpreadMethod(current->spreadMethod()); 133 attributes.setSpreadMethod(current->spreadMethodCurrentValue());
134 134
135 if (!attributes.hasGradientUnits() && current->hasAttribute(SVGNames::gr adientUnitsAttr)) 135 if (!attributes.hasGradientUnits() && current->hasAttribute(SVGNames::gr adientUnitsAttr))
136 attributes.setGradientUnits(current->gradientUnits()); 136 attributes.setGradientUnits(current->gradientUnitsCurrentValue());
137 137
138 if (!attributes.hasGradientTransform() && current->hasAttribute(SVGNames ::gradientTransformAttr)) { 138 if (!attributes.hasGradientTransform() && current->hasAttribute(SVGNames ::gradientTransformAttr)) {
139 AffineTransform transform; 139 AffineTransform transform;
140 current->gradientTransform().concatenate(transform); 140 current->gradientTransformCurrentValue().concatenate(transform);
141 attributes.setGradientTransform(transform); 141 attributes.setGradientTransform(transform);
142 } 142 }
143 143
144 if (!attributes.hasStops()) { 144 if (!attributes.hasStops()) {
145 const Vector<Gradient::ColorStop>& stops(current->buildStops()); 145 const Vector<Gradient::ColorStop>& stops(current->buildStops());
146 if (!stops.isEmpty()) 146 if (!stops.isEmpty())
147 attributes.setStops(stops); 147 attributes.setStops(stops);
148 } 148 }
149 149
150 if (isLinear) { 150 if (isLinear) {
151 SVGLinearGradientElement* linear = static_cast<SVGLinearGradientElem ent*>(current); 151 SVGLinearGradientElement* linear = static_cast<SVGLinearGradientElem ent*>(current);
152 152
153 if (!attributes.hasX1() && current->hasAttribute(SVGNames::x1Attr)) 153 if (!attributes.hasX1() && current->hasAttribute(SVGNames::x1Attr))
154 attributes.setX1(linear->x1()); 154 attributes.setX1(linear->x1CurrentValue());
155 155
156 if (!attributes.hasY1() && current->hasAttribute(SVGNames::y1Attr)) 156 if (!attributes.hasY1() && current->hasAttribute(SVGNames::y1Attr))
157 attributes.setY1(linear->y1()); 157 attributes.setY1(linear->y1CurrentValue());
158 158
159 if (!attributes.hasX2() && current->hasAttribute(SVGNames::x2Attr)) 159 if (!attributes.hasX2() && current->hasAttribute(SVGNames::x2Attr))
160 attributes.setX2(linear->x2()); 160 attributes.setX2(linear->x2CurrentValue());
161 161
162 if (!attributes.hasY2() && current->hasAttribute(SVGNames::y2Attr)) 162 if (!attributes.hasY2() && current->hasAttribute(SVGNames::y2Attr))
163 attributes.setY2(linear->y2()); 163 attributes.setY2(linear->y2CurrentValue());
164 } 164 }
165 165
166 processedGradients.add(current); 166 processedGradients.add(current);
167 167
168 // Respect xlink:href, take attributes from referenced element 168 // Respect xlink:href, take attributes from referenced element
169 Node* refNode = SVGURIReference::targetElementFromIRIString(current->hre f(), document()); 169 Node* refNode = SVGURIReference::targetElementFromIRIString(current->hre fCurrentValue(), document());
170 if (refNode && (refNode->hasTagName(SVGNames::linearGradientTag) || refN ode->hasTagName(SVGNames::radialGradientTag))) { 170 if (refNode && (refNode->hasTagName(SVGNames::linearGradientTag) || refN ode->hasTagName(SVGNames::radialGradientTag))) {
171 current = static_cast<SVGGradientElement*>(refNode); 171 current = static_cast<SVGGradientElement*>(refNode);
172 172
173 // Cycle detection 173 // Cycle detection
174 if (processedGradients.contains(current)) { 174 if (processedGradients.contains(current)) {
175 current = 0; 175 current = 0;
176 break; 176 break;
177 } 177 }
178 178
179 isLinear = current->hasTagName(SVGNames::linearGradientTag); 179 isLinear = current->hasTagName(SVGNames::linearGradientTag);
180 } else 180 } else
181 current = 0; 181 current = 0;
182 } 182 }
183 183
184 return true; 184 return true;
185 } 185 }
186 186
187 bool SVGLinearGradientElement::selfHasRelativeLengths() const 187 bool SVGLinearGradientElement::selfHasRelativeLengths() const
188 { 188 {
189 return x1().isRelative() 189 return x1CurrentValue().isRelative()
190 || y1().isRelative() 190 || y1CurrentValue().isRelative()
191 || x2().isRelative() 191 || x2CurrentValue().isRelative()
192 || y2().isRelative(); 192 || y2CurrentValue().isRelative();
193 } 193 }
194 194
195 } 195 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698