Content-Length: 395210 | pFad | http://github.com/WebKit/WebKit/commit/10c6b1ebeabe90d7066e32605c5f8397a08d09f8

5B Clamp degenerate calc() values for <angle> · WebKit/WebKit@10c6b1e · GitHub
Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 10c6b1e

Browse files
committedMar 29, 2022
Clamp degenerate calc() values for <angle>
https://bugs.webkit.org/show_bug.cgi?id=238401 Reviewed by Simon Fraser. LayoutTests/imported/w3c: * web-platform-tests/css/css-values/calc-infinity-nan-computed-expected.txt: Source/WebCore: Clamp nan, infinity and -infinity to zero for <angle>. Issue discussing this: w3c/csswg-drafts#6105. * css/calc/CSSCalcValue.cpp: (WebCore::CSSCalcValue::clampToPermittedRange const): Canonical link: https://commits.webkit.org/248962@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@292018 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 6b84896 commit 10c6b1e

File tree

4 files changed

+36
-12
lines changed

4 files changed

+36
-12
lines changed
 

‎LayoutTests/imported/w3c/ChangeLog

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
2022-03-28 Nikolaos Mouchtaris <nmouchtaris@apple.com>
2+
3+
Clamp degenerate calc() values for <angle>
4+
https://bugs.webkit.org/show_bug.cgi?id=238401
5+
6+
Reviewed by Simon Fraser.
7+
8+
* web-platform-tests/css/css-values/calc-infinity-nan-computed-expected.txt:
9+
110
2022-03-28 Cameron McCormack <heycam@apple.com>
211

312
Remove the 1ms minimum for setTimeout

‎LayoutTests/imported/w3c/web-platform-tests/css/css-values/calc-infinity-nan-computed-expected.txt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ PASS Property animation-duration value 'calc(max(infinity * 1s, 10s)'
2121
PASS Property transition-delay value 'calc(-infinity* 1s)'
2222
PASS Property transition-delay value 'calc(max(10000s, 0s) + min(-infinity * 1s, infinity * 1s))'
2323
PASS Property transition-delay value 'calc(min(-infinity * 1s, 10s))'
24-
FAIL Property rotate(calc(infinity * 1deg)) value expected same with rotate(0deg) in +/-0.0001 assert_array_approx_equals: lengths differ, expected 6 got 16
25-
FAIL Property rotate(calc(-infinity * 1deg)) value expected same with rotate(0deg) in +/-0.0001 assert_array_approx_equals: lengths differ, expected 6 got 16
26-
FAIL Property rotate(calc(NaN * 1deg)) value expected same with rotate(0deg) in +/-0.0001 assert_array_approx_equals: lengths differ, expected 6 got 16
27-
FAIL Property rotate(calc(infinity * 1turn)) value expected same with rotate(0turn) in +/-0.0001 assert_array_approx_equals: lengths differ, expected 6 got 16
28-
FAIL Property rotate(calc(-infinity * 1turn)) value expected same with rotate(0turn) in +/-0.0001 assert_array_approx_equals: lengths differ, expected 6 got 16
29-
FAIL Property rotate(calc(NaN * 1turn)) value expected same with rotate(0turn) in +/-0.0001 assert_array_approx_equals: lengths differ, expected 6 got 16
30-
FAIL Property rotate(calc(infinity * 1rad)) value expected same with rotate(0rad) in +/-0.0001 assert_array_approx_equals: lengths differ, expected 6 got 16
31-
FAIL Property rotate(calc(-infinity * 1rad)) value expected same with rotate(0rad) in +/-0.0001 assert_array_approx_equals: lengths differ, expected 6 got 16
32-
FAIL Property rotate(calc(NaN * 1rad)) value expected same with rotate(0rad) in +/-0.0001 assert_array_approx_equals: lengths differ, expected 6 got 16
33-
FAIL Property rotate(calc(infinity * 1grad)) value expected same with rotate(0grad) in +/-0.0001 assert_array_approx_equals: lengths differ, expected 6 got 16
34-
FAIL Property rotate(calc(-infinity * 1grad)) value expected same with rotate(0grad) in +/-0.0001 assert_array_approx_equals: lengths differ, expected 6 got 16
35-
FAIL Property rotate(calc(NaN * 1grad)) value expected same with rotate(0grad) in +/-0.0001 assert_array_approx_equals: lengths differ, expected 6 got 16
24+
PASS Property rotate(calc(infinity * 1deg)) value expected same with rotate(0deg) in +/-0.0001
25+
PASS Property rotate(calc(-infinity * 1deg)) value expected same with rotate(0deg) in +/-0.0001
26+
PASS Property rotate(calc(NaN * 1deg)) value expected same with rotate(0deg) in +/-0.0001
27+
PASS Property rotate(calc(infinity * 1turn)) value expected same with rotate(0turn) in +/-0.0001
28+
PASS Property rotate(calc(-infinity * 1turn)) value expected same with rotate(0turn) in +/-0.0001
29+
PASS Property rotate(calc(NaN * 1turn)) value expected same with rotate(0turn) in +/-0.0001
30+
PASS Property rotate(calc(infinity * 1rad)) value expected same with rotate(0rad) in +/-0.0001
31+
PASS Property rotate(calc(-infinity * 1rad)) value expected same with rotate(0rad) in +/-0.0001
32+
PASS Property rotate(calc(NaN * 1rad)) value expected same with rotate(0rad) in +/-0.0001
33+
PASS Property rotate(calc(infinity * 1grad)) value expected same with rotate(0grad) in +/-0.0001
34+
PASS Property rotate(calc(-infinity * 1grad)) value expected same with rotate(0grad) in +/-0.0001
35+
PASS Property rotate(calc(NaN * 1grad)) value expected same with rotate(0grad) in +/-0.0001
3636

‎Source/WebCore/ChangeLog

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
2022-03-28 Nikolaos Mouchtaris <nmouchtaris@apple.com>
2+
3+
Clamp degenerate calc() values for <angle>
4+
https://bugs.webkit.org/show_bug.cgi?id=238401
5+
6+
Reviewed by Simon Fraser.
7+
8+
Clamp nan, infinity and -infinity to zero for <angle>. Issue discussing this:
9+
https://github.com/w3c/csswg-drafts/issues/6105.
10+
11+
* css/calc/CSSCalcValue.cpp:
12+
(WebCore::CSSCalcValue::clampToPermittedRange const):
13+
114
2022-03-28 Rob Buis <rbuis@igalia.com>
215

316
Check for re-entrancy in stopForBackForwardCache

‎Source/WebCore/css/calc/CSSCalcValue.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,8 @@ bool CSSCalcValue::equals(const CSSCalcValue& other) const
325325

326326
inline double CSSCalcValue::clampToPermittedRange(double value) const
327327
{
328+
if (primitiveType() == CSSUnitType::CSS_DEG && (isnan(value) || isinf(value)))
329+
return 0;
328330
return m_shouldClampToNonNegative && value < 0 ? 0 : value;
329331
}
330332

0 commit comments

Comments
 (0)
Failed to load comments.








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/WebKit/WebKit/commit/10c6b1ebeabe90d7066e32605c5f8397a08d09f8

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy