Wrong background-position with min/max/clamp on percentages
Categories
(Core :: Layout, defect)
Tracking
()
People
(Reporter: eyalgruss, Assigned: emilio)
References
(Regression, )
Details
(Keywords: regression)
Attachments
(1 file)
When using CSS min/max/clamp on percentage values in background-position, the result is wrong in Firefox (works in Chrome).
e.g. min(10%, 100%)
actually takes the larger value.
body {
background-image: url('https://img.freepik.com/free-vector/english-alphabets-many-colors_1308-4763.jpg');
background-size: 200%;
background-position-x: min(10%, 100%);
}
Comment 1•8 months ago
|
||
Gonna guess bug 1709018 initially.
Comment 2•8 months ago
|
||
Set release status flags based on info from the regressing bug 1709018
:emilio, since you are the author of the regressor, bug 1709018, could you take a look? Also, could you set the severity field?
For more information, please visit BugBot documentation.
Assignee | ||
Comment 3•8 months ago
|
||
This is actually the correct behavior, afaict. https://drafts.csswg.org/css-backgrounds-3/#background-position says:
A percentage for the horizontal offset is relative to (width of background positioning area - width of background image).
Since the background-image (due to the background-size) is larger than the background positioning area, the percentage basis is negative. This is precisely the bug bug 1709018 was fixing.
In fact, Chrome and Safari behave like us if you use the background-position shorthand, but not if you use the background-position-x
longhand for some reason.
Assignee | ||
Comment 4•8 months ago
|
||
Will add a test, but the bug itself is invalid.
Assignee | ||
Comment 5•8 months ago
|
||
See https://bugzilla.mozilla.org/show_bug.cgi?id=1874606#c3 (and the
test is self-explanatory, it's just a copy of
background-position-negative-percentage-comparison.html but with the
longhand expanded).
Updated•8 months ago
|
Reporter | ||
Comment 6•8 months ago
|
||
so it seems that instead of clamp(0%, var(--dx), 100%)
one should write clamp(100%, var(--dx), 0%)
Updated•8 months ago
|
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c133f145c344 Add a test for a WebKit / Blink bug where they incorrectly simplify percentages inside calc() in background-position longhands. r=layout-reviewers,jfkthame
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/44397 for changes under testing/web-platform/tests
Comment 10•7 months ago
|
||
bugherder |
Comment 11•7 months ago
|
||
bugherder |
Upstream PR merged by moz-wptsync-bot
Upstream PR merged by moz-wptsync-bot
Description
•