Don't eagerly resolve min() expressions that have a percent value (at least not if the percent value could be resolved against a negative percent basis)
Categories
(Core :: CSS Parsing and Computation, defect)
Tracking
()
People
(Reporter: dholbert, Unassigned)
References
Details
(Keywords: testcase)
Attachments
(1 file)
1.00 KB,
text/html
|
Details |
spinning this off from https://github.com/w3c/csswg-drafts/issues/4227 , where it's pointed out that you can't trivially resolve min(10%,20%)
without knowing whether the percent basis is positive or negative.
It looks like we do eagerly resolve it right now, at least based on the jsfiddle testcase in that github issue. We need to stop doing that.
I'll attach a version of that jsfiddle testcase that shows how our current behavior isn't internally consistent right now.
Reporter | ||
Updated•4 years ago
|
Reporter | ||
Comment 1•4 years ago
|
||
Here's a testcase. We place the image (a star) at the bottom of the element for the first two lines, but we place it at the top for the third one.
Chrome places it at the top for all three, which is the EXPECTED RESULTS.
The only difference in the third one is that it's got a negligible-but-nonzero pixel-valued length component to the arithmetic in the min()
expression, which means it can't be resolved eagerly. This negligible addition in the third line shouldn't affect our behavior, but it does, which is a hint that we're not being consistent.
As described in comment 0 and in the github issue, really none of the expressions can be resolved eagerly, because the percent value could be resolved against a negative percent-basis (as is true in this case).
Comment 2•4 years ago
|
||
Draft test:
http://www.gtalbot.org/BrowserBugsSection/CSS3Backgrounds/background-position-calc-minmax-001.html
I'll try to make more tests later.
Comment 3•4 years ago
|
||
Comment 4•4 years ago
|
||
https://wpt.fyi/results/css/css-backgrounds/background-position-negative-percentage-comparison.html
is the WPT test that Firefox fails .
Reporter | ||
Updated•4 years ago
|
Reporter | ||
Comment 5•4 years ago
|
||
Boris or emilio, maybe you have cycles to take a look?
It looks like we need to revise bug 1609428's code so that we treat <percentage> the same way that we treat <length-percentage> (i.e. decline to simplify the expression in the style system), for min/max/clamp expressions.
Comment 6•4 years ago
|
||
The only negative percent basis is for a <length-percentage>
anyhow right? So we could just not simplify percentages in background-position.
Updated•4 years ago
|
Comment 8•3 years ago
|
||
I get expected results with Firefox 92.0a1 buildID=20210717093616 in tests in #c2, #c3 and #c4 .
Resolving as WORKSFORME
Updated•3 years ago
|
Updated•3 years ago
|
Comment 9•3 years ago
|
||
Web Platform Test pull request:
PR 27716: Added 4 background-position tests with min() max() functions with %tages
https://github.com/web-platform-tests/wpt/pull/27716
Description
•