| 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) 2009 Cameron McCormack <cam@mcc.id.au> | 6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> |
| 7 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 7 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| 11 * License as published by the Free Software Foundation; either | 11 * License as published by the Free Software Foundation; either |
| 12 * version 2 of the License, or (at your option) any later version. | 12 * version 2 of the License, or (at your option) any later version. |
| 13 * | 13 * |
| 14 * This library is distributed in the hope that it will be useful, | 14 * This library is distributed in the hope that it will be useful, |
| 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 * Library General Public License for more details. | 17 * Library General Public License for more details. |
| 18 * | 18 * |
| 19 * You should have received a copy of the GNU Library General Public License | 19 * You should have received a copy of the GNU Library General Public License |
| 20 * along with this library; see the file COPYING.LIB. If not, write to | 20 * along with this library; see the file COPYING.LIB. If not, write to |
| 21 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 21 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 22 * Boston, MA 02110-1301, USA. | 22 * Boston, MA 02110-1301, USA. |
| 23 */ | 23 */ |
| 24 | 24 |
| 25 #include "config.h" | 25 #include "config.h" |
| 26 | |
| 27 #include "core/svg/SVGAnimationElement.h" | 26 #include "core/svg/SVGAnimationElement.h" |
| 28 | 27 |
| 28 #include "bindings/core/v8/ExceptionState.h" |
| 29 #include "core/CSSPropertyNames.h" | 29 #include "core/CSSPropertyNames.h" |
| 30 #include "core/SVGNames.h" | 30 #include "core/SVGNames.h" |
| 31 #include "core/css/CSSComputedStyleDeclaration.h" | 31 #include "core/css/CSSComputedStyleDeclaration.h" |
| 32 #include "core/css/parser/CSSParser.h" | 32 #include "core/css/parser/CSSParser.h" |
| 33 #include "core/frame/UseCounter.h" | 33 #include "core/frame/UseCounter.h" |
| 34 #include "core/svg/SVGAnimateElement.h" | 34 #include "core/svg/SVGAnimateElement.h" |
| 35 #include "core/svg/SVGElement.h" | 35 #include "core/svg/SVGElement.h" |
| 36 #include "core/svg/SVGParserUtilities.h" | 36 #include "core/svg/SVGParserUtilities.h" |
| 37 #include "platform/FloatConversion.h" | 37 #include "platform/FloatConversion.h" |
| 38 #include "wtf/MathExtras.h" | 38 #include "wtf/MathExtras.h" |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 | 229 |
| 230 void SVGAnimationElement::animationAttributeChanged() | 230 void SVGAnimationElement::animationAttributeChanged() |
| 231 { | 231 { |
| 232 // Assumptions may not hold after an attribute change. | 232 // Assumptions may not hold after an attribute change. |
| 233 m_animationValid = false; | 233 m_animationValid = false; |
| 234 m_lastValuesAnimationFrom = String(); | 234 m_lastValuesAnimationFrom = String(); |
| 235 m_lastValuesAnimationTo = String(); | 235 m_lastValuesAnimationTo = String(); |
| 236 setInactive(); | 236 setInactive(); |
| 237 } | 237 } |
| 238 | 238 |
| 239 float SVGAnimationElement::getStartTime() const | 239 float SVGAnimationElement::getStartTime(ExceptionState& exceptionState) const |
| 240 { | 240 { |
| 241 return narrowPrecisionToFloat(intervalBegin().value()); | 241 SMILTime startTime = intervalBegin(); |
| 242 if (!startTime.isFinite()) { |
| 243 exceptionState.throwDOMException(InvalidStateError, "No current interval
."); |
| 244 return 0; |
| 245 } |
| 246 return narrowPrecisionToFloat(startTime.value()); |
| 242 } | 247 } |
| 243 | 248 |
| 244 float SVGAnimationElement::getCurrentTime() const | 249 float SVGAnimationElement::getCurrentTime() const |
| 245 { | 250 { |
| 246 return narrowPrecisionToFloat(elapsed().value()); | 251 return narrowPrecisionToFloat(elapsed().value()); |
| 247 } | 252 } |
| 248 | 253 |
| 249 float SVGAnimationElement::getSimpleDuration() const | 254 float SVGAnimationElement::getSimpleDuration(ExceptionState& exceptionState) con
st |
| 250 { | 255 { |
| 251 return narrowPrecisionToFloat(simpleDuration().value()); | 256 SMILTime duration = simpleDuration(); |
| 257 if (!duration.isFinite()) { |
| 258 exceptionState.throwDOMException(NotSupportedError, "No simple duration
defined."); |
| 259 return 0; |
| 260 } |
| 261 return narrowPrecisionToFloat(duration.value()); |
| 252 } | 262 } |
| 253 | 263 |
| 254 void SVGAnimationElement::beginElement() | 264 void SVGAnimationElement::beginElement() |
| 255 { | 265 { |
| 256 beginElementAt(0); | 266 beginElementAt(0); |
| 257 } | 267 } |
| 258 | 268 |
| 259 void SVGAnimationElement::beginElementAt(float offset) | 269 void SVGAnimationElement::beginElementAt(float offset) |
| 260 { | 270 { |
| 261 ASSERT(std::isfinite(offset)); | 271 ASSERT(std::isfinite(offset)); |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 if (!hasInvalidCSSAttributeType) | 722 if (!hasInvalidCSSAttributeType) |
| 713 schedule(); | 723 schedule(); |
| 714 } | 724 } |
| 715 | 725 |
| 716 // Clear values that may depend on the previous target. | 726 // Clear values that may depend on the previous target. |
| 717 if (targetElement()) | 727 if (targetElement()) |
| 718 clearAnimatedType(); | 728 clearAnimatedType(); |
| 719 } | 729 } |
| 720 | 730 |
| 721 } | 731 } |
| OLD | NEW |