| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> |
| 4 * Copyright (C) 2007 Apple Inc. All rights reserved. | 4 * Copyright (C) 2007 Apple Inc. 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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 return; | 251 return; |
| 252 | 252 |
| 253 float convertedNumber = 0; | 253 float convertedNumber = 0; |
| 254 SVGLengthType type = LengthTypeUnknown; | 254 SVGLengthType type = LengthTypeUnknown; |
| 255 | 255 |
| 256 bool success = string.is8Bit() ? | 256 bool success = string.is8Bit() ? |
| 257 parseValueInternal<LChar>(string, convertedNumber, type) : | 257 parseValueInternal<LChar>(string, convertedNumber, type) : |
| 258 parseValueInternal<UChar>(string, convertedNumber, type); | 258 parseValueInternal<UChar>(string, convertedNumber, type); |
| 259 | 259 |
| 260 if (!success) { | 260 if (!success) { |
| 261 es.throwDOMException(SyntaxError); | 261 es.throwUninformativeAndGenericDOMException(SyntaxError); |
| 262 return; | 262 return; |
| 263 } | 263 } |
| 264 | 264 |
| 265 m_unit = storeUnit(extractMode(m_unit), type); | 265 m_unit = storeUnit(extractMode(m_unit), type); |
| 266 m_valueInSpecifiedUnits = convertedNumber; | 266 m_valueInSpecifiedUnits = convertedNumber; |
| 267 } | 267 } |
| 268 | 268 |
| 269 String SVGLength::valueAsString() const | 269 String SVGLength::valueAsString() const |
| 270 { | 270 { |
| 271 return String::number(m_valueInSpecifiedUnits) + lengthTypeToString(extractT
ype(m_unit)); | 271 return String::number(m_valueInSpecifiedUnits) + lengthTypeToString(extractT
ype(m_unit)); |
| 272 } | 272 } |
| 273 | 273 |
| 274 void SVGLength::newValueSpecifiedUnits(unsigned short type, float value, Excepti
onState& es) | 274 void SVGLength::newValueSpecifiedUnits(unsigned short type, float value, Excepti
onState& es) |
| 275 { | 275 { |
| 276 if (type == LengthTypeUnknown || type > LengthTypePC) { | 276 if (type == LengthTypeUnknown || type > LengthTypePC) { |
| 277 es.throwDOMException(NotSupportedError); | 277 es.throwUninformativeAndGenericDOMException(NotSupportedError); |
| 278 return; | 278 return; |
| 279 } | 279 } |
| 280 | 280 |
| 281 m_unit = storeUnit(extractMode(m_unit), toSVGLengthType(type)); | 281 m_unit = storeUnit(extractMode(m_unit), toSVGLengthType(type)); |
| 282 m_valueInSpecifiedUnits = value; | 282 m_valueInSpecifiedUnits = value; |
| 283 } | 283 } |
| 284 | 284 |
| 285 void SVGLength::convertToSpecifiedUnits(unsigned short type, const SVGLengthCont
ext& context, ExceptionState& es) | 285 void SVGLength::convertToSpecifiedUnits(unsigned short type, const SVGLengthCont
ext& context, ExceptionState& es) |
| 286 { | 286 { |
| 287 if (type == LengthTypeUnknown || type > LengthTypePC) { | 287 if (type == LengthTypeUnknown || type > LengthTypePC) { |
| 288 es.throwDOMException(NotSupportedError); | 288 es.throwUninformativeAndGenericDOMException(NotSupportedError); |
| 289 return; | 289 return; |
| 290 } | 290 } |
| 291 | 291 |
| 292 float valueInUserUnits = value(context, es); | 292 float valueInUserUnits = value(context, es); |
| 293 if (es.hadException()) | 293 if (es.hadException()) |
| 294 return; | 294 return; |
| 295 | 295 |
| 296 unsigned int originalUnitAndType = m_unit; | 296 unsigned int originalUnitAndType = m_unit; |
| 297 m_unit = storeUnit(extractMode(m_unit), toSVGLengthType(type)); | 297 m_unit = storeUnit(extractMode(m_unit), toSVGLengthType(type)); |
| 298 setValue(valueInUserUnits, context, es); | 298 setValue(valueInUserUnits, context, es); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 s_lengthModeMap.set(SVGNames::startOffsetAttr, LengthModeWidth); | 427 s_lengthModeMap.set(SVGNames::startOffsetAttr, LengthModeWidth); |
| 428 } | 428 } |
| 429 | 429 |
| 430 if (s_lengthModeMap.contains(attrName)) | 430 if (s_lengthModeMap.contains(attrName)) |
| 431 return s_lengthModeMap.get(attrName); | 431 return s_lengthModeMap.get(attrName); |
| 432 | 432 |
| 433 return LengthModeOther; | 433 return LengthModeOther; |
| 434 } | 434 } |
| 435 | 435 |
| 436 } | 436 } |
| OLD | NEW |