| Summary: | Invalid media query keyword values should not be parsable | ||||||
|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Tim Nguyen (:ntim) <ntim> | ||||
| Component: | CSS | Assignee: | Tim Nguyen (:ntim) <ntim> | ||||
| Status: | RESOLVED FIXED | ||||||
| Severity: | Normal | CC: | dino, eric.carlson, esprehn+autocc, ews-watchlist, glenn, gyuyoung.kim, jer.noble, macpherson, menard, philipj, sergio, webkit-bug-importer | ||||
| Priority: | P2 | Keywords: | InRadar | ||||
| Version: | WebKit Nightly Build | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Attachments: |
|
||||||
Created attachment 427783 [details]
Patch
In the future we might want to do this with generated code, the way we do with properties. Committed r277039 (237352@main): <https://commits.webkit.org/237352@main> |
Examples: prefers-color-scheme: none prefers-color-scheme: aghadshudfsjhdsfkjhdsfdsfa prefers-color-scheme: visible prefers-color-scheme: hidden prefers-color-scheme: -webkit-sticky prefers-color-scheme: cssisawesome Ditto for prefers-contrast WebKit all considers them as parsable... This shows up in our WPT failures (notably the none cases for prefers-contrast/prefers-color-scheme). Example snippet to reproduce: function query_is_css_parseable(query) { const style = document.createElement('style'); style.type = 'text/css'; document.head.appendChild(style); const sheet = style.sheet; try { sheet.insertRule("@media " + query + "{}", 0); return sheet.cssRules.length == 1 && sheet.cssRules[0].media.mediaText != "not all"; } finally { while (sheet.cssRules.length) sheet.deleteRule(0); style.remove(); } } query_is_css_parseable("(prefers-color-scheme: -webkit-sticky)") // should return false