OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 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) 2007 Eric Seidel <eric@webkit.org> | 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> |
5 * Copyright (C) 2008 Apple Inc. All rights reserved. | 5 * Copyright (C) 2008 Apple Inc. All rights reserved. |
6 * Copyright (C) Research In Motion Limited 2012. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2012. 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 } | 115 } |
116 | 116 |
117 // These should be kept in sync with enum SVGTransformType | 117 // These should be kept in sync with enum SVGTransformType |
118 static const int requiredValuesForType[] = {0, 6, 1, 1, 1, 1, 1}; | 118 static const int requiredValuesForType[] = {0, 6, 1, 1, 1, 1, 1}; |
119 static const int optionalValuesForType[] = {0, 0, 1, 1, 2, 0, 0}; | 119 static const int optionalValuesForType[] = {0, 0, 1, 1, 2, 0, 0}; |
120 | 120 |
121 template<typename CharType> | 121 template<typename CharType> |
122 PassRefPtr<SVGTransform> parseTransformOfType(unsigned type, const CharType*& pt
r, const CharType* end) | 122 PassRefPtr<SVGTransform> parseTransformOfType(unsigned type, const CharType*& pt
r, const CharType* end) |
123 { | 123 { |
124 if (type == SVG_TRANSFORM_UNKNOWN) | 124 if (type == SVG_TRANSFORM_UNKNOWN) |
125 return 0; | 125 return nullptr; |
126 | 126 |
127 int valueCount = 0; | 127 int valueCount = 0; |
128 float values[] = {0, 0, 0, 0, 0, 0}; | 128 float values[] = {0, 0, 0, 0, 0, 0}; |
129 if ((valueCount = parseTransformParamList(ptr, end, values, requiredValuesFo
rType[type], optionalValuesForType[type])) < 0) { | 129 if ((valueCount = parseTransformParamList(ptr, end, values, requiredValuesFo
rType[type], optionalValuesForType[type])) < 0) { |
130 return 0; | 130 return nullptr; |
131 } | 131 } |
132 | 132 |
133 RefPtr<SVGTransform> transform = SVGTransform::create(); | 133 RefPtr<SVGTransform> transform = SVGTransform::create(); |
134 | 134 |
135 switch (type) { | 135 switch (type) { |
136 case SVG_TRANSFORM_SKEWX: | 136 case SVG_TRANSFORM_SKEWX: |
137 transform->setSkewX(values[0]); | 137 transform->setSkewX(values[0]); |
138 break; | 138 break; |
139 case SVG_TRANSFORM_SKEWY: | 139 case SVG_TRANSFORM_SKEWY: |
140 transform->setSkewY(values[0]); | 140 transform->setSkewY(values[0]); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 | 252 |
253 if (!valid) { | 253 if (!valid) { |
254 clear(); | 254 clear(); |
255 exceptionState.throwDOMException(SyntaxError, "Problem parsing transform
list=\""+value+"\""); | 255 exceptionState.throwDOMException(SyntaxError, "Problem parsing transform
list=\""+value+"\""); |
256 } | 256 } |
257 } | 257 } |
258 | 258 |
259 PassRefPtr<NewSVGPropertyBase> SVGTransformList::cloneForAnimation(const String&
value) const | 259 PassRefPtr<NewSVGPropertyBase> SVGTransformList::cloneForAnimation(const String&
value) const |
260 { | 260 { |
261 ASSERT_NOT_REACHED(); | 261 ASSERT_NOT_REACHED(); |
262 return 0; | 262 return nullptr; |
263 } | 263 } |
264 | 264 |
265 PassRefPtr<SVGTransformList> SVGTransformList::create(SVGTransformType transform
Type, const String& value) | 265 PassRefPtr<SVGTransformList> SVGTransformList::create(SVGTransformType transform
Type, const String& value) |
266 { | 266 { |
267 RefPtr<SVGTransform> transform; | 267 RefPtr<SVGTransform> transform; |
268 if (value.isEmpty()) { | 268 if (value.isEmpty()) { |
269 } else if (value.is8Bit()) { | 269 } else if (value.is8Bit()) { |
270 const LChar* ptr = value.characters8(); | 270 const LChar* ptr = value.characters8(); |
271 const LChar* end = ptr + value.length(); | 271 const LChar* end = ptr + value.length(); |
272 transform = parseTransformOfType(transformType, ptr, end); | 272 transform = parseTransformOfType(transformType, ptr, end); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 if (at(0)->transformType() == toList->at(0)->transformType()) | 347 if (at(0)->transformType() == toList->at(0)->transformType()) |
348 return -1; | 348 return -1; |
349 | 349 |
350 // Spec: http://www.w3.org/TR/SVG/animate.html#complexDistances | 350 // Spec: http://www.w3.org/TR/SVG/animate.html#complexDistances |
351 // Paced animations assume a notion of distance between the various animatio
n values defined by the ‘to’, ‘from’, ‘by’ and ‘values’ attributes. | 351 // Paced animations assume a notion of distance between the various animatio
n values defined by the ‘to’, ‘from’, ‘by’ and ‘values’ attributes. |
352 // Distance is defined only for scalar types (such as <length>), colors and
the subset of transformation types that are supported by ‘animateTransform’. | 352 // Distance is defined only for scalar types (such as <length>), colors and
the subset of transformation types that are supported by ‘animateTransform’. |
353 return SVGTransformDistance(at(0), toList->at(0)).distance(); | 353 return SVGTransformDistance(at(0), toList->at(0)).distance(); |
354 } | 354 } |
355 | 355 |
356 } | 356 } |
OLD | NEW |