-
Notifications
You must be signed in to change notification settings - Fork 720
[css-values] Calc serialization algorithm is not web compatible #1731
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
Comments
Hmm, I wonder if we can hack around this and just swap % to the front? The relative ordering is completely unimportant to me, it just sounded nice when I wrote it. |
We could try, I guess, though if we find any other issue we'll have to go with the more conservative approach of what other browsers do. cc @canaltinova |
Well, this workaround seems simple enough but are we sure about not doing what other major browsers do? I can't think of an issue about that but may cause problems in the future? |
Let's try that. We also need to fix other similar calc serialization issues, so if changing that brings other issues we'll fall back to preserve the order of expressions as other browsers. It'd be good to file bugs for other browsers too... |
The "what other browsers do" is just relaying back the precise value the author entered, right? I think we just need to capture that in general, maybe; it seems like browsers do it for most specified values. |
Not really, Gecko does this to some extent, Blink simplifies, but only adjacent expressions... It's quite a mess :) |
Ah, then I think the best approach is indeed to try and do something simple that just happens to be web-compatible. ^_^ |
style: Multiple calc serialization fixes. This puts us in line with the spec as written, except for caveat in w3c/csswg-drafts#1731. Need to fix computed calc() too, I'm less confident that we won't need to change test expectations. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18131) <!-- Reviewable:end -->
style: Multiple calc serialization fixes. This puts us in line with the spec as written, except for caveat in w3c/csswg-drafts#1731. Need to fix computed calc() too, I'm less confident that we won't need to change test expectations. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18131) <!-- Reviewable:end -->
style: Multiple calc serialization fixes. This puts us in line with the spec as written, except for caveat in w3c/csswg-drafts#1731. Need to fix computed calc() too, I'm less confident that we won't need to change test expectations. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18131) <!-- Reviewable:end -->
…emilio:calc-serialization); r=canaltinova This puts us in line with the spec as written, except for caveat in w3c/csswg-drafts#1731. Need to fix computed calc() too, I'm less confident that we won't need to change test expectations. Source-Repo: https://github.com/servo/servo Source-Revision: 92176d1152257e57e81dcd9204d59348ce9ff519 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 0432018b2542dbbba240aeda1c59e0002ad9e6f9
…emilio:calc-serialization); r=canaltinova This puts us in line with the spec as written, except for caveat in w3c/csswg-drafts#1731. Need to fix computed calc() too, I'm less confident that we won't need to change test expectations. Source-Repo: https://github.com/servo/servo Source-Revision: 92176d1152257e57e81dcd9204d59348ce9ff519
…emilio:calc-serialization); r=canaltinova This puts us in line with the spec as written, except for caveat in w3c/csswg-drafts#1731. Need to fix computed calc() too, I'm less confident that we won't need to change test expectations. Source-Repo: https://github.com/servo/servo Source-Revision: 92176d1152257e57e81dcd9204d59348ce9ff519
@tabatkins, could we get the spec updated? Thanks! |
To the workaround I noted (just swapping % to the front)? |
Yup! |
Is there a test for this in web-platform-tests now? This seems especially important for web compat issues. |
@foolip I didn't upstream it in the beginning because the spec was under discussion... But I guess I'll do, just opened servo/servo#19449 |
Thanks @emilio! |
style: Upstream calc serialization test. And test w3c/csswg-drafts#1731 too, since it was fixed. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19449) <!-- Reviewable:end -->
…emilio:calc-serialization); r=canaltinova This puts us in line with the spec as written, except for caveat in w3c/csswg-drafts#1731. Need to fix computed calc() too, I'm less confident that we won't need to change test expectations. Source-Repo: https://github.com/servo/servo Source-Revision: 92176d1152257e57e81dcd9204d59348ce9ff519 UltraBlame original commit: c7832d380dcee31f16bbf2da98ee6cac0002cca4
…emilio:calc-serialization); r=canaltinova This puts us in line with the spec as written, except for caveat in w3c/csswg-drafts#1731. Need to fix computed calc() too, I'm less confident that we won't need to change test expectations. Source-Repo: https://github.com/servo/servo Source-Revision: 92176d1152257e57e81dcd9204d59348ce9ff519 UltraBlame original commit: c7832d380dcee31f16bbf2da98ee6cac0002cca4
…emilio:calc-serialization); r=canaltinova This puts us in line with the spec as written, except for caveat in w3c/csswg-drafts#1731. Need to fix computed calc() too, I'm less confident that we won't need to change test expectations. Source-Repo: https://github.com/servo/servo Source-Revision: 92176d1152257e57e81dcd9204d59348ce9ff519 UltraBlame original commit: c7832d380dcee31f16bbf2da98ee6cac0002cca4
In https://drafts.csswg.org/css-values/#calc-serialize, section 3 says:
Servo implements this, and when testing it on Firefox, we've come across web compat bugs, in particular: https://bugzilla.mozilla.org/show_bug.cgi?id=1390496
That's a case where something has
calc(100% - 2px)
.Blink and Gecko serialize it as written. Servo serializes it as
calc(-2px + 100%)
, following that section of the spec, and the page tries to parse that and messes it up, causing flickering. Not sure about what's Edge's behavior.Needs like we need another algorithm for serializing
calc()
values?The text was updated successfully, but these errors were encountered: