Skip to content

Commit

Permalink
Implement CSS exponential functions.
Browse files Browse the repository at this point in the history
Differential Revision: https://phabricator.services.mozilla.com/D170842

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1814469
gecko-commit: a429c31909d39d44ff22f391b991407abd4a0cbe
gecko-reviewers: emilio
  • Loading branch information
zqianem authored and pull[bot] committed Jun 29, 2023
1 parent 538b2e1 commit 1097814
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
8 changes: 7 additions & 1 deletion css/css-values/hypot-pow-sqrt-computed.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,18 @@
test_math_used('calc(100px * sqrt(100))', '1000px');
test_math_used('calc(1px * pow(2, sqrt(100))', '1024px');
test_math_used('hypot(3px, 4px)', '5px');
test_math_used('hypot(3e+9px, 4e+9px)', '5e+9px');
test_math_used('calc(100px * hypot(3, 4))', '500px');
test_math_used('hypot(-5px)', '5px');
test_math_used('calc(1px * hypot(-5))', '5px');
test_math_used('calc(1px * hypot(10000))','10000px');
test_math_used('calc(2px * sqrt(100000000))','20000px');
test_math_used('calc(3px * pow(200, 4))', '33554428px');
test_math_used('calc(3px * pow(20, 4))', '480000px');
test_math_used('calc(-2 * hypot(3px, 4px))', '-10px');
test_math_used('hypot(0% + 3px, 0% + 4px)', '5px');
test_math_used('hypot(0% + 772.333px)', 'calc(0% + 772.333px)');
test_math_used('hypot(0% + 772.35px)', 'calc(0% + 772.35px)');
test_math_used('hypot(0% + 600px, 0% + 800px)', '1000px');

//Type checking hypot
test_math_used('hypot(1px)', '1px');
Expand Down
14 changes: 7 additions & 7 deletions css/css-values/hypot-pow-sqrt-serialize.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@
'1');

test_serialization(
'calc(pow(1,1) + 1)',
'calc(2)',
'2');
'calc(pow(1,1) - 0.5)',
'calc(0.5)',
'0.5');
test_serialization(
'calc(hypot(1) * 2)',
'calc(2)',
'2');
'calc(hypot(1) * 0.5)',
'calc(0.5)',
'0.5');
test_serialization(
'calc(sqrt(1) - 1)',
'calc(0)',
'0');
</script>
</script>

0 comments on commit 1097814

Please sign in to comment.