| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> |
| 4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 if (!parseNumber(ptr, end, valueInSpecifiedUnits, false)) | 143 if (!parseNumber(ptr, end, valueInSpecifiedUnits, false)) |
| 144 return false; | 144 return false; |
| 145 | 145 |
| 146 unitType = stringToAngleType(ptr, end); | 146 unitType = stringToAngleType(ptr, end); |
| 147 if (unitType == SVGAngle::SVG_ANGLETYPE_UNKNOWN) | 147 if (unitType == SVGAngle::SVG_ANGLETYPE_UNKNOWN) |
| 148 return false; | 148 return false; |
| 149 | 149 |
| 150 return true; | 150 return true; |
| 151 } | 151 } |
| 152 | 152 |
| 153 void SVGAngle::setValueAsString(const String& value, ExceptionState& es) | 153 void SVGAngle::setValueAsString(const String& value, ExceptionState& exceptionSt
ate) |
| 154 { | 154 { |
| 155 if (value.isEmpty()) { | 155 if (value.isEmpty()) { |
| 156 m_unitType = SVG_ANGLETYPE_UNSPECIFIED; | 156 m_unitType = SVG_ANGLETYPE_UNSPECIFIED; |
| 157 return; | 157 return; |
| 158 } | 158 } |
| 159 | 159 |
| 160 float valueInSpecifiedUnits = 0; | 160 float valueInSpecifiedUnits = 0; |
| 161 SVGAngleType unitType = SVG_ANGLETYPE_UNKNOWN; | 161 SVGAngleType unitType = SVG_ANGLETYPE_UNKNOWN; |
| 162 | 162 |
| 163 bool success = value.is8Bit() ? parseValue<LChar>(value, valueInSpecifiedUni
ts, unitType) | 163 bool success = value.is8Bit() ? parseValue<LChar>(value, valueInSpecifiedUni
ts, unitType) |
| 164 : parseValue<UChar>(value, valueInSpecifiedUni
ts, unitType); | 164 : parseValue<UChar>(value, valueInSpecifiedUni
ts, unitType); |
| 165 if (!success) { | 165 if (!success) { |
| 166 es.throwUninformativeAndGenericDOMException(SyntaxError); | 166 exceptionState.throwUninformativeAndGenericDOMException(SyntaxError); |
| 167 return; | 167 return; |
| 168 } | 168 } |
| 169 | 169 |
| 170 m_unitType = unitType; | 170 m_unitType = unitType; |
| 171 m_valueInSpecifiedUnits = valueInSpecifiedUnits; | 171 m_valueInSpecifiedUnits = valueInSpecifiedUnits; |
| 172 } | 172 } |
| 173 | 173 |
| 174 void SVGAngle::newValueSpecifiedUnits(unsigned short unitType, float valueInSpec
ifiedUnits, ExceptionState& es) | 174 void SVGAngle::newValueSpecifiedUnits(unsigned short unitType, float valueInSpec
ifiedUnits, ExceptionState& exceptionState) |
| 175 { | 175 { |
| 176 if (unitType == SVG_ANGLETYPE_UNKNOWN || unitType > SVG_ANGLETYPE_GRAD) { | 176 if (unitType == SVG_ANGLETYPE_UNKNOWN || unitType > SVG_ANGLETYPE_GRAD) { |
| 177 es.throwUninformativeAndGenericDOMException(NotSupportedError); | 177 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro
r); |
| 178 return; | 178 return; |
| 179 } | 179 } |
| 180 | 180 |
| 181 if (unitType != m_unitType) | 181 if (unitType != m_unitType) |
| 182 m_unitType = static_cast<SVGAngleType>(unitType); | 182 m_unitType = static_cast<SVGAngleType>(unitType); |
| 183 | 183 |
| 184 m_valueInSpecifiedUnits = valueInSpecifiedUnits; | 184 m_valueInSpecifiedUnits = valueInSpecifiedUnits; |
| 185 } | 185 } |
| 186 | 186 |
| 187 void SVGAngle::convertToSpecifiedUnits(unsigned short unitType, ExceptionState&
es) | 187 void SVGAngle::convertToSpecifiedUnits(unsigned short unitType, ExceptionState&
exceptionState) |
| 188 { | 188 { |
| 189 if (unitType == SVG_ANGLETYPE_UNKNOWN || m_unitType == SVG_ANGLETYPE_UNKNOWN
|| unitType > SVG_ANGLETYPE_GRAD) { | 189 if (unitType == SVG_ANGLETYPE_UNKNOWN || m_unitType == SVG_ANGLETYPE_UNKNOWN
|| unitType > SVG_ANGLETYPE_GRAD) { |
| 190 es.throwUninformativeAndGenericDOMException(NotSupportedError); | 190 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro
r); |
| 191 return; | 191 return; |
| 192 } | 192 } |
| 193 | 193 |
| 194 if (unitType == m_unitType) | 194 if (unitType == m_unitType) |
| 195 return; | 195 return; |
| 196 | 196 |
| 197 switch (m_unitType) { | 197 switch (m_unitType) { |
| 198 case SVG_ANGLETYPE_RAD: | 198 case SVG_ANGLETYPE_RAD: |
| 199 switch (unitType) { | 199 switch (unitType) { |
| 200 case SVG_ANGLETYPE_GRAD: | 200 case SVG_ANGLETYPE_GRAD: |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 break; | 245 break; |
| 246 case SVG_ANGLETYPE_UNKNOWN: | 246 case SVG_ANGLETYPE_UNKNOWN: |
| 247 ASSERT_NOT_REACHED(); | 247 ASSERT_NOT_REACHED(); |
| 248 break; | 248 break; |
| 249 } | 249 } |
| 250 | 250 |
| 251 m_unitType = static_cast<SVGAngleType>(unitType); | 251 m_unitType = static_cast<SVGAngleType>(unitType); |
| 252 } | 252 } |
| 253 | 253 |
| 254 } | 254 } |
| OLD | NEW |