Fix type conversion in calculation constructed by CSS typed OM
Current implementation of CSSMathFunctionValue assumes a simplified expression node tree, where some units are already canonicalized (e.g., angle units are canonicalized into 'deg'). This doesn't hold if the tree is constructed by CSS typed OM. This patch fixes the issue by introducing a safe API CSSMathExpressionNode::ComputeValueInCanonicalUnit(), which evaluates the expression and handles type conversions, and in case of failure, returns nullopt. Bug: 983702 Change-Id: Ib8d5be3731b4b6585913223f11cdd3656eefb486 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1700356Reviewed-by:Anders Hartvoll Ruud <andruud@chromium.org> Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org> Cr-Commit-Position: refs/heads/master@{#678594}
Showing
Please register or sign in to comment