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

Unified Diff: third_party/WebKit/Source/core/svg/SVGLengthTearOff.cpp

Issue 2097383002: Added support of calc() for SVGLength (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
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();
}

Powered by Google App Engine
This is Rietveld 408576698