Bug 248396

Summary: [MQ4] Disallow negative values
Product: WebKit Reporter: Antti Koivisto <koivisto>
Component: CSSAssignee: Antti Koivisto <koivisto>
Status: RESOLVED FIXED    
Severity: Normal CC: darin, eric.carlson, esprehn+autocc, ews-watchlist, glenn, gyuyoung.kim, jer.noble, macpherson, menard, ntim, philipj, sergio, webkit-bug-importer, youssefdevelops, y_soliman, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 248391    
Attachments:
Description Flags
Patch
none
Patch none

Description Antti Koivisto 2022-11-28 07:33:54 PST
Disallow negative values for now even though they are allowed by the spec (https://www.w3.org/TR/mediaqueries-4/#false-in-the-negative-range). The current WPTs don't yet follow this behavior and no other engine implements it. It is better enabled separately.

Also other parsing and evaluation fixes.
Comment 1 Antti Koivisto 2022-11-28 07:43:58 PST
Created attachment 463761 [details]
Patch
Comment 2 Tim Nguyen (:ntim) 2022-11-28 08:17:48 PST
(Fwiw I think the main reason they're allowed is for calc())
Comment 3 Antti Koivisto 2022-11-28 10:14:07 PST
(In reply to Tim Nguyen (:ntim) from comment #2)
> (Fwiw I think the main reason they're allowed is for calc())

They are still allowed for calc() (matching others).
Comment 4 Radar WebKit Bug Importer 2022-11-28 10:16:15 PST
<rdar://problem/102723342>
Comment 5 Antti Koivisto 2022-11-28 10:18:06 PST
Created attachment 463764 [details]
Patch
Comment 6 Darin Adler 2022-11-28 10:22:48 PST
Not sure I feel about using { } instead of std::nullopt for std::optional return values.
Comment 7 Antti Koivisto 2022-11-28 10:53:35 PST
(In reply to Darin Adler from comment #6)
> Not sure I feel about using { } instead of std::nullopt for std::optional
> return values.

It is a pretty common pattern in WebKit. I don't see the benefits of being more verbose.
Comment 8 Darin Adler 2022-11-28 11:24:34 PST
(In reply to Antti Koivisto from comment #7)
> It is a pretty common pattern in WebKit. I don't see the benefits of being
> more verbose.

OK, agreed.
Comment 9 EWS 2022-11-28 23:50:58 PST
Committed 257105@main (aacea0b8da7d): <https://commits.webkit.org/257105@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 463764 [details].