RESOLVED FIXED 285451
[css-conditional] Negative cqmin/cqmax units are inverted
https://bugs.webkit.org/show_bug.cgi?id=285451
Summary [css-conditional] Negative cqmin/cqmax units are inverted
Keith Grant
Reported 2025-01-06 11:57:35 PST
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
Keith Grant
Comment 1 2025-01-06 14:43:09 PST
note the production site linked above has been patched to no longer rely on negative cqmin values
Tim Nguyen (:ntim)
Comment 2 2025-01-06 20:27:16 PST
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
Comment 3 2025-01-06 20:54:09 PST
Tim Nguyen (:ntim)
Comment 4 2025-01-06 20:56:23 PST
Tim Nguyen (:ntim)
Comment 5 2025-01-06 21:20:05 PST
Submitted web-platform-tests pull request: https://github.com/web-platform-tests/wpt/pull/49945
EWS
Comment 6 2025-01-07 05:50:54 PST
Committed 288523@main (773a6d98d064): <https://commits.webkit.org/288523@main> Reviewed commits have been landed. Closing PR #38622 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.