OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 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 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 while (ptr < end) { | 62 while (ptr < end) { |
63 float number = 0; | 63 float number = 0; |
64 if (!parseNumber(ptr, end, number)) | 64 if (!parseNumber(ptr, end, number)) |
65 return false; | 65 return false; |
66 append(SVGNumber::create(number)); | 66 append(SVGNumber::create(number)); |
67 } | 67 } |
68 | 68 |
69 return true; | 69 return true; |
70 } | 70 } |
71 | 71 |
72 void SVGNumberList::setValueAsString(const String& value, ExceptionState& except
ionState) | 72 SVGParsingError SVGNumberList::setValueAsString(const String& value) |
73 { | 73 { |
74 if (value.isEmpty()) { | 74 if (value.isEmpty()) { |
75 clear(); | 75 clear(); |
76 return; | 76 return NoError; |
77 } | 77 } |
78 | 78 |
79 bool valid = false; | 79 bool valid = false; |
80 if (value.is8Bit()) { | 80 if (value.is8Bit()) { |
81 const LChar* ptr = value.characters8(); | 81 const LChar* ptr = value.characters8(); |
82 const LChar* end = ptr + value.length(); | 82 const LChar* end = ptr + value.length(); |
83 valid = parse(ptr, end); | 83 valid = parse(ptr, end); |
84 } else { | 84 } else { |
85 const UChar* ptr = value.characters16(); | 85 const UChar* ptr = value.characters16(); |
86 const UChar* end = ptr + value.length(); | 86 const UChar* end = ptr + value.length(); |
87 valid = parse(ptr, end); | 87 valid = parse(ptr, end); |
88 } | 88 } |
89 | 89 |
90 if (!valid) { | 90 if (!valid) { |
91 exceptionState.throwDOMException(SyntaxError, "Problem parsing number li
st \""+value+"\""); | |
92 // No call to |clear()| here. SVG policy is to use valid items before er
ror. | 91 // No call to |clear()| here. SVG policy is to use valid items before er
ror. |
93 // Spec: http://www.w3.org/TR/SVG/single-page.html#implnote-ErrorProcess
ing | 92 // Spec: http://www.w3.org/TR/SVG/single-page.html#implnote-ErrorProcess
ing |
| 93 return ParsingAttributeFailedError; |
94 } | 94 } |
| 95 return NoError; |
95 } | 96 } |
96 | 97 |
97 void SVGNumberList::add(PassRefPtrWillBeRawPtr<SVGPropertyBase> other, SVGElemen
t* contextElement) | 98 void SVGNumberList::add(PassRefPtrWillBeRawPtr<SVGPropertyBase> other, SVGElemen
t* contextElement) |
98 { | 99 { |
99 RefPtrWillBeRawPtr<SVGNumberList> otherList = toSVGNumberList(other); | 100 RefPtrWillBeRawPtr<SVGNumberList> otherList = toSVGNumberList(other); |
100 | 101 |
101 if (length() != otherList->length()) | 102 if (length() != otherList->length()) |
102 return; | 103 return; |
103 | 104 |
104 for (size_t i = 0; i < length(); ++i) | 105 for (size_t i = 0; i < length(); ++i) |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 Vector<float> SVGNumberList::toFloatVector() const | 139 Vector<float> SVGNumberList::toFloatVector() const |
139 { | 140 { |
140 Vector<float> vec; | 141 Vector<float> vec; |
141 vec.reserveInitialCapacity(length()); | 142 vec.reserveInitialCapacity(length()); |
142 for (size_t i = 0; i < length(); ++i) | 143 for (size_t i = 0; i < length(); ++i) |
143 vec.uncheckedAppend(at(i)->value()); | 144 vec.uncheckedAppend(at(i)->value()); |
144 return vec; | 145 return vec; |
145 } | 146 } |
146 | 147 |
147 } | 148 } |
OLD | NEW |