Bug 258730 - Prevent counter values from over/underflowing
Summary: Prevent counter values from over/underflowing
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-06-30 07:23 PDT by Ahmad Saleem
Modified: 2023-08-23 23:49 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ahmad Saleem 2023-06-30 07:23:13 PDT
Hi Team,

While going through Blink's commits, I came across where we fail over/underflowing Layout Test on WebKit ToT:

Blink Commit: https://chromium.googlesource.com/chromium/src.git/+/e18ac62b00618f26ef125554dd8241b2aed711e9

WebKit ToT Result:

FAIL large reset does not overflow assert_array_equals: expected property 4 to be 2000000000 but got -1794967296 (expected array [500000000, 1000000000, 1500000000, 2000000000, 2000000000] got [500000000, 1000000000, 1500000000, 2000000000, -1794967296])
FAIL small reset does not underflow assert_array_equals: expected property 4 to be -2000000000 but got 1794967296 (expected array [-500000000, -1000000000, -1500000000, -2000000000, -2000000000] got [-500000000, -1000000000, -1500000000, -2000000000, 1794967296])

Just wanted to raise this bug so we can fix it.

Since Vitor and Tim were doing counter-* related fix, so tagging them.

Thanks!
Comment 1 Radar WebKit Bug Importer 2023-07-04 08:19:26 PDT
<rdar://problem/111743827>
Comment 2 Vitor Roriz 2023-07-04 08:28:19 PDT
I'll have a look. Thanks for reporting it.
Comment 3 Vitor Roriz 2023-07-04 10:45:09 PDT
We need to clarify if it should be clamped to the max/min value of the range or if increment should be ignored in this cases. FF and Chrome do the latter, but the spec seems to suggest the former.
Comment 4 Vitor Roriz 2023-07-04 11:33:47 PDT
https://github.com/w3c/csswg-drafts/issues/9029
Comment 5 Vitor Roriz 2023-07-04 14:13:24 PDT
As Elika suggested, I think we can aim for compatibility here. I.E: making WebKit also ignore the counter-increment if it would overflow, but making counter-reset clamp to the valid range if it would overflow.
Comment 6 Vitor Roriz 2023-07-04 14:27:44 PDT
Pull request: https://github.com/WebKit/WebKit/pull/15549
Comment 7 EWS 2023-08-11 08:48:13 PDT
Committed 266817@main (a3717f099f77): <https://commits.webkit.org/266817@main>

Reviewed commits have been landed. Closing PR #15549 and removing active labels.