OLD | NEW |
---|---|
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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
190 typedef HashMap<QualifiedName, SVGLengthMode> LengthModeForLengthAttributeMa p; | 190 typedef HashMap<QualifiedName, SVGLengthMode> LengthModeForLengthAttributeMa p; |
191 DEFINE_STATIC_LOCAL(LengthModeForLengthAttributeMap, s_lengthModeMap, ()); | 191 DEFINE_STATIC_LOCAL(LengthModeForLengthAttributeMap, s_lengthModeMap, ()); |
192 | 192 |
193 if (s_lengthModeMap.isEmpty()) { | 193 if (s_lengthModeMap.isEmpty()) { |
194 s_lengthModeMap.set(SVGNames::xAttr, SVGLengthMode::Width); | 194 s_lengthModeMap.set(SVGNames::xAttr, SVGLengthMode::Width); |
195 s_lengthModeMap.set(SVGNames::yAttr, SVGLengthMode::Height); | 195 s_lengthModeMap.set(SVGNames::yAttr, SVGLengthMode::Height); |
196 s_lengthModeMap.set(SVGNames::cxAttr, SVGLengthMode::Width); | 196 s_lengthModeMap.set(SVGNames::cxAttr, SVGLengthMode::Width); |
197 s_lengthModeMap.set(SVGNames::cyAttr, SVGLengthMode::Height); | 197 s_lengthModeMap.set(SVGNames::cyAttr, SVGLengthMode::Height); |
198 s_lengthModeMap.set(SVGNames::dxAttr, SVGLengthMode::Width); | 198 s_lengthModeMap.set(SVGNames::dxAttr, SVGLengthMode::Width); |
199 s_lengthModeMap.set(SVGNames::dyAttr, SVGLengthMode::Height); | 199 s_lengthModeMap.set(SVGNames::dyAttr, SVGLengthMode::Height); |
200 s_lengthModeMap.set(SVGNames::frAttr, SVGLengthMode::Other); | |
200 s_lengthModeMap.set(SVGNames::fxAttr, SVGLengthMode::Width); | 201 s_lengthModeMap.set(SVGNames::fxAttr, SVGLengthMode::Width); |
201 s_lengthModeMap.set(SVGNames::fyAttr, SVGLengthMode::Height); | 202 s_lengthModeMap.set(SVGNames::fyAttr, SVGLengthMode::Height); |
202 s_lengthModeMap.set(SVGNames::rAttr, SVGLengthMode::Other); | 203 s_lengthModeMap.set(SVGNames::rAttr, SVGLengthMode::Other); |
203 s_lengthModeMap.set(SVGNames::rxAttr, SVGLengthMode::Width); | 204 s_lengthModeMap.set(SVGNames::rxAttr, SVGLengthMode::Width); |
204 s_lengthModeMap.set(SVGNames::ryAttr, SVGLengthMode::Height); | 205 s_lengthModeMap.set(SVGNames::ryAttr, SVGLengthMode::Height); |
205 s_lengthModeMap.set(SVGNames::widthAttr, SVGLengthMode::Width); | 206 s_lengthModeMap.set(SVGNames::widthAttr, SVGLengthMode::Width); |
206 s_lengthModeMap.set(SVGNames::heightAttr, SVGLengthMode::Height); | 207 s_lengthModeMap.set(SVGNames::heightAttr, SVGLengthMode::Height); |
207 s_lengthModeMap.set(SVGNames::x1Attr, SVGLengthMode::Width); | 208 s_lengthModeMap.set(SVGNames::x1Attr, SVGLengthMode::Width); |
208 s_lengthModeMap.set(SVGNames::x2Attr, SVGLengthMode::Width); | 209 s_lengthModeMap.set(SVGNames::x2Attr, SVGLengthMode::Width); |
209 s_lengthModeMap.set(SVGNames::y1Attr, SVGLengthMode::Height); | 210 s_lengthModeMap.set(SVGNames::y1Attr, SVGLengthMode::Height); |
210 s_lengthModeMap.set(SVGNames::y2Attr, SVGLengthMode::Height); | 211 s_lengthModeMap.set(SVGNames::y2Attr, SVGLengthMode::Height); |
211 s_lengthModeMap.set(SVGNames::refXAttr, SVGLengthMode::Width); | 212 s_lengthModeMap.set(SVGNames::refXAttr, SVGLengthMode::Width); |
212 s_lengthModeMap.set(SVGNames::refYAttr, SVGLengthMode::Height); | 213 s_lengthModeMap.set(SVGNames::refYAttr, SVGLengthMode::Height); |
213 s_lengthModeMap.set(SVGNames::markerWidthAttr, SVGLengthMode::Width); | 214 s_lengthModeMap.set(SVGNames::markerWidthAttr, SVGLengthMode::Width); |
214 s_lengthModeMap.set(SVGNames::markerHeightAttr, SVGLengthMode::Height); | 215 s_lengthModeMap.set(SVGNames::markerHeightAttr, SVGLengthMode::Height); |
215 s_lengthModeMap.set(SVGNames::textLengthAttr, SVGLengthMode::Width); | 216 s_lengthModeMap.set(SVGNames::textLengthAttr, SVGLengthMode::Width); |
216 s_lengthModeMap.set(SVGNames::startOffsetAttr, SVGLengthMode::Width); | 217 s_lengthModeMap.set(SVGNames::startOffsetAttr, SVGLengthMode::Width); |
217 } | 218 } |
218 | 219 |
219 if (s_lengthModeMap.contains(attrName)) | 220 if (s_lengthModeMap.contains(attrName)) |
220 return s_lengthModeMap.get(attrName); | 221 return s_lengthModeMap.get(attrName); |
221 | 222 |
222 return SVGLengthMode::Other; | 223 return SVGLengthMode::Other; |
223 } | 224 } |
224 | 225 |
226 SVGLengthNegativeValuesMode SVGLength::negativeValuesModeForAnimatedLengthAttrib ute(const QualifiedName& attrName) | |
227 { | |
228 typedef HashMap<QualifiedName, SVGLengthNegativeValuesMode> NegativeValuesMo deForLengthAttributeMap; | |
229 DEFINE_STATIC_LOCAL(NegativeValuesModeForLengthAttributeMap, s_negativeValue sModeMap, ()); | |
230 | |
231 if (s_negativeValuesModeMap.isEmpty()) { | |
232 s_negativeValuesModeMap.set(SVGNames::xAttr, SVGLengthNegativeValuesMode ::AllowNegativeLengths); | |
233 s_negativeValuesModeMap.set(SVGNames::yAttr, SVGLengthNegativeValuesMode ::AllowNegativeLengths); | |
234 s_negativeValuesModeMap.set(SVGNames::cxAttr, SVGLengthNegativeValuesMod e::AllowNegativeLengths); | |
235 s_negativeValuesModeMap.set(SVGNames::cyAttr, SVGLengthNegativeValuesMod e::AllowNegativeLengths); | |
236 s_negativeValuesModeMap.set(SVGNames::dxAttr, SVGLengthNegativeValuesMod e::AllowNegativeLengths); | |
237 s_negativeValuesModeMap.set(SVGNames::dyAttr, SVGLengthNegativeValuesMod e::AllowNegativeLengths); | |
238 s_negativeValuesModeMap.set(SVGNames::frAttr, SVGLengthNegativeValuesMod e::ForbidNegativeLengths); | |
239 s_negativeValuesModeMap.set(SVGNames::fxAttr, SVGLengthNegativeValuesMod e::AllowNegativeLengths); | |
240 s_negativeValuesModeMap.set(SVGNames::fyAttr, SVGLengthNegativeValuesMod e::AllowNegativeLengths); | |
241 s_negativeValuesModeMap.set(SVGNames::rAttr, SVGLengthNegativeValuesMode ::ForbidNegativeLengths); | |
242 s_negativeValuesModeMap.set(SVGNames::rxAttr, SVGLengthNegativeValuesMod e::ForbidNegativeLengths); | |
243 s_negativeValuesModeMap.set(SVGNames::ryAttr, SVGLengthNegativeValuesMod e::ForbidNegativeLengths); | |
244 s_negativeValuesModeMap.set(SVGNames::widthAttr, SVGLengthNegativeValues Mode::ForbidNegativeLengths); | |
245 s_negativeValuesModeMap.set(SVGNames::heightAttr, SVGLengthNegativeValue sMode::ForbidNegativeLengths); | |
246 s_negativeValuesModeMap.set(SVGNames::x1Attr, SVGLengthNegativeValuesMod e::AllowNegativeLengths); | |
247 s_negativeValuesModeMap.set(SVGNames::x2Attr, SVGLengthNegativeValuesMod e::AllowNegativeLengths); | |
248 s_negativeValuesModeMap.set(SVGNames::y1Attr, SVGLengthNegativeValuesMod e::AllowNegativeLengths); | |
249 s_negativeValuesModeMap.set(SVGNames::y2Attr, SVGLengthNegativeValuesMod e::AllowNegativeLengths); | |
250 s_negativeValuesModeMap.set(SVGNames::refXAttr, SVGLengthNegativeValuesM ode::AllowNegativeLengths); | |
251 s_negativeValuesModeMap.set(SVGNames::refYAttr, SVGLengthNegativeValuesM ode::AllowNegativeLengths); | |
252 s_negativeValuesModeMap.set(SVGNames::markerWidthAttr, SVGLengthNegative ValuesMode::ForbidNegativeLengths); | |
253 s_negativeValuesModeMap.set(SVGNames::markerHeightAttr, SVGLengthNegativ eValuesMode::ForbidNegativeLengths); | |
254 s_negativeValuesModeMap.set(SVGNames::textLengthAttr, SVGLengthNegativeV aluesMode::ForbidNegativeLengths); | |
255 s_negativeValuesModeMap.set(SVGNames::startOffsetAttr, SVGLengthNegative ValuesMode::AllowNegativeLengths); | |
256 } | |
257 | |
258 if (s_negativeValuesModeMap.contains(attrName)) | |
259 return s_negativeValuesModeMap.get(attrName); | |
260 | |
261 return SVGLengthNegativeValuesMode::AllowNegativeLengths; | |
alancutter (OOO until 2018)
2015/12/02 03:55:34
ASSERT_NOT_REACHED();
fs
2015/12/02 14:45:42
Actually, since this is essentially a "binary" val
| |
262 } | |
263 | |
225 void SVGLength::add(PassRefPtrWillBeRawPtr<SVGPropertyBase> other, SVGElement* c ontextElement) | 264 void SVGLength::add(PassRefPtrWillBeRawPtr<SVGPropertyBase> other, SVGElement* c ontextElement) |
226 { | 265 { |
227 SVGLengthContext lengthContext(contextElement); | 266 SVGLengthContext lengthContext(contextElement); |
228 setValue(value(lengthContext) + toSVGLength(other)->value(lengthContext), le ngthContext); | 267 setValue(value(lengthContext) + toSVGLength(other)->value(lengthContext), le ngthContext); |
229 } | 268 } |
230 | 269 |
231 void SVGLength::calculateAnimatedValue(SVGAnimationElement* animationElement, | 270 void SVGLength::calculateAnimatedValue(SVGAnimationElement* animationElement, |
232 float percentage, | 271 float percentage, |
233 unsigned repeatCount, | 272 unsigned repeatCount, |
234 PassRefPtrWillBeRawPtr<SVGPropertyBase> fromValue, | 273 PassRefPtrWillBeRawPtr<SVGPropertyBase> fromValue, |
(...skipping 19 matching lines...) Expand all Loading... | |
254 | 293 |
255 float SVGLength::calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase> toVal ue, SVGElement* contextElement) | 294 float SVGLength::calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase> toVal ue, SVGElement* contextElement) |
256 { | 295 { |
257 SVGLengthContext lengthContext(contextElement); | 296 SVGLengthContext lengthContext(contextElement); |
258 RefPtrWillBeRawPtr<SVGLength> toLength = toSVGLength(toValue); | 297 RefPtrWillBeRawPtr<SVGLength> toLength = toSVGLength(toValue); |
259 | 298 |
260 return fabsf(toLength->value(lengthContext) - value(lengthContext)); | 299 return fabsf(toLength->value(lengthContext) - value(lengthContext)); |
261 } | 300 } |
262 | 301 |
263 } | 302 } |
OLD | NEW |