-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent counter values from over/underflowing
https://bugs.webkit.org/show_bug.cgi?id=258730 rdar://111743827 Reviewed by Chris Dumez. We will ignore the counter-increment() operation if this would result in overflow/underflow for compatibility with other vendors (w3c/csswg-drafts#9029). * LayoutTests/imported/w3c/web-platform-tests/css/css-lists/counter-reset-increment-overflow-underflow-expected.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-lists/counter-reset-increment-overflow-underflow-ref.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-lists/counter-reset-increment-overflow-underflow.html: Added. * Source/WTF/wtf/CheckedArithmetic.h: (WTF::sumIfNoOverflowOrFirstValue): * Source/WebCore/rendering/CounterNode.cpp: (WebCore::CounterNode::computeCountInParent const): Canonical link: https://commits.webkit.org/266817@main
- Loading branch information
1 parent
8aeeea8
commit a3717f0
Showing
5 changed files
with
73 additions
and
2 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
...web-platform-tests/css/css-lists/counter-reset-increment-overflow-underflow-expected.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE HTML> | ||
<link rel="author" title="Vitor Roriz" href="https://github.com/vitorroriz"> | ||
<link rel="help" href="https://drafts.csswg.org/css-lists-3/#auto-numbering"> | ||
<div> | ||
<h3>2050000000</h3> | ||
<h3>2100000000</h3> | ||
<h3>2100000000</h3> | ||
</div> | ||
<div> | ||
<h3>-2050000000</h3> | ||
<h3>-2100000000</h3> | ||
<h3>-2100000000</h3> | ||
</div> |
13 changes: 13 additions & 0 deletions
13
.../w3c/web-platform-tests/css/css-lists/counter-reset-increment-overflow-underflow-ref.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE HTML> | ||
<link rel="author" title="Vitor Roriz" href="https://github.com/vitorroriz"> | ||
<link rel="help" href="https://drafts.csswg.org/css-lists-3/#auto-numbering"> | ||
<div> | ||
<h3>2050000000</h3> | ||
<h3>2100000000</h3> | ||
<h3>2100000000</h3> | ||
</div> | ||
<div> | ||
<h3>-2050000000</h3> | ||
<h3>-2100000000</h3> | ||
<h3>-2100000000</h3> | ||
</div> |
35 changes: 35 additions & 0 deletions
35
...rted/w3c/web-platform-tests/css/css-lists/counter-reset-increment-overflow-underflow.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!DOCTYPE HTML> | ||
<link rel="author" title="Vitor Roriz" href="https://github.com/vitorroriz"> | ||
<link rel="help" href="https://drafts.csswg.org/css-lists-3/#auto-numbering"> | ||
<link rel="match" href="counter-reset-increment-overflow-underflow-ref.html"> | ||
<style> | ||
.overflow { | ||
counter-reset: over-counter 2000000000; | ||
} | ||
.overflow h3:before { | ||
counter-increment: over-counter 50000000; | ||
} | ||
.overflow h3::before { | ||
content: counter(over-counter); | ||
} | ||
|
||
.underflow { | ||
counter-reset: under-counter -2000000000 | ||
} | ||
.underflow h3:before { | ||
counter-increment: under-counter -50000000; | ||
} | ||
.underflow h3::before { | ||
content: counter(under-counter); | ||
} | ||
</style> | ||
<div class="overflow"> | ||
<h3></h3> | ||
<h3></h3> | ||
<h3></h3> | ||
</div> | ||
<div class="underflow"> | ||
<h3></h3> | ||
<h3></h3> | ||
<h3></h3> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters