-
Notifications
You must be signed in to change notification settings - Fork 16
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
Should we do percentage height quirk for calc()? #48
Comments
I haven't seen any compat issues with that, fwiw. And I think making |
For things like this we often see compat issues with mobile specific sites. Also FWIW Firefox actually does support this, e.g. This is obviously due to the engine simplifying calc(100% + 0px) to 100%, however this super confusing to the web developer who expects calc(100% + 0px) and calc(100% + 1px) to act in the same way. @emilio Given the above any objection to changing the spec&Firefox to match the other implementations? |
Per spec |
And I intentionally changed the behavior of that particular test-case in https://bugzilla.mozilla.org/show_bug.cgi?id=1577139, per the resolution in w3c/csswg-drafts#3482. |
But you agree that as far as the web-developer is concerned, the layout result of calc(x% + y px) should behave the same way irregardless of the the values of x and y? |
That is not always compatible with the above discussion, see http://w3c-test.org/css/css-tables/calc-percent-plus-0px-auto.html for a simple example where Chromium agrees with Firefox. I don't feel too strongly about this, but I think that lacking evidence that it can cause compat problems, introducing quirks in calc() expressions is a bit unfortunate. |
I'm ok if we do this in the name of "shortest path to interop", but I think this is a bit sad :/ |
I'm pretty convinced this more explainable/sane to web-developers than what is currently spec'd given above, but can dub this "shortest path to interop" if you like :). |
The intent was to not apply the quirk when For quirks, optimizing for explainability to web developers is a non-goal. Web developers shouldn't use quirks mode and don't need to understand them. The goals are https://quirks.spec.whatwg.org/#goals [snip the first two, since we know the quirk as a whole is needed for web compat]
We don't currently have interop on this quirk.
This is what excluding I don't understand the details of how So I think there are two paths:
(2) is less effort overall and maybe avoids some implementation complexity (?), but we miss out on the goal to limit this quirk. |
I agree with scoping the quirk down, and I'm good with the outcome of w3c/csswg-drafts#3482. |
@emilio Firefox isn't consistent with itself wrt. heights here - for example: @zcorpan Implementing this non-quirk quirk is surprisingly(!) difficult in our new (LayoutNG) implementation. There are now 4 different percentages which heights can resolve against if this is the case.
I'm not sure I agree that "explainability to web developers is a non-goal". Maybe it should be? At the end of the day web-developers are our end-users/customers, and would be sad if we made these types of quirks on the web even more confusing. @smfr I'm happy for the WebKit team to investigate the potential compat issues. I can mark our bug as blocking on any WebKit behaviour change. |
Can you elaborate? What should I see? I know of differences with other browsers related to percentages inside table cells, like https://bugzilla.mozilla.org/show_bug.cgi?id=1542098. I think that's what is going on in that test-case. But that's not related to this quirk at all. |
Ah you're totally right. We use It seems the |
That's certainly a good argument against special-casing @smfr and @emilio what is the implementation complexity in WebKit and Gecko/Servo to exclude all |
It's not terribly complex. we intentionally don't differentiate between a calc or not since https://bugzilla.mozilla.org/show_bug.cgi?id=1577139, though we could re-introduce it... That being said, I think given Firefox is inconsistent, and Blink and WebKit do treat calc-with-percentages the same as percentages, I think I'm with @bfgeek that the esiest thing is for Firefox to change. It kinda sucks, but the behavior for replaced elements has been consistent across all browsers since calc() existed... |
The chromium issue was closed:
https://bugs.chromium.org/p/chromium/issues/detail?id=388892#c22 |
I think the change would be to replace
with something like (cc @tabatkins )
Here's the relevant test: https://github.com/web-platform-tests/wpt/blob/master/quirks/percentage-height-calculation.html |
Yes, that should work. It's a little handwavey, but understandable. |
The spec applies percentage height quirk only when
which means we should apply the quirk for % heights but shouldn't for calc(length + %) heights.
Currently, only Firefox does that. Chrome, EdgeHTML and Safari apply the quirk also on calc() heights.
Should we change the spec to match the behavior of Chrome & Edge & Safari?
Also @bfgeek @bzbarsky @lilles from the related Chromium bug https://crbug.com/388892
The text was updated successfully, but these errors were encountered: