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

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGTransformList.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 4 years, 12 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
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, 2007 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2008 Apple Inc. All rights reserved. 5 * Copyright (C) 2008 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2012. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2012. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 while (it != itEnd) { 259 while (it != itEnd) {
260 builder.append(it->valueAsString()); 260 builder.append(it->valueAsString());
261 ++it; 261 ++it;
262 if (it != itEnd) 262 if (it != itEnd)
263 builder.append(' '); 263 builder.append(' ');
264 } 264 }
265 265
266 return builder.toString(); 266 return builder.toString();
267 } 267 }
268 268
269 void SVGTransformList::setValueAsString(const String& value, ExceptionState& exc eptionState) 269 SVGParsingError SVGTransformList::setValueAsString(const String& value)
270 { 270 {
271 if (value.isEmpty()) { 271 if (value.isEmpty()) {
272 clear(); 272 clear();
273 return; 273 return NoError;
274 } 274 }
275 275
276 bool valid = false; 276 bool valid = false;
277 if (value.is8Bit()) { 277 if (value.is8Bit()) {
278 const LChar* ptr = value.characters8(); 278 const LChar* ptr = value.characters8();
279 const LChar* end = ptr + value.length(); 279 const LChar* end = ptr + value.length();
280 valid = parse(ptr, end); 280 valid = parse(ptr, end);
281 } else { 281 } else {
282 const UChar* ptr = value.characters16(); 282 const UChar* ptr = value.characters16();
283 const UChar* end = ptr + value.length(); 283 const UChar* end = ptr + value.length();
284 valid = parse(ptr, end); 284 valid = parse(ptr, end);
285 } 285 }
286 286
287 if (!valid) { 287 if (!valid) {
288 clear(); 288 clear();
289 exceptionState.throwDOMException(SyntaxError, "Problem parsing transform list=\""+value+"\""); 289 return ParsingAttributeFailedError;
290 } 290 }
291
292 return NoError;
291 } 293 }
292 294
293 PassRefPtrWillBeRawPtr<SVGPropertyBase> SVGTransformList::cloneForAnimation(cons t String& value) const 295 PassRefPtrWillBeRawPtr<SVGPropertyBase> SVGTransformList::cloneForAnimation(cons t String& value) const
294 { 296 {
295 ASSERT(RuntimeEnabledFeatures::webAnimationsSVGEnabled()); 297 ASSERT(RuntimeEnabledFeatures::webAnimationsSVGEnabled());
296 return SVGListPropertyHelper::cloneForAnimation(value); 298 return SVGListPropertyHelper::cloneForAnimation(value);
297 } 299 }
298 300
299 PassRefPtrWillBeRawPtr<SVGTransformList> SVGTransformList::create(SVGTransformTy pe transformType, const String& value) 301 PassRefPtrWillBeRawPtr<SVGTransformList> SVGTransformList::create(SVGTransformTy pe transformType, const String& value)
300 { 302 {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 if (at(0)->transformType() == toList->at(0)->transformType()) 388 if (at(0)->transformType() == toList->at(0)->transformType())
387 return -1; 389 return -1;
388 390
389 // Spec: http://www.w3.org/TR/SVG/animate.html#complexDistances 391 // Spec: http://www.w3.org/TR/SVG/animate.html#complexDistances
390 // Paced animations assume a notion of distance between the various animatio n values defined by the 'to', 'from', 'by' and 'values' attributes. 392 // Paced animations assume a notion of distance between the various animatio n values defined by the 'to', 'from', 'by' and 'values' attributes.
391 // Distance is defined only for scalar types (such as <length>), colors and the subset of transformation types that are supported by 'animateTransform'. 393 // Distance is defined only for scalar types (such as <length>), colors and the subset of transformation types that are supported by 'animateTransform'.
392 return SVGTransformDistance(at(0), toList->at(0)).distance(); 394 return SVGTransformDistance(at(0), toList->at(0)).distance();
393 } 395 }
394 396
395 } 397 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698