Bug 248396 - [MQ4] Disallow negative values
Summary: [MQ4] Disallow negative values
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Antti Koivisto
URL:
Keywords: InRadar
Depends on:
Blocks: 248391
  Show dependency treegraph
 
Reported: 2022-11-28 07:33 PST by Antti Koivisto
Modified: 2022-11-28 23:51 PST (History)
16 users (show)

See Also:


Attachments
Patch (33.48 KB, patch)
2022-11-28 07:43 PST, Antti Koivisto
no flags Details | Formatted Diff | Diff
Patch (34.29 KB, patch)
2022-11-28 10:18 PST, Antti Koivisto
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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].