| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 // Pass false to 'resizeAnimatedListIfNeeded' here, as the special post-mult
iplication behavior of <animateTransform> needs to be respected below. | 109 // Pass false to 'resizeAnimatedListIfNeeded' here, as the special post-mult
iplication behavior of <animateTransform> needs to be respected below. |
| 110 if (!m_animationElement->adjustFromToListValues<SVGTransformList>(fromTransf
ormList, toTransformList, animatedTransformList, percentage, false)) | 110 if (!m_animationElement->adjustFromToListValues<SVGTransformList>(fromTransf
ormList, toTransformList, animatedTransformList, percentage, false)) |
| 111 return; | 111 return; |
| 112 | 112 |
| 113 // Never resize the animatedTransformList to the toTransformList size, inste
ad either clear the list or append to it. | 113 // Never resize the animatedTransformList to the toTransformList size, inste
ad either clear the list or append to it. |
| 114 if (!animatedTransformList.isEmpty() && !m_animationElement->isAdditive()) | 114 if (!animatedTransformList.isEmpty() && !m_animationElement->isAdditive()) |
| 115 animatedTransformList.clear(); | 115 animatedTransformList.clear(); |
| 116 | 116 |
| 117 unsigned fromTransformListSize = fromTransformList.size(); | 117 unsigned fromTransformListSize = fromTransformList.size(); |
| 118 const SVGTransform& toTransform = toTransformList[0]; | 118 const SVGTransform& toTransform = toTransformList[0]; |
| 119 SVGTransform effectiveFrom = fromTransformListSize ? fromTransformList[0] :
SVGTransform(toTransform.type(), SVGTransform::ConstructZeroTransform); | 119 const SVGTransform effectiveFrom = fromTransformListSize ? fromTransformList
[0] : SVGTransform(toTransform.type(), SVGTransform::ConstructZeroTransform); |
| 120 SVGTransform currentTransform = SVGTransformDistance(effectiveFrom, toTransf
orm).scaledDistance(percentage).addToSVGTransform(effectiveFrom); | 120 SVGTransform currentTransform = SVGTransformDistance(effectiveFrom, toTransf
orm).scaledDistance(percentage).addToSVGTransform(effectiveFrom); |
| 121 if (m_animationElement->isAccumulated() && repeatCount) | 121 if (m_animationElement->isAccumulated() && repeatCount) { |
| 122 animatedTransformList.append(SVGTransformDistance::addSVGTransforms(curr
entTransform, toAtEndOfDurationTransformList[0], repeatCount)); | 122 const SVGTransform effectiveToAtEnd = toAtEndOfDurationTransformList.siz
e() ? toAtEndOfDurationTransformList[0] : SVGTransform(toTransform.type(), SVGTr
ansform::ConstructZeroTransform); |
| 123 else | 123 animatedTransformList.append(SVGTransformDistance::addSVGTransforms(curr
entTransform, effectiveToAtEnd, repeatCount)); |
| 124 } else |
| 124 animatedTransformList.append(currentTransform); | 125 animatedTransformList.append(currentTransform); |
| 125 } | 126 } |
| 126 | 127 |
| 127 float SVGAnimatedTransformListAnimator::calculateDistance(const String& fromStri
ng, const String& toString) | 128 float SVGAnimatedTransformListAnimator::calculateDistance(const String& fromStri
ng, const String& toString) |
| 128 { | 129 { |
| 129 ASSERT(m_animationElement); | 130 ASSERT(m_animationElement); |
| 130 | 131 |
| 131 // FIXME: This is not correct in all cases. The spec demands that each compo
nent (translate x and y for example) | 132 // FIXME: This is not correct in all cases. The spec demands that each compo
nent (translate x and y for example) |
| 132 // is paced separately. To implement this we need to treat each component as
individual animation everywhere. | 133 // is paced separately. To implement this we need to treat each component as
individual animation everywhere. |
| 133 OwnPtr<SVGAnimatedType> from = constructFromString(fromString); | 134 OwnPtr<SVGAnimatedType> from = constructFromString(fromString); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 145 | 146 |
| 146 // Spec: http://www.w3.org/TR/SVG/animate.html#complexDistances | 147 // Spec: http://www.w3.org/TR/SVG/animate.html#complexDistances |
| 147 // Paced animations assume a notion of distance between the various animatio
n values defined by the ‘to’, ‘from’, ‘by’ and ‘values’ attributes. | 148 // Paced animations assume a notion of distance between the various animatio
n values defined by the ‘to’, ‘from’, ‘by’ and ‘values’ attributes. |
| 148 // Distance is defined only for scalar types (such as <length>), colors and
the subset of transformation types that are supported by ‘animateTransform’. | 149 // Distance is defined only for scalar types (such as <length>), colors and
the subset of transformation types that are supported by ‘animateTransform’. |
| 149 return SVGTransformDistance(fromTransformList[0], toTransformList[0]).distan
ce(); | 150 return SVGTransformDistance(fromTransformList[0], toTransformList[0]).distan
ce(); |
| 150 } | 151 } |
| 151 | 152 |
| 152 } | 153 } |
| 153 | 154 |
| 154 #endif // ENABLE(SVG) | 155 #endif // ENABLE(SVG) |
| OLD | NEW |