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

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: Rebased 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
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGLengthList.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 c931f6326b19b83a88d7fbee8b9e74b64bd6ab71..f3dabfca2bd2e1bdba58d19ea9e5ecc521a79677 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);
+ 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();
}
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGLengthList.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698