You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Specifically, if root is an operator node that is not a calc-operator node, and there is not enough information to compute its operation, then we end up reaching the end of the algorithm.
For example, if we enter the algorithm with root being min(1em + 2em, 10px), and not enough information to convert an em to px:
Steps 1 and 2 are skipped.
Step 3, "At this point, root is an operator node. Simplify all the calculation children of root." will simplify the sum node. So we get min(3em, 10px).
Step 4 does not have enough information to compute the min() operation, so it's skipped.
No subsequent step handles a min() operation, so we go off the end of the algorithm.
I think the solution is just to add a catch-all final step of "Return root." I'll submit a PR momentarily.
Alternatively, step 4 could gain an "Otherwise, return root" substep. But this is complicated by the requirement to fall through to step 5 for Min and Max nodes. Personally I prefer the simpler solution.
The text was updated successfully, but these errors were encountered:
Agree. I also pointed this out (somewhat confusingly) in #7456:
No value is returned from simplifying a calculation tree when the math function is not min() or max() and all of its calculation children are [not] numeric values with enough information to compute the operation root represents (step 4).
Based on the current css-values-4 simplify a calculation tree algorithm.
Specifically, if
root
is an operator node that is not a calc-operator node, and there is not enough information to compute its operation, then we end up reaching the end of the algorithm.For example, if we enter the algorithm with
root
beingmin(1em + 2em, 10px)
, and not enough information to convert an em to px:min(3em, 10px)
.min()
operation, so it's skipped.min()
operation, so we go off the end of the algorithm.I think the solution is just to add a catch-all final step of "Return root." I'll submit a PR momentarily.
Alternatively, step 4 could gain an "Otherwise, return root" substep. But this is complicated by the requirement to fall through to step 5 for Min and Max nodes. Personally I prefer the simpler solution.
The text was updated successfully, but these errors were encountered: