OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 #include "core/svg/SVGEnumeration.h" | 33 #include "core/svg/SVGEnumeration.h" |
34 | 34 |
35 #include "bindings/v8/ExceptionState.h" | 35 #include "bindings/v8/ExceptionState.h" |
36 #include "bindings/v8/ExceptionStatePlaceholder.h" | 36 #include "bindings/v8/ExceptionStatePlaceholder.h" |
37 #include "core/dom/ExceptionCode.h" | 37 #include "core/dom/ExceptionCode.h" |
38 #include "core/svg/SVGAnimationElement.h" | 38 #include "core/svg/SVGAnimationElement.h" |
39 | 39 |
40 namespace WebCore { | 40 namespace WebCore { |
41 | 41 |
42 inline PassRefPtr<SVGEnumerationBase> toSVGEnumerationBase(PassRefPtr<NewSVGProp
ertyBase> passBase) | 42 inline PassRefPtr<SVGEnumerationBase> toSVGEnumerationBase(PassRefPtr<SVGPropert
yBase> passBase) |
43 { | 43 { |
44 RefPtr<NewSVGPropertyBase> base = passBase; | 44 RefPtr<SVGPropertyBase> base = passBase; |
45 ASSERT(base->type() == SVGEnumerationBase::classType()); | 45 ASSERT(base->type() == SVGEnumerationBase::classType()); |
46 return static_pointer_cast<SVGEnumerationBase>(base.release()); | 46 return static_pointer_cast<SVGEnumerationBase>(base.release()); |
47 } | 47 } |
48 | 48 |
49 SVGEnumerationBase::~SVGEnumerationBase() | 49 SVGEnumerationBase::~SVGEnumerationBase() |
50 { | 50 { |
51 } | 51 } |
52 | 52 |
53 PassRefPtr<NewSVGPropertyBase> SVGEnumerationBase::cloneForAnimation(const Strin
g& value) const | 53 PassRefPtr<SVGPropertyBase> SVGEnumerationBase::cloneForAnimation(const String&
value) const |
54 { | 54 { |
55 RefPtr<SVGEnumerationBase> svgEnumeration = clone(); | 55 RefPtr<SVGEnumerationBase> svgEnumeration = clone(); |
56 svgEnumeration->setValueAsString(value, IGNORE_EXCEPTION); | 56 svgEnumeration->setValueAsString(value, IGNORE_EXCEPTION); |
57 return svgEnumeration.release(); | 57 return svgEnumeration.release(); |
58 } | 58 } |
59 | 59 |
60 String SVGEnumerationBase::valueAsString() const | 60 String SVGEnumerationBase::valueAsString() const |
61 { | 61 { |
62 StringEntries::const_iterator it = m_entries.begin(); | 62 StringEntries::const_iterator it = m_entries.begin(); |
63 StringEntries::const_iterator itEnd = m_entries.end(); | 63 StringEntries::const_iterator itEnd = m_entries.end(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 m_value = it->first; | 95 m_value = it->first; |
96 notifyChange(); | 96 notifyChange(); |
97 return; | 97 return; |
98 } | 98 } |
99 } | 99 } |
100 | 100 |
101 exceptionState.throwDOMException(SyntaxError, "The value provided ('" + stri
ng + "') is invalid."); | 101 exceptionState.throwDOMException(SyntaxError, "The value provided ('" + stri
ng + "') is invalid."); |
102 notifyChange(); | 102 notifyChange(); |
103 } | 103 } |
104 | 104 |
105 void SVGEnumerationBase::add(PassRefPtr<NewSVGPropertyBase>, SVGElement*) | 105 void SVGEnumerationBase::add(PassRefPtr<SVGPropertyBase>, SVGElement*) |
106 { | 106 { |
107 ASSERT_NOT_REACHED(); | 107 ASSERT_NOT_REACHED(); |
108 } | 108 } |
109 | 109 |
110 void SVGEnumerationBase::calculateAnimatedValue(SVGAnimationElement* animationEl
ement, float percentage, unsigned repeatCount, PassRefPtr<NewSVGPropertyBase> fr
om, PassRefPtr<NewSVGPropertyBase> to, PassRefPtr<NewSVGPropertyBase>, SVGElemen
t*) | 110 void SVGEnumerationBase::calculateAnimatedValue(SVGAnimationElement* animationEl
ement, float percentage, unsigned repeatCount, PassRefPtr<SVGPropertyBase> from,
PassRefPtr<SVGPropertyBase> to, PassRefPtr<SVGPropertyBase>, SVGElement*) |
111 { | 111 { |
112 ASSERT(animationElement); | 112 ASSERT(animationElement); |
113 unsigned short fromEnumeration = animationElement->animationMode() == ToAnim
ation ? m_value : toSVGEnumerationBase(from)->value(); | 113 unsigned short fromEnumeration = animationElement->animationMode() == ToAnim
ation ? m_value : toSVGEnumerationBase(from)->value(); |
114 unsigned short toEnumeration = toSVGEnumerationBase(to)->value(); | 114 unsigned short toEnumeration = toSVGEnumerationBase(to)->value(); |
115 | 115 |
116 animationElement->animateDiscreteType<unsigned short>(percentage, fromEnumer
ation, toEnumeration, m_value); | 116 animationElement->animateDiscreteType<unsigned short>(percentage, fromEnumer
ation, toEnumeration, m_value); |
117 } | 117 } |
118 | 118 |
119 float SVGEnumerationBase::calculateDistance(PassRefPtr<NewSVGPropertyBase>, SVGE
lement*) | 119 float SVGEnumerationBase::calculateDistance(PassRefPtr<SVGPropertyBase>, SVGElem
ent*) |
120 { | 120 { |
121 // No paced animations for boolean. | 121 // No paced animations for boolean. |
122 return -1; | 122 return -1; |
123 } | 123 } |
124 | 124 |
125 } | 125 } |
OLD | NEW |