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

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

Issue 1588993005: Extended error reporting for SVG attribute parsing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: TestExpectations Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2007, 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 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2010. 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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 if (unitType == SVGAngle::SVG_ANGLETYPE_UNKNOWN) 230 if (unitType == SVGAngle::SVG_ANGLETYPE_UNKNOWN)
231 return false; 231 return false;
232 232
233 return true; 233 return true;
234 } 234 }
235 235
236 SVGParsingError SVGAngle::setValueAsString(const String& value) 236 SVGParsingError SVGAngle::setValueAsString(const String& value)
237 { 237 {
238 if (value.isEmpty()) { 238 if (value.isEmpty()) {
239 newValueSpecifiedUnits(SVG_ANGLETYPE_UNSPECIFIED, 0); 239 newValueSpecifiedUnits(SVG_ANGLETYPE_UNSPECIFIED, 0);
240 return NoError; 240 return SVGStatus::NoError;
241 } 241 }
242 242
243 if (value == "auto") { 243 if (value == "auto") {
244 newValueSpecifiedUnits(SVG_ANGLETYPE_UNSPECIFIED, 0); 244 newValueSpecifiedUnits(SVG_ANGLETYPE_UNSPECIFIED, 0);
245 m_orientType->setEnumValue(SVGMarkerOrientAuto); 245 m_orientType->setEnumValue(SVGMarkerOrientAuto);
246 return NoError; 246 return SVGStatus::NoError;
247 } 247 }
248 if (value == "auto-start-reverse") { 248 if (value == "auto-start-reverse") {
249 newValueSpecifiedUnits(SVG_ANGLETYPE_UNSPECIFIED, 0); 249 newValueSpecifiedUnits(SVG_ANGLETYPE_UNSPECIFIED, 0);
250 m_orientType->setEnumValue(SVGMarkerOrientAutoStartReverse); 250 m_orientType->setEnumValue(SVGMarkerOrientAutoStartReverse);
251 return NoError; 251 return SVGStatus::NoError;
252 } 252 }
253 253
254 float valueInSpecifiedUnits = 0; 254 float valueInSpecifiedUnits = 0;
255 SVGAngleType unitType = SVG_ANGLETYPE_UNKNOWN; 255 SVGAngleType unitType = SVG_ANGLETYPE_UNKNOWN;
256 256
257 bool success = value.is8Bit() ? parseValue<LChar>(value, valueInSpecifiedUni ts, unitType) 257 bool success = value.is8Bit() ? parseValue<LChar>(value, valueInSpecifiedUni ts, unitType)
258 : parseValue<UChar>(value, valueInSpecifiedUni ts, unitType); 258 : parseValue<UChar>(value, valueInSpecifiedUni ts, unitType);
259 if (!success) 259 if (!success)
260 return ParsingAttributeFailedError; 260 return SVGStatus::ParsingFailed;
261 261
262 m_orientType->setEnumValue(SVGMarkerOrientAngle); 262 m_orientType->setEnumValue(SVGMarkerOrientAngle);
263 m_unitType = unitType; 263 m_unitType = unitType;
264 m_valueInSpecifiedUnits = valueInSpecifiedUnits; 264 m_valueInSpecifiedUnits = valueInSpecifiedUnits;
265 return NoError; 265 return SVGStatus::NoError;
266 } 266 }
267 267
268 void SVGAngle::newValueSpecifiedUnits(SVGAngleType unitType, float valueInSpecif iedUnits) 268 void SVGAngle::newValueSpecifiedUnits(SVGAngleType unitType, float valueInSpecif iedUnits)
269 { 269 {
270 m_orientType->setEnumValue(SVGMarkerOrientAngle); 270 m_orientType->setEnumValue(SVGMarkerOrientAngle);
271 m_unitType = unitType; 271 m_unitType = unitType;
272 m_valueInSpecifiedUnits = valueInSpecifiedUnits; 272 m_valueInSpecifiedUnits = valueInSpecifiedUnits;
273 } 273 }
274 274
275 void SVGAngle::convertToSpecifiedUnits(SVGAngleType unitType) 275 void SVGAngle::convertToSpecifiedUnits(SVGAngleType unitType)
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 432
433 void SVGAngle::orientTypeChanged() 433 void SVGAngle::orientTypeChanged()
434 { 434 {
435 if (orientType()->enumValue() == SVGMarkerOrientAuto || orientType()->enumVa lue() == SVGMarkerOrientAutoStartReverse) { 435 if (orientType()->enumValue() == SVGMarkerOrientAuto || orientType()->enumVa lue() == SVGMarkerOrientAutoStartReverse) {
436 m_unitType = SVG_ANGLETYPE_UNSPECIFIED; 436 m_unitType = SVG_ANGLETYPE_UNSPECIFIED;
437 m_valueInSpecifiedUnits = 0; 437 m_valueInSpecifiedUnits = 0;
438 } 438 }
439 } 439 }
440 440
441 } 441 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698