| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 #include "bindings/v8/ExceptionState.h" | 23 #include "bindings/v8/ExceptionState.h" |
| 24 #include "core/svg/properties/SVGAnimatedStaticPropertyTearOff.h" | 24 #include "core/svg/properties/SVGAnimatedStaticPropertyTearOff.h" |
| 25 #include "core/svg/properties/SVGPropertyTraits.h" | 25 #include "core/svg/properties/SVGPropertyTraits.h" |
| 26 | 26 |
| 27 namespace WebCore { | 27 namespace WebCore { |
| 28 | 28 |
| 29 template<typename EnumType> | 29 template<typename EnumType> |
| 30 class SVGAnimatedEnumerationPropertyTearOff : public SVGAnimatedStaticPropertyTe
arOff<unsigned> { | 30 class SVGAnimatedEnumerationPropertyTearOff : public SVGAnimatedStaticPropertyTe
arOff<unsigned> { |
| 31 public: | 31 public: |
| 32 virtual void setBaseVal(const unsigned& property, ExceptionState& es) | 32 virtual void setBaseVal(const unsigned& property, ExceptionState& exceptionS
tate) |
| 33 { | 33 { |
| 34 // All SVG enumeration values, that are allowed to be set via SVG DOM st
art with 1, 0 corresponds to unknown and is not settable through SVG DOM. | 34 // All SVG enumeration values, that are allowed to be set via SVG DOM st
art with 1, 0 corresponds to unknown and is not settable through SVG DOM. |
| 35 if (!property || property > SVGPropertyTraits<EnumType>::highestEnumValu
e()) { | 35 if (!property || property > SVGPropertyTraits<EnumType>::highestEnumValu
e()) { |
| 36 es.throwUninformativeAndGenericTypeError(); | 36 exceptionState.throwUninformativeAndGenericTypeError(); |
| 37 return; | 37 return; |
| 38 } | 38 } |
| 39 SVGAnimatedStaticPropertyTearOff<unsigned>::setBaseVal(property, es); | 39 SVGAnimatedStaticPropertyTearOff<unsigned>::setBaseVal(property, excepti
onState); |
| 40 } | 40 } |
| 41 | 41 |
| 42 static PassRefPtr<SVGAnimatedEnumerationPropertyTearOff<EnumType> > create(S
VGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyT
ype animatedPropertyType, EnumType& property) | 42 static PassRefPtr<SVGAnimatedEnumerationPropertyTearOff<EnumType> > create(S
VGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyT
ype animatedPropertyType, EnumType& property) |
| 43 { | 43 { |
| 44 ASSERT(contextElement); | 44 ASSERT(contextElement); |
| 45 return adoptRef(new SVGAnimatedEnumerationPropertyTearOff<EnumType>(cont
extElement, attributeName, animatedPropertyType, reinterpret_cast<unsigned&>(pro
perty))); | 45 return adoptRef(new SVGAnimatedEnumerationPropertyTearOff<EnumType>(cont
extElement, attributeName, animatedPropertyType, reinterpret_cast<unsigned&>(pro
perty))); |
| 46 } | 46 } |
| 47 | 47 |
| 48 EnumType& currentAnimatedValue() | 48 EnumType& currentAnimatedValue() |
| 49 { | 49 { |
| 50 unsigned& animatedValue = SVGAnimatedStaticPropertyTearOff<unsigned>::cu
rrentAnimatedValue(); | 50 unsigned& animatedValue = SVGAnimatedStaticPropertyTearOff<unsigned>::cu
rrentAnimatedValue(); |
| 51 ASSERT(animatedValue <= SVGPropertyTraits<EnumType>::highestEnumValue())
; | 51 ASSERT(animatedValue <= SVGPropertyTraits<EnumType>::highestEnumValue())
; |
| 52 return reinterpret_cast<EnumType&>(animatedValue); | 52 return reinterpret_cast<EnumType&>(animatedValue); |
| 53 } | 53 } |
| 54 | 54 |
| 55 private: | 55 private: |
| 56 SVGAnimatedEnumerationPropertyTearOff(SVGElement* contextElement, const Qual
ifiedName& attributeName, AnimatedPropertyType animatedPropertyType, unsigned& p
roperty) | 56 SVGAnimatedEnumerationPropertyTearOff(SVGElement* contextElement, const Qual
ifiedName& attributeName, AnimatedPropertyType animatedPropertyType, unsigned& p
roperty) |
| 57 : SVGAnimatedStaticPropertyTearOff<unsigned>(contextElement, attributeNa
me, animatedPropertyType, property) | 57 : SVGAnimatedStaticPropertyTearOff<unsigned>(contextElement, attributeNa
me, animatedPropertyType, property) |
| 58 { | 58 { |
| 59 } | 59 } |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 } | 62 } |
| 63 | 63 |
| 64 #endif // SVGAnimatedEnumerationPropertyTearOff_h | 64 #endif // SVGAnimatedEnumerationPropertyTearOff_h |
| OLD | NEW |