Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGStringList.cpp

Issue 1544673003: Refactor propagation of parsing errors for SVG attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 const CharType* start = ptr; 95 const CharType* start = ptr;
96 while (ptr < end && *ptr != delimiter && !isHTMLSpace<CharType>(*ptr)) 96 while (ptr < end && *ptr != delimiter && !isHTMLSpace<CharType>(*ptr))
97 ptr++; 97 ptr++;
98 if (ptr == start) 98 if (ptr == start)
99 break; 99 break;
100 m_values.append(String(start, ptr - start)); 100 m_values.append(String(start, ptr - start));
101 skipOptionalSVGSpacesOrDelimiter(ptr, end, delimiter); 101 skipOptionalSVGSpacesOrDelimiter(ptr, end, delimiter);
102 } 102 }
103 } 103 }
104 104
105 void SVGStringList::setValueAsString(const String& data, ExceptionState&) 105 SVGParsingError SVGStringList::setValueAsString(const String& data)
106 { 106 {
107 // FIXME: Add more error checking and reporting. 107 // FIXME: Add more error checking and reporting.
108 m_values.clear(); 108 m_values.clear();
109
109 if (data.isEmpty()) 110 if (data.isEmpty())
110 return; 111 return NoError;
112
111 if (data.is8Bit()) { 113 if (data.is8Bit()) {
112 const LChar* ptr = data.characters8(); 114 const LChar* ptr = data.characters8();
113 const LChar* end = ptr + data.length(); 115 const LChar* end = ptr + data.length();
114 parseInternal(ptr, end); 116 parseInternal(ptr, end);
115 } else { 117 } else {
116 const UChar* ptr = data.characters16(); 118 const UChar* ptr = data.characters16();
117 const UChar* end = ptr + data.length(); 119 const UChar* end = ptr + data.length();
118 parseInternal(ptr, end); 120 parseInternal(ptr, end);
119 } 121 }
122 return NoError;
120 } 123 }
121 124
122 String SVGStringList::valueAsString() const 125 String SVGStringList::valueAsString() const
123 { 126 {
124 StringBuilder builder; 127 StringBuilder builder;
125 128
126 Vector<String>::const_iterator it = m_values.begin(); 129 Vector<String>::const_iterator it = m_values.begin();
127 Vector<String>::const_iterator itEnd = m_values.end(); 130 Vector<String>::const_iterator itEnd = m_values.end();
128 if (it != itEnd) { 131 if (it != itEnd) {
129 builder.append(*it); 132 builder.append(*it);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 165
163 float SVGStringList::calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase>, SVGElement*) 166 float SVGStringList::calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase>, SVGElement*)
164 { 167 {
165 // SVGStringList is never animated. 168 // SVGStringList is never animated.
166 ASSERT_NOT_REACHED(); 169 ASSERT_NOT_REACHED();
167 170
168 return -1.0f; 171 return -1.0f;
169 } 172 }
170 173
171 } 174 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698