Changeset 283434 in webkit
- Timestamp:
- Oct 1, 2021 11:22:54 PM (10 months ago)
- Location:
- trunk
- Files:
-
- 2 deleted
- 22 edited
-
LayoutTests/css3/calc/calc-errors-expected.txt (modified) (1 diff)
-
LayoutTests/css3/calc/calc-errors.html (modified) (1 diff)
-
LayoutTests/css3/calc/catch-divide-by-0-expected.txt (deleted)
-
LayoutTests/css3/calc/catch-divide-by-0.html (deleted)
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/acos-asin-atan-atan2-serialize-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/acos-asin-atan-atan2-serialize.html (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/exp-log-serialize-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/exp-log-serialize.html (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/round-function-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/round-mod-rem-serialize-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/round-mod-rem-serialize.html (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/signs-abs-serialize-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/signs-abs-serialize.html (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/sin-cos-tan-serialize-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/sin-cos-tan-serialize.html (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/css/CSSPrimitiveValue.cpp (modified) (2 diffs)
-
Source/WebCore/css/CSSValueKeywords.in (modified) (1 diff)
-
Source/WebCore/css/CSSValuePool.cpp (modified) (1 diff)
-
Source/WebCore/css/calc/CSSCalcExpressionNodeParser.cpp (modified) (1 diff)
-
Source/WebCore/css/calc/CSSCalcOperationNode.cpp (modified) (5 diffs)
-
Source/WebCore/css/calc/CSSCalcPrimitiveValueNode.cpp (modified) (1 diff)
-
Source/WebCore/css/makevalues.pl (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/css3/calc/calc-errors-expected.txt
r107724 r283434 4 4 unclosed calc with garbage => PASS 5 5 garbage => PASS 6 zero division => PASS7 6 non length => PASS 8 7 number + length => PASS -
trunk/LayoutTests/css3/calc/calc-errors.html
r140300 r283434 17 17 <div style="width: 100px; width: calc( flim;">unclosed calc with garbage</div> 18 18 <div style="width: 100px; width: calc( flim );">garbage</div> 19 20 21 <!-- zero division -->22 <div style="width: 100px; width: calc(1ex / 0);">zero division</div>23 19 24 20 <!-- wrong combination --> -
trunk/LayoutTests/imported/w3c/ChangeLog
r283410 r283434 1 2021-10-01 Nikos Mouchtaris <nmouchtaris@apple.com> 2 3 Allow NaN, infinity, and -infinity in calc 4 https://bugs.webkit.org/show_bug.cgi?id=231044 5 6 Reviewed by Simon Fraser. 7 8 * web-platform-tests/css/css-values/acos-asin-atan-atan2-serialize-expected.txt: 9 * web-platform-tests/css/css-values/acos-asin-atan-atan2-serialize.html: 10 * web-platform-tests/css/css-values/exp-log-serialize-expected.txt: 11 * web-platform-tests/css/css-values/exp-log-serialize.html: 12 * web-platform-tests/css/css-values/round-mod-rem-serialize.html: 13 * web-platform-tests/css/css-values/signs-abs-serialize-expected.txt: 14 * web-platform-tests/css/css-values/signs-abs-serialize.html: 15 * web-platform-tests/css/css-values/sin-cos-tan-serialize-expected.txt: 16 * web-platform-tests/css/css-values/sin-cos-tan-serialize.html: 17 1 18 2021-10-01 Yusuke Suzuki <ysuzuki@apple.com> 2 19 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/acos-asin-atan-atan2-serialize-expected.txt
r283013 r283434 8 8 PASS 'rotate(calc(asin(pi - pi + 1)))' as a specified value should serialize as 'rotate(calc(90deg))'. 9 9 PASS 'rotate(calc(asin(pi - pi + 1)))' as a computed value should serialize as 'matrix(6.123233995736766e-17, 1, -1, 6.123233995736766e-17, 0, 0)'. 10 PASS 'rotate(calc(atan(infinity)))' as a specified value should serialize as 'rotate(calc(90deg))'. 11 PASS 'rotate(calc(atan(infinity)))' as a computed value should serialize as 'matrix(6.123233995736766e-17, 1, -1, 6.123233995736766e-17, 0, 0)'. 10 12 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/acos-asin-atan-atan2-serialize.html
r283013 r283434 44 44 'calc(90deg)', 45 45 rotateMatrix); 46 47 test_serialization( 48 'calc(atan(infinity))', 49 'calc(90deg)', 50 rotateMatrix); 46 51 </script> -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/exp-log-serialize-expected.txt
r282795 r283434 16 16 PASS 'calc(log(1) + 0.5)' as a computed value should serialize as '0.5'. 17 17 PASS 'scale(calc(log(1) + 0.5))' as a computed value should serialize as 'matrix(0.5, 0, 0, 0.5, 0, 0)'. 18 PASS 'calc(log(0))' as a specified value should serialize as 'calc(-infinity)'. 19 PASS 'scale(calc(log(0)))' as a specified value should serialize as 'scale(calc(-infinity))'. 20 FAIL 'calc(log(0))' as a computed value should serialize as '-infinity'. assert_equals: '-infinity' should round-trip exactly in computed values. expected "-infinity" but got "1" 21 FAIL 'scale(calc(log(0)))' as a computed value should serialize as 'matrix(-infinity, 0, 0, -infinity, 0, 0)'. assert_equals: 'matrix(-infinity, 0, 0, -infinity, 0, 0)' should round-trip exactly in computed values. expected "matrix(-infinity, 0, 0, -infinity, 0, 0)" but got "none" 18 22 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/exp-log-serialize.html
r282795 r283434 34 34 'calc(0.5)', 35 35 '0.5'); 36 test_serialization( 37 'calc(log(0))', 38 'calc(-infinity)', 39 '-infinity'); 36 40 </script> -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/round-function-expected.txt
r283073 r283434 50 50 PASS round(-infinity, 5) should be used-value-equivalent to calc(-infinity) 51 51 PASS round(-infinity, -5) should be used-value-equivalent to calc(-infinity) 52 PASS calc(1 / round(5, infinity)) should be used-value-equivalent to calc(infinity) 53 PASS calc(1 / round(5, -infinity)) should be used-value-equivalent to calc(infinity) 54 PASS calc(1 / round(-5, infinity)) should be used-value-equivalent to calc(-infinity) 55 PASS calc(1 / round(-5, -infinity)) should be used-value-equivalent to calc(-infinity) 56 PASS calc(1 / round(to-zero, 5, infinity)) should be used-value-equivalent to calc(infinity) 57 PASS calc(1 / round(to-zero, 5, -infinity)) should be used-value-equivalent to calc(infinity) 58 PASS calc(1 / round(to-zero, -5, infinity)) should be used-value-equivalent to calc(-infinity) 59 PASS calc(1 / round(to-zero, -5, -infinity)) should be used-value-equivalent to calc(-infinity) 60 PASS round(up, 1, infinity) should be used-value-equivalent to calc(infinity) 61 PASS calc(1 / round(up, 0, infinity)) should be used-value-equivalent to calc(infinity) 62 PASS calc(1 / round(up, -1 * 0, infinity) should be used-value-equivalent to calc(-infinity) 63 PASS calc(1 / round(up, -1, infinity) should be used-value-equivalent to calc(-infinity) 64 PASS round(down, -1, infinity) should be used-value-equivalent to calc(-infinity) 65 PASS calc(1 / round(down, -1 * 0, infinity)) should be used-value-equivalent to calc(-infinity) 66 PASS calc(1 / round(down, 0, infinity)) should be used-value-equivalent to calc(infinity) 67 PASS calc(1 / round(down, 1, infinity)) should be used-value-equivalent to calc(infinity) 52 FAIL calc(1 / round(5, infinity)) should be used-value-equivalent to calc(infinity) assert_equals: calc(1 / round(5, infinity)) and calc(infinity) serialize to the same thing in used values. expected "matrix3d(infinity, NaN, NaN, NaN, NaN, infinity, NaN, NaN, 0, 0, 1, 0, 0, 0, 0, 1)" but got "matrix3d(NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, 0, 0, 1, 0, 0, 0, 0, 1)" 53 FAIL calc(1 / round(5, -infinity)) should be used-value-equivalent to calc(infinity) assert_equals: calc(1 / round(5, -infinity)) and calc(infinity) serialize to the same thing in used values. expected "matrix3d(infinity, NaN, NaN, NaN, NaN, infinity, NaN, NaN, 0, 0, 1, 0, 0, 0, 0, 1)" but got "matrix3d(NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, 0, 0, 1, 0, 0, 0, 0, 1)" 54 FAIL calc(1 / round(-5, infinity)) should be used-value-equivalent to calc(-infinity) assert_equals: calc(1 / round(-5, infinity)) and calc(-infinity) serialize to the same thing in used values. expected "matrix3d(-infinity, NaN, NaN, NaN, NaN, -infinity, NaN, NaN, 0, 0, 1, 0, 0, 0, 0, 1)" but got "matrix3d(NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, 0, 0, 1, 0, 0, 0, 0, 1)" 55 FAIL calc(1 / round(-5, -infinity)) should be used-value-equivalent to calc(-infinity) assert_equals: calc(1 / round(-5, -infinity)) and calc(-infinity) serialize to the same thing in used values. expected "matrix3d(-infinity, NaN, NaN, NaN, NaN, -infinity, NaN, NaN, 0, 0, 1, 0, 0, 0, 0, 1)" but got "matrix3d(NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, 0, 0, 1, 0, 0, 0, 0, 1)" 56 FAIL calc(1 / round(to-zero, 5, infinity)) should be used-value-equivalent to calc(infinity) assert_equals: calc(1 / round(to-zero, 5, infinity)) and calc(infinity) serialize to the same thing in used values. expected "matrix3d(infinity, NaN, NaN, NaN, NaN, infinity, NaN, NaN, 0, 0, 1, 0, 0, 0, 0, 1)" but got "matrix3d(NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, 0, 0, 1, 0, 0, 0, 0, 1)" 57 FAIL calc(1 / round(to-zero, 5, -infinity)) should be used-value-equivalent to calc(infinity) assert_equals: calc(1 / round(to-zero, 5, -infinity)) and calc(infinity) serialize to the same thing in used values. expected "matrix3d(infinity, NaN, NaN, NaN, NaN, infinity, NaN, NaN, 0, 0, 1, 0, 0, 0, 0, 1)" but got "matrix3d(NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, 0, 0, 1, 0, 0, 0, 0, 1)" 58 FAIL calc(1 / round(to-zero, -5, infinity)) should be used-value-equivalent to calc(-infinity) assert_equals: calc(1 / round(to-zero, -5, infinity)) and calc(-infinity) serialize to the same thing in used values. expected "matrix3d(-infinity, NaN, NaN, NaN, NaN, -infinity, NaN, NaN, 0, 0, 1, 0, 0, 0, 0, 1)" but got "matrix3d(NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, 0, 0, 1, 0, 0, 0, 0, 1)" 59 FAIL calc(1 / round(to-zero, -5, -infinity)) should be used-value-equivalent to calc(-infinity) assert_equals: calc(1 / round(to-zero, -5, -infinity)) and calc(-infinity) serialize to the same thing in used values. expected "matrix3d(-infinity, NaN, NaN, NaN, NaN, -infinity, NaN, NaN, 0, 0, 1, 0, 0, 0, 0, 1)" but got "matrix3d(NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, 0, 0, 1, 0, 0, 0, 0, 1)" 60 FAIL round(up, 1, infinity) should be used-value-equivalent to calc(infinity) assert_equals: round(up, 1, infinity) and calc(infinity) serialize to the same thing in used values. expected "matrix3d(infinity, NaN, NaN, NaN, NaN, infinity, NaN, NaN, 0, 0, 1, 0, 0, 0, 0, 1)" but got "matrix3d(NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, 0, 0, 1, 0, 0, 0, 0, 1)" 61 FAIL calc(1 / round(up, 0, infinity)) should be used-value-equivalent to calc(infinity) assert_equals: calc(1 / round(up, 0, infinity)) and calc(infinity) serialize to the same thing in used values. expected "matrix3d(infinity, NaN, NaN, NaN, NaN, infinity, NaN, NaN, 0, 0, 1, 0, 0, 0, 0, 1)" but got "matrix3d(NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, 0, 0, 1, 0, 0, 0, 0, 1)" 62 FAIL calc(1 / round(up, -1 * 0, infinity) should be used-value-equivalent to calc(-infinity) assert_equals: calc(1 / round(up, -1 * 0, infinity) and calc(-infinity) serialize to the same thing in used values. expected "matrix3d(-infinity, NaN, NaN, NaN, NaN, -infinity, NaN, NaN, 0, 0, 1, 0, 0, 0, 0, 1)" but got "matrix3d(NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, 0, 0, 1, 0, 0, 0, 0, 1)" 63 FAIL calc(1 / round(up, -1, infinity) should be used-value-equivalent to calc(-infinity) assert_equals: calc(1 / round(up, -1, infinity) and calc(-infinity) serialize to the same thing in used values. expected "matrix3d(-infinity, NaN, NaN, NaN, NaN, -infinity, NaN, NaN, 0, 0, 1, 0, 0, 0, 0, 1)" but got "matrix3d(NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, 0, 0, 1, 0, 0, 0, 0, 1)" 64 FAIL round(down, -1, infinity) should be used-value-equivalent to calc(-infinity) assert_equals: round(down, -1, infinity) and calc(-infinity) serialize to the same thing in used values. expected "matrix3d(-infinity, NaN, NaN, NaN, NaN, -infinity, NaN, NaN, 0, 0, 1, 0, 0, 0, 0, 1)" but got "matrix3d(NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, 0, 0, 1, 0, 0, 0, 0, 1)" 65 FAIL calc(1 / round(down, -1 * 0, infinity)) should be used-value-equivalent to calc(-infinity) assert_equals: calc(1 / round(down, -1 * 0, infinity)) and calc(-infinity) serialize to the same thing in used values. expected "matrix3d(-infinity, NaN, NaN, NaN, NaN, -infinity, NaN, NaN, 0, 0, 1, 0, 0, 0, 0, 1)" but got "matrix3d(NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, 0, 0, 1, 0, 0, 0, 0, 1)" 66 FAIL calc(1 / round(down, 0, infinity)) should be used-value-equivalent to calc(infinity) assert_equals: calc(1 / round(down, 0, infinity)) and calc(infinity) serialize to the same thing in used values. expected "matrix3d(infinity, NaN, NaN, NaN, NaN, infinity, NaN, NaN, 0, 0, 1, 0, 0, 0, 0, 1)" but got "matrix3d(NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, 0, 0, 1, 0, 0, 0, 0, 1)" 67 FAIL calc(1 / round(down, 1, infinity)) should be used-value-equivalent to calc(infinity) assert_equals: calc(1 / round(down, 1, infinity)) and calc(infinity) serialize to the same thing in used values. expected "matrix3d(infinity, NaN, NaN, NaN, NaN, infinity, NaN, NaN, 0, 0, 1, 0, 0, 0, 0, 1)" but got "matrix3d(NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, 0, 0, 1, 0, 0, 0, 0, 1)" 68 68 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/round-mod-rem-serialize-expected.txt
r283073 r283434 12 12 PASS 'rem(1,1)' as a computed value should serialize as '0'. 13 13 PASS 'scale(rem(1,1))' as a computed value should serialize as 'matrix(0, 0, 0, 0, 0, 0)'. 14 PASS 'calc(round(1,0))' as a specified value should serialize as 'calc(NaN)'. 15 PASS 'scale(calc(round(1,0)))' as a specified value should serialize as 'scale(calc(NaN))'. 16 FAIL 'calc(round(1,0))' as a computed value should serialize as 'NaN'. assert_equals: 'NaN' should round-trip exactly in computed values. expected "NaN" but got "1" 17 FAIL 'scale(calc(round(1,0)))' as a computed value should serialize as 'matrix(NaN, 0, 0, NaN, 0, 0)'. assert_equals: 'matrix(NaN, 0, 0, NaN, 0, 0)' should round-trip exactly in computed values. expected "matrix(NaN, 0, 0, NaN, 0, 0)" but got "none" 18 PASS 'calc(mod(1,0))' as a specified value should serialize as 'calc(NaN)'. 19 PASS 'scale(calc(mod(1,0)))' as a specified value should serialize as 'scale(calc(NaN))'. 20 FAIL 'calc(mod(1,0))' as a computed value should serialize as 'NaN'. assert_equals: 'NaN' should round-trip exactly in computed values. expected "NaN" but got "1" 21 FAIL 'scale(calc(mod(1,0)))' as a computed value should serialize as 'matrix(NaN, 0, 0, NaN, 0, 0)'. assert_equals: 'matrix(NaN, 0, 0, NaN, 0, 0)' should round-trip exactly in computed values. expected "matrix(NaN, 0, 0, NaN, 0, 0)" but got "none" 22 PASS 'calc(rem(1,0))' as a specified value should serialize as 'calc(NaN)'. 23 PASS 'scale(calc(rem(1,0)))' as a specified value should serialize as 'scale(calc(NaN))'. 24 FAIL 'calc(rem(1,0))' as a computed value should serialize as 'NaN'. assert_equals: 'NaN' should round-trip exactly in computed values. expected "NaN" but got "1" 25 FAIL 'scale(calc(rem(1,0)))' as a computed value should serialize as 'matrix(NaN, 0, 0, NaN, 0, 0)'. assert_equals: 'matrix(NaN, 0, 0, NaN, 0, 0)' should round-trip exactly in computed values. expected "matrix(NaN, 0, 0, NaN, 0, 0)" but got "none" 14 26 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/round-mod-rem-serialize.html
r283073 r283434 29 29 'calc(0)', 30 30 '0'); 31 32 test_serialization( 33 'calc(round(1,0))', 34 'calc(NaN)', 35 'NaN'); 36 test_serialization( 37 'calc(mod(1,0))', 38 'calc(NaN)', 39 'NaN'); 40 test_serialization( 41 'calc(rem(1,0))', 42 'calc(NaN)', 43 'NaN'); 31 44 </script> -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/signs-abs-serialize-expected.txt
r283063 r283434 32 32 FAIL 'calc(sign(.1) + 1)' as a computed value should serialize as '2'. assert_equals: '2' should round-trip exactly in computed values. expected "2" but got "1" 33 33 PASS 'scale(calc(sign(.1) + 1))' as a computed value should serialize as 'matrix(2, 0, 0, 2, 0, 0)'. 34 FAIL 'calc(abs(inFinity))' as a specified value should serialize as 'calc(inFinity)'. assert_equals: 'calc(inFinity)' should round-trip exactly in specified values. expected "calc(inFinity)" but got "calc(infinity)" 35 PASS 'scale(calc(abs(inFinity)))' as a specified value should serialize as 'scale(calc(infinity))'. 36 FAIL 'calc(abs(inFinity))' as a computed value should serialize as 'infinity'. assert_equals: 'infinity' should round-trip exactly in computed values. expected "infinity" but got "1" 37 FAIL 'scale(calc(abs(inFinity)))' as a computed value should serialize as 'matrix(infinity, 0, 0, infinity, 0, 0)'. assert_equals: 'matrix(infinity, 0, 0, infinity, 0, 0)' should round-trip exactly in computed values. expected "matrix(infinity, 0, 0, infinity, 0, 0)" but got "none" 38 PASS 'calc(abs(infinity))' as a specified value should serialize as 'calc(infinity)'. 39 PASS 'scale(calc(abs(infinity)))' as a specified value should serialize as 'scale(calc(infinity))'. 40 FAIL 'calc(abs(infinity))' as a computed value should serialize as 'infinity'. assert_equals: 'infinity' should round-trip exactly in computed values. expected "infinity" but got "1" 41 FAIL 'scale(calc(abs(infinity)))' as a computed value should serialize as 'matrix(infinity, 0, 0, infinity, 0, 0)'. assert_equals: 'matrix(infinity, 0, 0, infinity, 0, 0)' should round-trip exactly in computed values. expected "matrix(infinity, 0, 0, infinity, 0, 0)" but got "none" 42 PASS 'calc(sign(infinity))' as a specified value should serialize as 'calc(1)'. 43 PASS 'scale(calc(sign(infinity)))' as a specified value should serialize as 'scale(calc(1))'. 44 PASS 'calc(sign(infinity))' as a computed value should serialize as '1'. 45 PASS 'scale(calc(sign(infinity)))' as a computed value should serialize as 'matrix(1, 0, 0, 1, 0, 0)'. 46 FAIL 'abs(infinity)' as a specified value should serialize as 'calc(infinity)'. assert_equals: 'abs(infinity)' and 'calc(infinity)' should serialize the same in specified values. expected "calc(infinity)" but got "abs(infinity)" 47 FAIL 'scale(abs(infinity))' as a specified value should serialize as 'scale(calc(infinity))'. assert_equals: 'scale(abs(infinity))' and 'scale(calc(infinity))' should serialize the same in specified values. expected "scale(calc(infinity))" but got "scale(abs(infinity))" 48 FAIL 'abs(infinity)' as a computed value should serialize as 'infinity'. assert_equals: 'infinity' should round-trip exactly in computed values. expected "infinity" but got "1" 49 FAIL 'scale(abs(infinity))' as a computed value should serialize as 'matrix(infinity, 0, 0, infinity, 0, 0)'. assert_equals: 'matrix(infinity, 0, 0, infinity, 0, 0)' should round-trip exactly in computed values. expected "matrix(infinity, 0, 0, infinity, 0, 0)" but got "none" 50 PASS 'calc(abs(-infinity))' as a specified value should serialize as 'calc(infinity)'. 51 PASS 'scale(calc(abs(-infinity)))' as a specified value should serialize as 'scale(calc(infinity))'. 52 FAIL 'calc(abs(-infinity))' as a computed value should serialize as 'infinity'. assert_equals: 'infinity' should round-trip exactly in computed values. expected "infinity" but got "1" 53 FAIL 'scale(calc(abs(-infinity)))' as a computed value should serialize as 'matrix(infinity, 0, 0, infinity, 0, 0)'. assert_equals: 'matrix(infinity, 0, 0, infinity, 0, 0)' should round-trip exactly in computed values. expected "matrix(infinity, 0, 0, infinity, 0, 0)" but got "none" 54 PASS 'calc(sign(-1 * infinity))' as a specified value should serialize as 'calc(-1)'. 55 PASS 'scale(calc(sign(-1 * infinity)))' as a specified value should serialize as 'scale(calc(-1))'. 56 FAIL 'calc(sign(-1 * infinity))' as a computed value should serialize as '-1'. assert_equals: '-1' should round-trip exactly in computed values. expected "-1" but got "0" 57 PASS 'scale(calc(sign(-1 * infinity)))' as a computed value should serialize as 'matrix(-1, 0, 0, -1, 0, 0)'. 34 58 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/signs-abs-serialize.html
r283063 r283434 51 51 'calc(2)', 52 52 '2'); 53 54 test_serialization( 55 'calc(abs(inFinity))', 56 'calc(inFinity)', 57 'infinity'); 58 59 test_serialization( 60 'calc(abs(infinity))', 61 'calc(infinity)', 62 'infinity'); 63 test_serialization( 64 'calc(sign(infinity))', 65 'calc(1)', 66 '1'); 67 test_serialization( 68 'abs(infinity)', 69 'calc(infinity)', 70 'infinity'); 71 72 test_serialization( 73 'calc(abs(-infinity))', 74 'calc(infinity)', 75 'infinity'); 76 test_serialization( 77 'calc(sign(-1 * infinity))', 78 'calc(-1)', 79 '-1'); 53 80 </script> -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/sin-cos-tan-serialize-expected.txt
r282402 r283434 28 28 PASS 'calc(tan(0) + 0.5)' as a computed value should serialize as '0.5'. 29 29 PASS 'scale(calc(tan(0) + 0.5))' as a computed value should serialize as 'matrix(0.5, 0, 0, 0.5, 0, 0)'. 30 PASS 'calc(sin(infinity))' as a specified value should serialize as 'calc(NaN)'. 31 PASS 'scale(calc(sin(infinity)))' as a specified value should serialize as 'scale(calc(NaN))'. 32 FAIL 'calc(sin(infinity))' as a computed value should serialize as 'NaN'. assert_equals: 'NaN' should round-trip exactly in computed values. expected "NaN" but got "1" 33 FAIL 'scale(calc(sin(infinity)))' as a computed value should serialize as 'matrix(NaN, 0, 0, NaN, 0, 0)'. assert_equals: 'matrix(NaN, 0, 0, NaN, 0, 0)' should round-trip exactly in computed values. expected "matrix(NaN, 0, 0, NaN, 0, 0)" but got "none" 34 PASS 'calc(cos(infinity))' as a specified value should serialize as 'calc(NaN)'. 35 PASS 'scale(calc(cos(infinity)))' as a specified value should serialize as 'scale(calc(NaN))'. 36 FAIL 'calc(cos(infinity))' as a computed value should serialize as 'NaN'. assert_equals: 'NaN' should round-trip exactly in computed values. expected "NaN" but got "1" 37 FAIL 'scale(calc(cos(infinity)))' as a computed value should serialize as 'matrix(NaN, 0, 0, NaN, 0, 0)'. assert_equals: 'matrix(NaN, 0, 0, NaN, 0, 0)' should round-trip exactly in computed values. expected "matrix(NaN, 0, 0, NaN, 0, 0)" but got "none" 38 PASS 'calc(tan(infinity))' as a specified value should serialize as 'calc(NaN)'. 39 PASS 'scale(calc(tan(infinity)))' as a specified value should serialize as 'scale(calc(NaN))'. 40 FAIL 'calc(tan(infinity))' as a computed value should serialize as 'NaN'. assert_equals: 'NaN' should round-trip exactly in computed values. expected "NaN" but got "1" 41 FAIL 'scale(calc(tan(infinity)))' as a computed value should serialize as 'matrix(NaN, 0, 0, NaN, 0, 0)'. assert_equals: 'matrix(NaN, 0, 0, NaN, 0, 0)' should round-trip exactly in computed values. expected "matrix(NaN, 0, 0, NaN, 0, 0)" but got "none" 30 42 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/sin-cos-tan-serialize.html
r282402 r283434 46 46 'calc(0.5)', 47 47 '0.5'); 48 49 test_serialization( 50 'calc(sin(infinity))', 51 'calc(NaN)', 52 'NaN'); 53 test_serialization( 54 'calc(cos(infinity))', 55 'calc(NaN)', 56 'NaN'); 57 test_serialization( 58 'calc(tan(infinity))', 59 'calc(NaN)', 60 'NaN'); 48 61 </script> -
trunk/Source/WebCore/ChangeLog
r283432 r283434 1 2021-10-01 Nikos Mouchtaris <nmouchtaris@apple.com> 2 3 Allow NaN, infinity, and -infinity in calc 4 https://bugs.webkit.org/show_bug.cgi?id=231044 5 6 Reviewed by Simon Fraser. 7 8 Modified existing serialization tests. 9 10 Added support for NaN, infinity and -infinity keywords in calc. Involved removing checks for 11 inputs that would result in these values and introduction of new CSSKeywords for these three 12 constants. Spec for this: https://drafts.csswg.org/css-values-4/#calc-error-constants. 13 14 * css/CSSPrimitiveValue.cpp: 15 (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): 16 (WebCore::CSSPrimitiveValue::formatNumberValue const): 17 * css/CSSValueKeywords.in: 18 * css/CSSValuePool.cpp: 19 (WebCore::CSSValuePool::createValue): 20 * css/calc/CSSCalcExpressionNodeParser.cpp: 21 (WebCore::getConstantTable): 22 * css/calc/CSSCalcOperationNode.cpp: 23 (WebCore::determineCategory): 24 (WebCore::CSSCalcOperationNode::createLog): 25 (WebCore::CSSCalcOperationNode::createStep): 26 (WebCore::CSSCalcOperationNode::createRound): 27 * css/calc/CSSCalcPrimitiveValueNode.cpp: 28 (WebCore::CSSCalcPrimitiveValueNode::invert): 29 1 30 2021-10-01 Lauro Moura <lmoura@igalia.com> 2 31 -
trunk/Source/WebCore/css/CSSPrimitiveValue.cpp
r283279 r283434 261 261 { 262 262 setPrimitiveUnitType(type); 263 ASSERT(std::isfinite(num));264 263 m_value.num = num; 265 264 } … … 952 951 NEVER_INLINE String CSSPrimitiveValue::formatNumberValue(StringView suffix) const 953 952 { 953 if (m_value.num == std::numeric_limits<double>::infinity()) 954 return makeString("infinity", suffix); 955 if (m_value.num == -1 * std::numeric_limits<double>::infinity()) 956 return makeString("-infinity", suffix); 954 957 return makeString(m_value.num, suffix); 955 958 } -
trunk/Source/WebCore/css/CSSValueKeywords.in
r283359 r283434 1367 1367 to-zero 1368 1368 nearest 1369 infinity 1370 -infinity 1371 NaN 1369 1372 1370 1373 from-image -
trunk/Source/WebCore/css/CSSValuePool.cpp
r267009 r283434 113 113 Ref<CSSPrimitiveValue> CSSValuePool::createValue(double value, CSSUnitType type) 114 114 { 115 ASSERT(std::isfinite(value));116 117 115 if (value < 0 || value > StaticCSSValuePool::maximumCacheableIntegerValue) 118 116 return CSSPrimitiveValue::create(value, type); -
trunk/Source/WebCore/css/calc/CSSCalcExpressionNodeParser.cpp
r283359 r283434 98 98 static const CSSCalcSymbolTable getConstantTable() 99 99 { 100 return { { CSSValuePi, CSSUnitType::CSS_NUMBER, piDouble }, { CSSValueE, CSSUnitType::CSS_NUMBER, std::exp(1.0) } }; 100 return { 101 { CSSValuePi, CSSUnitType::CSS_NUMBER, piDouble }, { CSSValueE, CSSUnitType::CSS_NUMBER, std::exp(1.0) }, 102 { CSSValueNegativeInfinity, CSSUnitType::CSS_NUMBER, -1 * std::numeric_limits<double>::infinity() }, 103 { CSSValueInfinity, CSSUnitType::CSS_NUMBER, std::numeric_limits<double>::infinity() }, 104 { CSSValueNaN, CSSUnitType::CSS_NUMBER, std::numeric_limits<double>::quiet_NaN() }, 105 }; 101 106 } 102 107 -
trunk/Source/WebCore/css/calc/CSSCalcOperationNode.cpp
r283359 r283434 71 71 return leftCategory == CalculationCategory::Number ? rightCategory : leftCategory; 72 72 case CalcOperator::Divide: 73 if (rightCategory != CalculationCategory::Number || rightSide.isZero())73 if (rightCategory != CalculationCategory::Number) 74 74 return CalculationCategory::Other; 75 75 return leftCategory; … … 159 159 // and right type be the result of finding the types of its right argument and then inverting it. 160 160 // The sub-expression’s type is the result of multiplying the left type and right type. 161 if (invertCategory != CalculationCategory::Number || node.isZero())161 if (invertCategory != CalculationCategory::Number) 162 162 return CalculationCategory::Other; 163 163 break; … … 439 439 return nullptr; 440 440 for (auto& value : values) { 441 // TODO: Support infinity 442 if (value->category() != CalculationCategory::Number || !value->doubleValue(value->primitiveType())) { 441 if (value->category() != CalculationCategory::Number) { 443 442 LOG_WITH_STREAM(Calc, stream << "Failed to create log node because unable to determine category from " << prettyPrintNodes(values)); 444 443 return nullptr; 445 444 } 446 }447 448 // TODO: Support infinity449 if ((values.size() == 2 && values[1]->doubleValue(values[1]->primitiveType()) == 1)) {450 LOG_WITH_STREAM(Calc, stream << "Failed to create log node because unable to determine category from " << prettyPrintNodes(values));451 return nullptr;452 445 } 453 446 … … 568 561 return nullptr; 569 562 } 570 571 if (!values[1]->doubleValue(values[1]->primitiveType())) {572 LOG_WITH_STREAM(Calc, stream << "Failed to create stepped value node because unable to determine category from " << prettyPrintNodes(values));573 return nullptr;574 }575 576 563 return adoptRef(new CSSCalcOperationNode(values[0]->category(), op, WTFMove(values))); 577 564 } … … 609 596 if (values.size() == 3) 610 597 values.remove(0); 611 if (!values[1]->doubleValue(values[1]->primitiveType())) {612 LOG_WITH_STREAM(Calc, stream << "Failed to create round node because unable to determine category from " << prettyPrintNodes(values));613 return nullptr;614 }615 598 return adoptRef(new CSSCalcOperationNode(values.rbegin()[0]->category(), roundType, WTFMove(values))); 616 599 } -
trunk/Source/WebCore/css/calc/CSSCalcPrimitiveValueNode.cpp
r282430 r283434 86 86 { 87 87 ASSERT(isNumericValue()); 88 if (!m_value->doubleValue()) 88 if (!m_value->doubleValue()) { 89 89 m_value = CSSPrimitiveValue::create(std::numeric_limits<double>::infinity(), m_value->primitiveType()); 90 return; 91 } 90 92 91 93 m_value = CSSPrimitiveValue::create(1.0 / m_value->doubleValue(), m_value->primitiveType()); -
trunk/Source/WebCore/css/makevalues.pl
r278304 r283434 103 103 my $id = $names[$i]; 104 104 $id =~ s/(^[^-])|-(.)/uc($1||$2)/ge; 105 print GPERF $lower_names[$i] . ", CSSValue" . $id . "\n"; 105 if($lower_names[$i]=="-infinity") { 106 print GPERF $lower_names[$i] . ", CSSValueNegativeInfinity" . "\n"; 107 } else { 108 print GPERF $lower_names[$i] . ", CSSValue" . $id . "\n"; 109 } 106 110 } 107 111 … … 180 184 my $id = $name; 181 185 $id =~ s/(^[^-])|-(.)/uc($1||$2)/ge; 182 print HEADER " CSSValue" . $id . " = " . $i . ",\n"; 186 if($name=="-infinity") { 187 print HEADER " CSSValueNegativeInfinity = " . $i . ",\n"; 188 } else { 189 print HEADER " CSSValue" . $id . " = " . $i . ",\n"; 190 } 183 191 $i = $i + 1; 184 192 if (length($name) > $maxLen) {
Note: See TracChangeset
for help on using the changeset viewer.