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

Side by Side Diff: Source/core/svg/SVGParserUtilities.cpp

Issue 132233016: [SVG] SVGAnimatedPointList migration to new SVG property impl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: set NeedsRebaseline Created 6 years, 11 months 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/svg/SVGParserUtilities.h ('k') | Source/core/svg/SVGPathElement.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2002, 2003 The Karbon Developers 2 * Copyright (C) 2002, 2003 The Karbon Developers
3 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org> 3 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org>
4 * Copyright (C) 2006, 2007 Rob Buis <buis@kde.org> 4 * Copyright (C) 2006, 2007 Rob Buis <buis@kde.org>
5 * Copyright (C) 2007, 2009, 2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2007, 2009, 2013 Apple Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 const LChar* ptr = string.characters8(); 231 const LChar* ptr = string.characters8();
232 const LChar* end = ptr + string.length(); 232 const LChar* end = ptr + string.length();
233 return genericParseNumberOptionalNumber(ptr, end, x, y); 233 return genericParseNumberOptionalNumber(ptr, end, x, y);
234 } 234 }
235 const UChar* ptr = string.characters16(); 235 const UChar* ptr = string.characters16();
236 const UChar* end = ptr + string.length(); 236 const UChar* end = ptr + string.length();
237 return genericParseNumberOptionalNumber(ptr, end, x, y); 237 return genericParseNumberOptionalNumber(ptr, end, x, y);
238 } 238 }
239 239
240 template<typename CharType> 240 template<typename CharType>
241 static bool genericParseRect(const CharType*& ptr, const CharType* end, FloatRec t& rect)
242 {
243 skipOptionalSVGSpaces(ptr, end);
244
245 float x = 0;
246 float y = 0;
247 float width = 0;
248 float height = 0;
249 bool valid = parseNumber(ptr, end, x) && parseNumber(ptr, end, y) && parseNu mber(ptr, end, width) && parseNumber(ptr, end, height, false);
250 rect = FloatRect(x, y, width, height);
251 return valid;
252 }
253
254 bool parseRect(const String& string, FloatRect& rect)
255 {
256 if (string.isEmpty())
257 return false;
258 if (string.is8Bit()) {
259 const LChar* ptr = string.characters8();
260 const LChar* end = ptr + string.length();
261 return genericParseRect(ptr, end, rect);
262 }
263 const UChar* ptr = string.characters16();
264 const UChar* end = ptr + string.length();
265 return genericParseRect(ptr, end, rect);
266 }
267
268 template<typename CharType>
269 static bool genericParsePointsList(SVGPointList& pointsList, const CharType*& pt r, const CharType* end)
270 {
271 skipOptionalSVGSpaces(ptr, end);
272
273 bool delimParsed = false;
274 while (ptr < end) {
275 delimParsed = false;
276 float xPos = 0.0f;
277 if (!parseNumber(ptr, end, xPos))
278 return false;
279
280 float yPos = 0.0f;
281 if (!parseNumber(ptr, end, yPos, false))
282 return false;
283
284 skipOptionalSVGSpaces(ptr, end);
285
286 if (ptr < end && *ptr == ',') {
287 delimParsed = true;
288 ptr++;
289 }
290 skipOptionalSVGSpaces(ptr, end);
291
292 pointsList.append(FloatPoint(xPos, yPos));
293 }
294 return ptr == end && !delimParsed;
295 }
296
297 // FIXME: Why is the out parameter first?
298 bool pointsListFromSVGData(SVGPointList& pointsList, const String& points)
299 {
300 if (points.isEmpty())
301 return true;
302 if (points.is8Bit()) {
303 const LChar* ptr = points.characters8();
304 const LChar* end = ptr + points.length();
305 return genericParsePointsList(pointsList, ptr, end);
306 }
307 const UChar* ptr = points.characters16();
308 const UChar* end = ptr + points.length();
309 return genericParsePointsList(pointsList, ptr, end);
310 }
311
312 template<typename CharType>
313 static bool parseGlyphName(const CharType*& ptr, const CharType* end, HashSet<St ring>& values) 241 static bool parseGlyphName(const CharType*& ptr, const CharType* end, HashSet<St ring>& values)
314 { 242 {
315 skipOptionalSVGSpaces(ptr, end); 243 skipOptionalSVGSpaces(ptr, end);
316 244
317 while (ptr < end) { 245 while (ptr < end) {
318 // Leading and trailing white space, and white space before and after se parators, will be ignored. 246 // Leading and trailing white space, and white space before and after se parators, will be ignored.
319 const CharType* inputStart = ptr; 247 const CharType* inputStart = ptr;
320 while (ptr < end && *ptr != ',') 248 while (ptr < end && *ptr != ',')
321 ++ptr; 249 ++ptr;
322 250
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 { 686 {
759 return parseTransformAttributeInternal(list, ptr, end, mode); 687 return parseTransformAttributeInternal(list, ptr, end, mode);
760 } 688 }
761 689
762 bool parseTransformAttribute(SVGTransformList& list, const UChar*& ptr, const UC har* end, TransformParsingMode mode) 690 bool parseTransformAttribute(SVGTransformList& list, const UChar*& ptr, const UC har* end, TransformParsingMode mode)
763 { 691 {
764 return parseTransformAttributeInternal(list, ptr, end, mode); 692 return parseTransformAttributeInternal(list, ptr, end, mode);
765 } 693 }
766 694
767 } 695 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGParserUtilities.h ('k') | Source/core/svg/SVGPathElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698