Skip to content

[css-values-4] Issue with calculation simplification and math functions #4372

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
xiaochengh opened this issue Sep 26, 2019 · 2 comments
Closed
Labels
css-values-4 Current Work

Comments

@xiaochengh
Copy link
Contributor

Current spec says:

To simplify a calculation:
...
2. Resolve all multiplications and divisions.
...

However, consider the case where one of the operands is a math function, e.g.,

min(10px, 1em) * 2

In general, multiplications and divisions don't seem resolvable in this case. While we can "merge" the multiplicative factor into a comparison function, this trick doesn't work for other functions.

As a result, the following requirement is also unachievable:

The result must be a summation of unique units and/or math functions.

We might still end up with a complicated expression with math functions as leaf nodes.

aarongable pushed a commit to chromium/chromium that referenced this issue Sep 30, 2019
Current progress:
- Implementation finished
- Test suite finished except for a minor serialization spec issue [1],
  which seems minor enough not to block the launch
- The spec issue with table layout [2] is already resolved. In case of
  similar spec issues in other layout algorithms, I believe a similar
  approach (UA must treat the value as auto) can be adopted.

Therefore, I believe there is no longer any issue blocking the shipping
of the feature.

[1] w3c/csswg-drafts#4372
[2] w3c/csswg-drafts#94

Bug: 825895
Change-Id: I0fe8e934d4429fa6ed1c3dd8847f70b1ba350e07
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1829471
Reviewed-by: Rune Lillesveen <[email protected]>
Reviewed-by: Emil A Eklund <[email protected]>
Commit-Queue: Xiaocheng Hu <[email protected]>
Cr-Commit-Position: refs/heads/master@{#701148}
@tabatkins
Copy link
Member

Yup, that text is pre-functions, and needs to be rewritten substantially. I've got this partially fixed in one of my local repos, and will prioritize finishing it up for you.

@tabatkins tabatkins added the css-values-4 Current Work label Oct 7, 2019
@tabatkins
Copy link
Member

Done. (Missed this one in my closing-spree last week.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css-values-4 Current Work
Projects
None yet
Development

No branches or pull requests

2 participants