Bug 94317 - Counter values not clamped on integer overflow for two counters
Summary: Counter values not clamped on integer overflow for two counters
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: EasyFix, HasReduction
Depends on:
Blocks:
 
Reported: 2012-08-17 02:04 PDT by Elliott Sprehn
Modified: 2024-04-10 01:46 PDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Elliott Sprehn 2012-08-17 02:04:55 PDT
We clamp the summation of the values in a counter-increment on integer overflow but we don't do this when you have two counters in a row:

div:before { counter-increment: 2147483647; /* MAX_INT */ }

<div></div>
<div></div>

See: https://trac.webkit.org/changeset/102528

Should be an easy fix of adding the attached test and using clampToInteger in RenderCounter.cpp
Comment 1 Elliott Sprehn 2012-08-17 02:11:08 PDT
Btw, the reason we do this for counter-increment but not when computing counters in a scope is because the CSS2.1 test suite has a whole bunch of tests like this one:

http://test.csswg.org/suites/css2.1/20110111/html4/counter-increment-015.htm

But out of the 50+ tests it never tests having more than one counter() in a scope.

I can't find reference about integer overflow the spec, and CSS3 values claims CSS is "infinite precision" which makes me think perhaps the tests in 2.1 are wrong and we should always overflow and never clamp.

Note: Gecko and Opera never clamp so they fail those tests.
Comment 2 Tab Atkins 2012-08-17 10:47:19 PDT
No, we should absolutely not overflow.

We commented out the section about required limits in <http://dev.w3.org/csswg/css3-values/>, but from testing in various things, we were going to require impls to support at least +-(2^23 - 1).  Also, you were required to clamp if a number was outside your range.

We'll put the section back into level 4 of the spec, it was just slowing down CR.
Comment 4 Karl Dubost 2024-04-10 01:46:18 PDT
This needs a test with two counters.