Title: [292018] trunk
Revision
292018
Author
[email protected]
Date
2022-03-28 18:16:31 -0700 (Mon, 28 Mar 2022)

Log Message

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:
https://github.com/w3c/csswg-drafts/issues/6105.

* css/calc/CSSCalcValue.cpp:
(WebCore::CSSCalcValue::clampToPermittedRange const):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (292017 => 292018)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2022-03-29 01:14:28 UTC (rev 292017)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2022-03-29 01:16:31 UTC (rev 292018)
@@ -1,3 +1,12 @@
+2022-03-28  Nikolaos Mouchtaris  <[email protected]>
+
+        Clamp degenerate calc() values for <angle>
+        https://bugs.webkit.org/show_bug.cgi?id=238401
+
+        Reviewed by Simon Fraser.
+
+        * web-platform-tests/css/css-values/calc-infinity-nan-computed-expected.txt:
+
 2022-03-28  Cameron McCormack  <[email protected]>
 
         Remove the 1ms minimum for setTimeout

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/calc-infinity-nan-computed-expected.txt (292017 => 292018)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/calc-infinity-nan-computed-expected.txt	2022-03-29 01:14:28 UTC (rev 292017)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/calc-infinity-nan-computed-expected.txt	2022-03-29 01:16:31 UTC (rev 292018)
@@ -21,16 +21,16 @@
 PASS Property transition-delay value 'calc(-infinity* 1s)'
 PASS Property transition-delay value 'calc(max(10000s, 0s) + min(-infinity * 1s, infinity * 1s))'
 PASS Property transition-delay value 'calc(min(-infinity * 1s, 10s))'
-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
-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
-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
-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
-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
-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
-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
-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
-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
-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
-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
-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
+PASS Property rotate(calc(infinity * 1deg)) value expected same with rotate(0deg) in +/-0.0001
+PASS Property rotate(calc(-infinity * 1deg)) value expected same with rotate(0deg) in +/-0.0001
+PASS Property rotate(calc(NaN * 1deg)) value expected same with rotate(0deg) in +/-0.0001
+PASS Property rotate(calc(infinity * 1turn)) value expected same with rotate(0turn) in +/-0.0001
+PASS Property rotate(calc(-infinity * 1turn)) value expected same with rotate(0turn) in +/-0.0001
+PASS Property rotate(calc(NaN * 1turn)) value expected same with rotate(0turn) in +/-0.0001
+PASS Property rotate(calc(infinity * 1rad)) value expected same with rotate(0rad) in +/-0.0001
+PASS Property rotate(calc(-infinity * 1rad)) value expected same with rotate(0rad) in +/-0.0001
+PASS Property rotate(calc(NaN * 1rad)) value expected same with rotate(0rad) in +/-0.0001
+PASS Property rotate(calc(infinity * 1grad)) value expected same with rotate(0grad) in +/-0.0001
+PASS Property rotate(calc(-infinity * 1grad)) value expected same with rotate(0grad) in +/-0.0001
+PASS Property rotate(calc(NaN * 1grad)) value expected same with rotate(0grad) in +/-0.0001
 

Modified: trunk/Source/WebCore/ChangeLog (292017 => 292018)


--- trunk/Source/WebCore/ChangeLog	2022-03-29 01:14:28 UTC (rev 292017)
+++ trunk/Source/WebCore/ChangeLog	2022-03-29 01:16:31 UTC (rev 292018)
@@ -1,3 +1,16 @@
+2022-03-28  Nikolaos Mouchtaris  <[email protected]>
+
+        Clamp degenerate calc() values for <angle>
+        https://bugs.webkit.org/show_bug.cgi?id=238401
+
+        Reviewed by Simon Fraser.
+
+        Clamp nan, infinity and -infinity to zero for <angle>. Issue discussing this: 
+        https://github.com/w3c/csswg-drafts/issues/6105.
+
+        * css/calc/CSSCalcValue.cpp:
+        (WebCore::CSSCalcValue::clampToPermittedRange const):
+
 2022-03-28  Rob Buis  <[email protected]>
 
         Check for re-entrancy in stopForBackForwardCache

Modified: trunk/Source/WebCore/css/calc/CSSCalcValue.cpp (292017 => 292018)


--- trunk/Source/WebCore/css/calc/CSSCalcValue.cpp	2022-03-29 01:14:28 UTC (rev 292017)
+++ trunk/Source/WebCore/css/calc/CSSCalcValue.cpp	2022-03-29 01:16:31 UTC (rev 292018)
@@ -325,6 +325,8 @@
 
 inline double CSSCalcValue::clampToPermittedRange(double value) const
 {
+    if (primitiveType() == CSSUnitType::CSS_DEG && (isnan(value) || isinf(value)))
+        return 0;
     return m_shouldClampToNonNegative && value < 0 ? 0 : value;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to