| 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/core/v8/ExceptionState.h" | 35 #include "bindings/core/v8/ExceptionState.h" |
| 36 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 36 #include "bindings/core/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 blink { | 40 namespace blink { |
| 41 | 41 |
| 42 inline PassRefPtr<SVGEnumerationBase> toSVGEnumerationBase(PassRefPtr<SVGPropert
yBase> passBase) | 42 inline PassRefPtrWillBeRawPtr<SVGEnumerationBase> toSVGEnumerationBase(PassRefPt
rWillBeRawPtr<SVGPropertyBase> passBase) |
| 43 { | 43 { |
| 44 RefPtr<SVGPropertyBase> base = passBase; | 44 RefPtrWillBeRawPtr<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<SVGPropertyBase> SVGEnumerationBase::cloneForAnimation(const String&
value) const | 53 PassRefPtrWillBeRawPtr<SVGPropertyBase> SVGEnumerationBase::cloneForAnimation(co
nst String& value) const |
| 54 { | 54 { |
| 55 RefPtr<SVGEnumerationBase> svgEnumeration = clone(); | 55 RefPtrWillBeRawPtr<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(); |
| 64 for (; it != itEnd; ++it) { | 64 for (; it != itEnd; ++it) { |
| 65 if (m_value == it->first) | 65 if (m_value == it->first) |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 | 102 |
| 103 exceptionState.throwDOMException(SyntaxError, "The value provided ('" + stri
ng + "') is invalid."); | 103 exceptionState.throwDOMException(SyntaxError, "The value provided ('" + stri
ng + "') is invalid."); |
| 104 notifyChange(); | 104 notifyChange(); |
| 105 } | 105 } |
| 106 | 106 |
| 107 void SVGEnumerationBase::add(PassRefPtrWillBeRawPtr<SVGPropertyBase>, SVGElement
*) | 107 void SVGEnumerationBase::add(PassRefPtrWillBeRawPtr<SVGPropertyBase>, SVGElement
*) |
| 108 { | 108 { |
| 109 ASSERT_NOT_REACHED(); | 109 ASSERT_NOT_REACHED(); |
| 110 } | 110 } |
| 111 | 111 |
| 112 void SVGEnumerationBase::calculateAnimatedValue(SVGAnimationElement* animationEl
ement, float percentage, unsigned repeatCount, PassRefPtr<SVGPropertyBase> from,
PassRefPtr<SVGPropertyBase> to, PassRefPtr<SVGPropertyBase>, SVGElement*) | 112 void SVGEnumerationBase::calculateAnimatedValue(SVGAnimationElement* animationEl
ement, float percentage, unsigned repeatCount, PassRefPtrWillBeRawPtr<SVGPropert
yBase> from, PassRefPtrWillBeRawPtr<SVGPropertyBase> to, PassRefPtrWillBeRawPtr<
SVGPropertyBase>, SVGElement*) |
| 113 { | 113 { |
| 114 ASSERT(animationElement); | 114 ASSERT(animationElement); |
| 115 unsigned short fromEnumeration = animationElement->animationMode() == ToAnim
ation ? m_value : toSVGEnumerationBase(from)->value(); | 115 unsigned short fromEnumeration = animationElement->animationMode() == ToAnim
ation ? m_value : toSVGEnumerationBase(from)->value(); |
| 116 unsigned short toEnumeration = toSVGEnumerationBase(to)->value(); | 116 unsigned short toEnumeration = toSVGEnumerationBase(to)->value(); |
| 117 | 117 |
| 118 animationElement->animateDiscreteType<unsigned short>(percentage, fromEnumer
ation, toEnumeration, m_value); | 118 animationElement->animateDiscreteType<unsigned short>(percentage, fromEnumer
ation, toEnumeration, m_value); |
| 119 } | 119 } |
| 120 | 120 |
| 121 float SVGEnumerationBase::calculateDistance(PassRefPtr<SVGPropertyBase>, SVGElem
ent*) | 121 float SVGEnumerationBase::calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBa
se>, SVGElement*) |
| 122 { | 122 { |
| 123 // No paced animations for boolean. | 123 // No paced animations for boolean. |
| 124 return -1; | 124 return -1; |
| 125 } | 125 } |
| 126 | 126 |
| 127 } | 127 } |
| OLD | NEW |