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

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

Issue 1412713004: Hoist some pre-condition checks out of SVGAngle/SVGEnumeration (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 m_valueInSpecifiedUnits = valueInSpecifiedUnits; 270 m_valueInSpecifiedUnits = valueInSpecifiedUnits;
271 } 271 }
272 272
273 void SVGAngle::newValueSpecifiedUnits(SVGAngleType unitType, float valueInSpecif iedUnits) 273 void SVGAngle::newValueSpecifiedUnits(SVGAngleType unitType, float valueInSpecif iedUnits)
274 { 274 {
275 m_orientType->setEnumValue(SVGMarkerOrientAngle); 275 m_orientType->setEnumValue(SVGMarkerOrientAngle);
276 m_unitType = unitType; 276 m_unitType = unitType;
277 m_valueInSpecifiedUnits = valueInSpecifiedUnits; 277 m_valueInSpecifiedUnits = valueInSpecifiedUnits;
278 } 278 }
279 279
280 void SVGAngle::convertToSpecifiedUnits(SVGAngleType unitType, ExceptionState& ex ceptionState) 280 void SVGAngle::convertToSpecifiedUnits(SVGAngleType unitType)
281 { 281 {
282 if (m_unitType == SVG_ANGLETYPE_UNKNOWN) {
283 exceptionState.throwDOMException(NotSupportedError, "Cannot convert from unknown or invalid units.");
284 return;
285 }
286
287 if (unitType == m_unitType) 282 if (unitType == m_unitType)
288 return; 283 return;
289 284
290 switch (m_unitType) { 285 switch (m_unitType) {
291 case SVG_ANGLETYPE_TURN: 286 case SVG_ANGLETYPE_TURN:
292 switch (unitType) { 287 switch (unitType) {
293 case SVG_ANGLETYPE_GRAD: 288 case SVG_ANGLETYPE_GRAD:
294 m_valueInSpecifiedUnits = turn2grad(m_valueInSpecifiedUnits); 289 m_valueInSpecifiedUnits = turn2grad(m_valueInSpecifiedUnits);
295 break; 290 break;
296 case SVG_ANGLETYPE_UNSPECIFIED: 291 case SVG_ANGLETYPE_UNSPECIFIED:
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 437
443 void SVGAngle::orientTypeChanged() 438 void SVGAngle::orientTypeChanged()
444 { 439 {
445 if (orientType()->enumValue() == SVGMarkerOrientAuto || orientType()->enumVa lue() == SVGMarkerOrientAutoStartReverse) { 440 if (orientType()->enumValue() == SVGMarkerOrientAuto || orientType()->enumVa lue() == SVGMarkerOrientAutoStartReverse) {
446 m_unitType = SVG_ANGLETYPE_UNSPECIFIED; 441 m_unitType = SVG_ANGLETYPE_UNSPECIFIED;
447 m_valueInSpecifiedUnits = 0; 442 m_valueInSpecifiedUnits = 0;
448 } 443 }
449 } 444 }
450 445
451 } 446 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGAngle.h ('k') | third_party/WebKit/Source/core/svg/SVGAngleTearOff.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698