Bug 285451
| Summary: | [css-conditional] Negative cqmin/cqmax units are inverted | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Keith Grant <keithjgrant> |
| Component: | CSS | Assignee: | Tim Nguyen (:ntim) <ntim> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | a_protyasha, koivisto, ntim, sam, simon.fraser, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | Safari 18 | ||
| Hardware: | Mac (Apple Silicon) | ||
| OS: | macOS 14 | ||
| URL: | https://codepen.io/keithjgrant/pen/VYZyWKp | ||
| See Also: | https://github.com/web-platform-tests/wpt/pull/49945 | ||
Keith Grant
Using a negative cqmin value produces the wrong result. It instead behaves as if the units are cqmax.
Reduced test case: https://codepen.io/keithjgrant/pen/VYZyWKp
The same behavior occurs if a positive cqmin value is multiplied by a negative number using calc().
Bug in a production site (position of the dots in the color wheel): https://tools.keithjgrant.com/theme-machine/wheel/
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Keith Grant
note the production site linked above has been patched to no longer rely on negative cqmin values
Tim Nguyen (:ntim)
This is a bug in the original implementation. We use `std::min` to get the min dimension, but that becomes the max with negative values. Same bug happens with cqmax.
https://searchfox.org/wubkat/rev/f4108421a9758cca2331a9e68371afa0ed4ea317/Source/WebCore/css/CSSPrimitiveValue.cpp#917-922
Radar WebKit Bug Importer
<rdar://problem/142456739>
Tim Nguyen (:ntim)
Pull request: https://github.com/WebKit/WebKit/pull/38622
Tim Nguyen (:ntim)
Submitted web-platform-tests pull request: https://github.com/web-platform-tests/wpt/pull/49945
EWS
Committed 288523@main (773a6d98d064): <https://commits.webkit.org/288523@main>
Reviewed commits have been landed. Closing PR #38622 and removing active labels.