| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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) |
| 66 return it->second; | 66 return it->second; |
| 67 } | 67 } |
| 68 | 68 |
| 69 ASSERT(m_value < maxEnumValue()); | 69 ASSERT(m_value < maxInternalEnumValue()); |
| 70 return emptyString(); | 70 return emptyString(); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void SVGEnumerationBase::setValue(unsigned short value, ExceptionState& exceptio
nState) | 73 void SVGEnumerationBase::setValue(unsigned short value, ExceptionState& exceptio
nState) |
| 74 { | 74 { |
| 75 if (!value) { | 75 if (!value) { |
| 76 exceptionState.throwTypeError("The enumeration value provided is 0, whic
h is not settable."); | 76 exceptionState.throwTypeError("The enumeration value provided is 0, whic
h is not settable."); |
| 77 return; | 77 return; |
| 78 } | 78 } |
| 79 | 79 |
| 80 if (value > maxEnumValue()) { | 80 if (value > maxExposedEnumValue()) { |
| 81 exceptionState.throwTypeError("The enumeration value provided (" + Strin
g::number(value) + ") is larger than the largest allowed value (" + String::numb
er(maxEnumValue()) + ")."); | 81 exceptionState.throwTypeError("The enumeration value provided (" + Strin
g::number(value) + ") is larger than the largest allowed value (" + String::numb
er(maxExposedEnumValue()) + ")."); |
| 82 return; | 82 return; |
| 83 } | 83 } |
| 84 | 84 |
| 85 m_value = value; | 85 m_value = value; |
| 86 notifyChange(); | 86 notifyChange(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 void SVGEnumerationBase::setValueAsString(const String& string, ExceptionState&
exceptionState) | 89 void SVGEnumerationBase::setValueAsString(const String& string, ExceptionState&
exceptionState) |
| 90 { | 90 { |
| 91 StringEntries::const_iterator it = m_entries.begin(); | 91 StringEntries::const_iterator it = m_entries.begin(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 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(PassRefPtr<SVGPropertyBase>, SVGElem
ent*) |
| 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 |