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

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGLength.cpp

Issue 2142513003: Use initializer_lists for static WTF::HashSets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2006 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) 2007 Apple Inc. All rights reserved. 4 * Copyright (C) 2007 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 } 205 }
206 206
207 if (s_lengthModeMap.contains(attrName)) 207 if (s_lengthModeMap.contains(attrName))
208 return s_lengthModeMap.get(attrName); 208 return s_lengthModeMap.get(attrName);
209 209
210 return SVGLengthMode::Other; 210 return SVGLengthMode::Other;
211 } 211 }
212 212
213 bool SVGLength::negativeValuesForbiddenForAnimatedLengthAttribute(const Qualifie dName& attrName) 213 bool SVGLength::negativeValuesForbiddenForAnimatedLengthAttribute(const Qualifie dName& attrName)
214 { 214 {
215 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, s_noNegativeValuesSet, ()); 215 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, noNegativeValuesSet, ({
216 216 SVGNames::frAttr,
217 if (s_noNegativeValuesSet.isEmpty()) { 217 SVGNames::rAttr,
218 s_noNegativeValuesSet.add(SVGNames::frAttr); 218 SVGNames::rxAttr,
219 s_noNegativeValuesSet.add(SVGNames::rAttr); 219 SVGNames::ryAttr,
220 s_noNegativeValuesSet.add(SVGNames::rxAttr); 220 SVGNames::widthAttr,
221 s_noNegativeValuesSet.add(SVGNames::ryAttr); 221 SVGNames::heightAttr,
222 s_noNegativeValuesSet.add(SVGNames::widthAttr); 222 SVGNames::markerWidthAttr,
223 s_noNegativeValuesSet.add(SVGNames::heightAttr); 223 SVGNames::markerHeightAttr,
224 s_noNegativeValuesSet.add(SVGNames::markerWidthAttr); 224 SVGNames::textLengthAttr,
225 s_noNegativeValuesSet.add(SVGNames::markerHeightAttr); 225 }));
226 s_noNegativeValuesSet.add(SVGNames::textLengthAttr); 226 return noNegativeValuesSet.contains(attrName);
227 }
228
229 return s_noNegativeValuesSet.contains(attrName);
230 } 227 }
231 228
232 void SVGLength::add(SVGPropertyBase* other, SVGElement* contextElement) 229 void SVGLength::add(SVGPropertyBase* other, SVGElement* contextElement)
233 { 230 {
234 SVGLengthContext lengthContext(contextElement); 231 SVGLengthContext lengthContext(contextElement);
235 setValue(value(lengthContext) + toSVGLength(other)->value(lengthContext), le ngthContext); 232 setValue(value(lengthContext) + toSVGLength(other)->value(lengthContext), le ngthContext);
236 } 233 }
237 234
238 void SVGLength::calculateAnimatedValue(SVGAnimationElement* animationElement, 235 void SVGLength::calculateAnimatedValue(SVGAnimationElement* animationElement,
239 float percentage, 236 float percentage,
(...skipping 21 matching lines...) Expand all
261 258
262 float SVGLength::calculateDistance(SVGPropertyBase* toValue, SVGElement* context Element) 259 float SVGLength::calculateDistance(SVGPropertyBase* toValue, SVGElement* context Element)
263 { 260 {
264 SVGLengthContext lengthContext(contextElement); 261 SVGLengthContext lengthContext(contextElement);
265 SVGLength* toLength = toSVGLength(toValue); 262 SVGLength* toLength = toSVGLength(toValue);
266 263
267 return fabsf(toLength->value(lengthContext) - value(lengthContext)); 264 return fabsf(toLength->value(lengthContext) - value(lengthContext));
268 } 265 }
269 266
270 } // namespace blink 267 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGElement.cpp ('k') | third_party/WebKit/Source/core/svg/SVGUseElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698