| 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 11 matching lines...) Expand all Loading... |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 | |
| 33 #include "core/svg/SVGAnimatedEnumerationBase.h" | 32 #include "core/svg/SVGAnimatedEnumerationBase.h" |
| 34 | 33 |
| 35 #include "core/svg/SVGElement.h" | 34 #include "core/svg/SVGElement.h" |
| 36 | 35 |
| 37 namespace blink { | 36 namespace blink { |
| 38 | 37 |
| 39 SVGAnimatedEnumerationBase::~SVGAnimatedEnumerationBase() | 38 SVGAnimatedEnumerationBase::~SVGAnimatedEnumerationBase() |
| 40 { | 39 { |
| 41 } | 40 } |
| 42 | 41 |
| 43 void SVGAnimatedEnumerationBase::setBaseVal(unsigned short value, ExceptionState
& exceptionState) | 42 void SVGAnimatedEnumerationBase::setBaseVal(unsigned short value, ExceptionState
& exceptionState) |
| 44 { | 43 { |
| 45 if (this->isReadOnly()) { | 44 if (this->isReadOnly()) { |
| 46 exceptionState.throwDOMException(NoModificationAllowedError, "The attrib
ute is read-only."); | 45 exceptionState.throwDOMException(NoModificationAllowedError, "The attrib
ute is read-only."); |
| 47 return; | 46 return; |
| 48 } | 47 } |
| 49 | 48 |
| 50 baseValue()->setValue(value, exceptionState); | 49 if (!value) { |
| 51 if (exceptionState.hadException()) | 50 exceptionState.throwTypeError("The enumeration value provided is 0, whic
h is not settable."); |
| 52 return; | 51 return; |
| 52 } |
| 53 |
| 54 if (value > baseValue()->maxExposedEnumValue()) { |
| 55 exceptionState.throwTypeError("The enumeration value provided (" + Strin
g::number(value) + ") is larger than the largest allowed value (" + String::numb
er(baseValue()->maxExposedEnumValue()) + ")."); |
| 56 return; |
| 57 } |
| 58 |
| 59 baseValue()->setValue(value); |
| 53 | 60 |
| 54 m_baseValueUpdated = true; | 61 m_baseValueUpdated = true; |
| 55 | 62 |
| 56 ASSERT(this->attributeName() != QualifiedName::null()); | 63 ASSERT(this->attributeName() != QualifiedName::null()); |
| 57 contextElement()->invalidateSVGAttributes(); | 64 contextElement()->invalidateSVGAttributes(); |
| 58 contextElement()->svgAttributeChanged(this->attributeName()); | 65 contextElement()->svgAttributeChanged(this->attributeName()); |
| 59 } | 66 } |
| 60 | 67 |
| 61 } | 68 } |
| OLD | NEW |