compute method
Implementation
@override
CSSValue? compute([DOMContext? domContext]) {
var valA = CSSValue.from(a);
if (valA == null) return null;
var compA = CSSFunction.computeValue(valA);
if (compA == null) return null;
if (operation != null) {
var valB = CSSValue.from(b!);
if (valB == null) return null;
var compB = CSSFunction.computeValue(valB);
if (compB == null) return null;
if (compA is CSSLength && compB is CSSLength) {
if (compA.unit == compB.unit) {
var val =
computeCalcOperationSymbol(operation!, compA.value, compB.value);
return CSSLength(val, compB.unit);
} else {
return null;
}
} else if (compA is CSSNumber && compB is CSSNumber) {
var val =
computeCalcOperationSymbol(operation!, compA.value!, compB.value!);
return CSSNumber(val);
} else {
return null;
}
}
return compA;
}