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

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

Issue 303263008: [SVG2] Add support for the 'turn' unit in <angle>. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: compilefix :P Created 6 years, 6 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) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 commitChange(); 68 commitChange();
69 } 69 }
70 70
71 void SVGAngleTearOff::newValueSpecifiedUnits(unsigned short unitType, float valu eInSpecifiedUnits, ExceptionState& exceptionState) 71 void SVGAngleTearOff::newValueSpecifiedUnits(unsigned short unitType, float valu eInSpecifiedUnits, ExceptionState& exceptionState)
72 { 72 {
73 if (isImmutable()) { 73 if (isImmutable()) {
74 exceptionState.throwDOMException(NoModificationAllowedError, "The attrib ute is read-only."); 74 exceptionState.throwDOMException(NoModificationAllowedError, "The attrib ute is read-only.");
75 return; 75 return;
76 } 76 }
77 77
78 if (unitType == SVGAngle::SVG_ANGLETYPE_UNKNOWN || unitType > SVGAngle::SVG_ ANGLETYPE_GRAD) { 78 if (unitType == SVGAngle::SVG_ANGLETYPE_UNKNOWN || unitType > SVGAngle::SVG_ ANGLETYPE_TURN) {
79 exceptionState.throwDOMException(NotSupportedError, "Cannot set value wi th unknown or invalid units (" + String::number(unitType) + ")."); 79 exceptionState.throwDOMException(NotSupportedError, "Cannot set value wi th unknown or invalid units (" + String::number(unitType) + ").");
80 return; 80 return;
81 } 81 }
82 82
83 target()->newValueSpecifiedUnits(static_cast<SVGAngle::SVGAngleType>(unitTyp e), valueInSpecifiedUnits); 83 target()->newValueSpecifiedUnits(static_cast<SVGAngle::SVGAngleType>(unitTyp e), valueInSpecifiedUnits);
84 commitChange(); 84 commitChange();
85 } 85 }
86 86
87 void SVGAngleTearOff::convertToSpecifiedUnits(unsigned short unitType, Exception State& exceptionState) 87 void SVGAngleTearOff::convertToSpecifiedUnits(unsigned short unitType, Exception State& exceptionState)
88 { 88 {
89 if (isImmutable()) { 89 if (isImmutable()) {
90 exceptionState.throwDOMException(NoModificationAllowedError, "The attrib ute is read-only."); 90 exceptionState.throwDOMException(NoModificationAllowedError, "The attrib ute is read-only.");
91 return; 91 return;
92 } 92 }
93 93
94 if (unitType == SVGAngle::SVG_ANGLETYPE_UNKNOWN || unitType > SVGAngle::SVG_ ANGLETYPE_GRAD) { 94 if (unitType == SVGAngle::SVG_ANGLETYPE_UNKNOWN || unitType > SVGAngle::SVG_ ANGLETYPE_TURN) {
95 exceptionState.throwDOMException(NotSupportedError, "Cannot convert to u nknown or invalid units (" + String::number(unitType) + ")."); 95 exceptionState.throwDOMException(NotSupportedError, "Cannot convert to u nknown or invalid units (" + String::number(unitType) + ").");
96 return; 96 return;
97 } 97 }
98 98
99 target()->convertToSpecifiedUnits(static_cast<SVGAngle::SVGAngleType>(unitTy pe), exceptionState); 99 target()->convertToSpecifiedUnits(static_cast<SVGAngle::SVGAngleType>(unitTy pe), exceptionState);
100 if (!exceptionState.hadException()) 100 if (!exceptionState.hadException())
101 commitChange(); 101 commitChange();
102 } 102 }
103 103
104 void SVGAngleTearOff::setValueAsString(const String& value, ExceptionState& exce ptionState) 104 void SVGAngleTearOff::setValueAsString(const String& value, ExceptionState& exce ptionState)
105 { 105 {
106 if (isImmutable()) { 106 if (isImmutable()) {
107 exceptionState.throwDOMException(NoModificationAllowedError, "The attrib ute is read-only."); 107 exceptionState.throwDOMException(NoModificationAllowedError, "The attrib ute is read-only.");
108 return; 108 return;
109 } 109 }
110 110
111 target()->setValueAsString(value, exceptionState); 111 target()->setValueAsString(value, exceptionState);
112 commitChange(); 112 commitChange();
113 } 113 }
114 114
115 } 115 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698