| OLD | NEW | 
|---|
| 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 194 | 194 | 
| 195 void SVGLengthTearOff::newValueSpecifiedUnits(unsigned short unitType, | 195 void SVGLengthTearOff::newValueSpecifiedUnits(unsigned short unitType, | 
| 196                                               float valueInSpecifiedUnits, | 196                                               float valueInSpecifiedUnits, | 
| 197                                               ExceptionState& exceptionState) { | 197                                               ExceptionState& exceptionState) { | 
| 198   if (isImmutable()) { | 198   if (isImmutable()) { | 
| 199     throwReadOnly(exceptionState); | 199     throwReadOnly(exceptionState); | 
| 200     return; | 200     return; | 
| 201   } | 201   } | 
| 202   if (!isValidLengthUnit(unitType)) { | 202   if (!isValidLengthUnit(unitType)) { | 
| 203     exceptionState.throwDOMException( | 203     exceptionState.throwDOMException( | 
| 204         NotSupportedError, "Cannot set value with unknown or invalid units (" + | 204         NotSupportedError, | 
| 205                                String::number(unitType) + ")."); | 205         "Cannot set value with unknown or invalid units (" + | 
|  | 206             String::number(unitType) + ")."); | 
| 206     return; | 207     return; | 
| 207   } | 208   } | 
| 208   target()->newValueSpecifiedUnits(toCSSUnitType(unitType), | 209   target()->newValueSpecifiedUnits(toCSSUnitType(unitType), | 
| 209                                    valueInSpecifiedUnits); | 210                                    valueInSpecifiedUnits); | 
| 210   commitChange(); | 211   commitChange(); | 
| 211 } | 212 } | 
| 212 | 213 | 
| 213 void SVGLengthTearOff::convertToSpecifiedUnits(unsigned short unitType, | 214 void SVGLengthTearOff::convertToSpecifiedUnits(unsigned short unitType, | 
| 214                                                ExceptionState& exceptionState) { | 215                                                ExceptionState& exceptionState) { | 
| 215   if (isImmutable()) { | 216   if (isImmutable()) { | 
| 216     throwReadOnly(exceptionState); | 217     throwReadOnly(exceptionState); | 
| 217     return; | 218     return; | 
| 218   } | 219   } | 
| 219   if (!isValidLengthUnit(unitType)) { | 220   if (!isValidLengthUnit(unitType)) { | 
| 220     exceptionState.throwDOMException( | 221     exceptionState.throwDOMException( | 
| 221         NotSupportedError, "Cannot convert to unknown or invalid units (" + | 222         NotSupportedError, | 
| 222                                String::number(unitType) + ")."); | 223         "Cannot convert to unknown or invalid units (" + | 
|  | 224             String::number(unitType) + ")."); | 
| 223     return; | 225     return; | 
| 224   } | 226   } | 
| 225   if ((target()->isRelative() || | 227   if ((target()->isRelative() || | 
| 226        CSSPrimitiveValue::isRelativeUnit(toCSSUnitType(unitType))) && | 228        CSSPrimitiveValue::isRelativeUnit(toCSSUnitType(unitType))) && | 
| 227       !canResolveRelativeUnits(contextElement())) { | 229       !canResolveRelativeUnits(contextElement())) { | 
| 228     exceptionState.throwDOMException(NotSupportedError, | 230     exceptionState.throwDOMException(NotSupportedError, | 
| 229                                      "Could not resolve relative length."); | 231                                      "Could not resolve relative length."); | 
| 230     return; | 232     return; | 
| 231   } | 233   } | 
| 232   SVGLengthContext lengthContext(contextElement()); | 234   SVGLengthContext lengthContext(contextElement()); | 
| 233   target()->convertToSpecifiedUnits(toCSSUnitType(unitType), lengthContext); | 235   target()->convertToSpecifiedUnits(toCSSUnitType(unitType), lengthContext); | 
| 234   commitChange(); | 236   commitChange(); | 
| 235 } | 237 } | 
| 236 | 238 | 
| 237 SVGLengthTearOff::SVGLengthTearOff(SVGLength* target, | 239 SVGLengthTearOff::SVGLengthTearOff(SVGLength* target, | 
| 238                                    SVGElement* contextElement, | 240                                    SVGElement* contextElement, | 
| 239                                    PropertyIsAnimValType propertyIsAnimVal, | 241                                    PropertyIsAnimValType propertyIsAnimVal, | 
| 240                                    const QualifiedName& attributeName) | 242                                    const QualifiedName& attributeName) | 
| 241     : SVGPropertyTearOff<SVGLength>(target, | 243     : SVGPropertyTearOff<SVGLength>(target, | 
| 242                                     contextElement, | 244                                     contextElement, | 
| 243                                     propertyIsAnimVal, | 245                                     propertyIsAnimVal, | 
| 244                                     attributeName) {} | 246                                     attributeName) {} | 
| 245 | 247 | 
| 246 DEFINE_TRACE_WRAPPERS(SVGLengthTearOff) { | 248 DEFINE_TRACE_WRAPPERS(SVGLengthTearOff) { | 
| 247   visitor->traceWrappers(contextElement()); | 249   visitor->traceWrappers(contextElement()); | 
| 248 } | 250 } | 
| 249 | 251 | 
| 250 }  // namespace blink | 252 }  // namespace blink | 
| OLD | NEW | 
|---|