Chromium Code Reviews| Index: third_party/WebKit/Source/core/svg/SVGLengthTearOff.cpp |
| diff --git a/third_party/WebKit/Source/core/svg/SVGLengthTearOff.cpp b/third_party/WebKit/Source/core/svg/SVGLengthTearOff.cpp |
| index ebff1f65177f326445c48f10344a3d3bf6ab2c7d..54756245713394f0e8dcdbf7fe4d3b0fc15572da 100644 |
| --- a/third_party/WebKit/Source/core/svg/SVGLengthTearOff.cpp |
| +++ b/third_party/WebKit/Source/core/svg/SVGLengthTearOff.cpp |
| @@ -104,6 +104,9 @@ inline SVGLengthType toSVGLengthType(CSSPrimitiveValue::UnitType type) |
| bool SVGLengthTearOff::hasExposedLengthUnit() |
| { |
| + if (target()->isCalculated()) |
| + return false; |
| + |
| CSSPrimitiveValue::UnitType unit = target()->typeWithCalcResolved(); |
| return isValidLengthUnit(unit) |
| || unit == CSSPrimitiveValue::UnitType::Unknown |
| @@ -144,12 +147,19 @@ void SVGLengthTearOff::setValue(float value, ExceptionState& exceptionState) |
| } |
| SVGLengthContext lengthContext(contextElement()); |
| - target()->setValue(value, lengthContext); |
| + if (target()->isCalculated()) |
| + target()->setValueAsNumber(value); |
|
fs
2016/07/16 21:13:02
Per the other CL (and current spec text) this woul
Shanmuga Pandi
2016/07/18 13:35:33
As per the spec, It should always "Set the SVGLeng
fs
2016/07/18 13:56:48
Fair enough.
|
| + else |
| + target()->setValue(value, lengthContext); |
| + |
| commitChange(); |
| } |
| float SVGLengthTearOff::valueInSpecifiedUnits() |
| { |
| + if (target()->isCalculated()) |
| + return 0; |
| + |
| return target()->valueInSpecifiedUnits(); |
| } |
| @@ -159,7 +169,12 @@ void SVGLengthTearOff::setValueInSpecifiedUnits(float value, ExceptionState& exc |
| exceptionState.throwDOMException(NoModificationAllowedError, "The attribute is read-only."); |
| return; |
| } |
| - target()->setValueInSpecifiedUnits(value); |
| + |
| + if (target()->isCalculated()) |
| + target()->setValueAsNumber(value); |
| + else |
| + target()->setValueInSpecifiedUnits(value); |
| + |
| commitChange(); |
| } |