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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 if (isImmutable()) { | 90 if (isImmutable()) { |
91 exceptionState.throwDOMException(NoModificationAllowedError, "The attrib
ute is read-only."); | 91 exceptionState.throwDOMException(NoModificationAllowedError, "The attrib
ute is read-only."); |
92 return; | 92 return; |
93 } | 93 } |
94 | 94 |
95 if (unitType == SVGAngle::SVG_ANGLETYPE_UNKNOWN || unitType > SVGAngle::SVG_
ANGLETYPE_GRAD) { | 95 if (unitType == SVGAngle::SVG_ANGLETYPE_UNKNOWN || unitType > SVGAngle::SVG_
ANGLETYPE_GRAD) { |
96 exceptionState.throwDOMException(NotSupportedError, "Cannot convert to u
nknown or invalid units (" + String::number(unitType) + ")."); | 96 exceptionState.throwDOMException(NotSupportedError, "Cannot convert to u
nknown or invalid units (" + String::number(unitType) + ")."); |
97 return; | 97 return; |
98 } | 98 } |
99 | 99 |
100 target()->convertToSpecifiedUnits(static_cast<SVGAngle::SVGAngleType>(unitTy
pe), exceptionState); | 100 if (target()->unitType() == SVGAngle::SVG_ANGLETYPE_UNKNOWN) { |
101 if (!exceptionState.hadException()) | 101 exceptionState.throwDOMException(NotSupportedError, "Cannot convert from
unknown or invalid units."); |
102 commitChange(); | 102 return; |
| 103 } |
| 104 |
| 105 target()->convertToSpecifiedUnits(static_cast<SVGAngle::SVGAngleType>(unitTy
pe)); |
| 106 commitChange(); |
103 } | 107 } |
104 | 108 |
105 void SVGAngleTearOff::setValueAsString(const String& value, ExceptionState& exce
ptionState) | 109 void SVGAngleTearOff::setValueAsString(const String& value, ExceptionState& exce
ptionState) |
106 { | 110 { |
107 if (isImmutable()) { | 111 if (isImmutable()) { |
108 exceptionState.throwDOMException(NoModificationAllowedError, "The attrib
ute is read-only."); | 112 exceptionState.throwDOMException(NoModificationAllowedError, "The attrib
ute is read-only."); |
109 return; | 113 return; |
110 } | 114 } |
111 | 115 |
112 String oldValue = target()->valueAsString(); | 116 String oldValue = target()->valueAsString(); |
113 | 117 |
114 target()->setValueAsString(value, exceptionState); | 118 target()->setValueAsString(value, exceptionState); |
115 | 119 |
116 if (!exceptionState.hadException() && !hasExposedAngleUnit()) { | 120 if (!exceptionState.hadException() && !hasExposedAngleUnit()) { |
117 target()->setValueAsString(oldValue, ASSERT_NO_EXCEPTION); // rollback t
o old value | 121 target()->setValueAsString(oldValue, ASSERT_NO_EXCEPTION); // rollback t
o old value |
118 exceptionState.throwDOMException(SyntaxError, "The value provided ('" +
value + "') is invalid."); | 122 exceptionState.throwDOMException(SyntaxError, "The value provided ('" +
value + "') is invalid."); |
119 return; | 123 return; |
120 } | 124 } |
121 | 125 |
122 commitChange(); | 126 commitChange(); |
123 } | 127 } |
124 | 128 |
125 } | 129 } |
OLD | NEW |