mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 02:05:07 +02:00
LibWeb: Correctly compute consistent type when simplifying hypot
Previously we would never get a valid `consistent_type` as we were trying to make the node types consistent with the initial empty type which isn't possible. Gains us 7 WPT tests.
This commit is contained in:
committed by
Andreas Kling
parent
04a3a227c3
commit
8e9753eadb
Notes:
github-actions[bot]
2025-06-30 12:54:14 +00:00
Author: https://github.com/Calme1709 Commit: https://github.com/LadybirdBrowser/ladybird/commit/8e9753eadbb Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5241
@@ -0,0 +1,70 @@
|
||||
<!DOCTYPE html>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-values-4/#exponent-funcs">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-values-4/#numbers">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-values-4/#calc-type-checking">
|
||||
<link rel="author" title="Apple Inc">
|
||||
<script src="../../resources/testharness.js"></script>
|
||||
<script src="../../resources/testharnessreport.js"></script>
|
||||
<script src="../support/parsing-testcommon.js"></script>
|
||||
<script>
|
||||
function test_invalid_number(value) {
|
||||
test_invalid_value('opacity', value);
|
||||
}
|
||||
function test_invalid_length(value) {
|
||||
// 'outline-offset' accepts <length> only, not <percentage> or any mixes.
|
||||
test_invalid_value('outline-offset', value);
|
||||
}
|
||||
|
||||
// Syntax checking
|
||||
test_invalid_number('hypot()');
|
||||
test_invalid_number('hypot( )');
|
||||
test_invalid_number('hypot(,)');
|
||||
test_invalid_number('hypot(1, )');
|
||||
test_invalid_number('hypot(, 1)');
|
||||
test_invalid_number('hypot(1 + )');
|
||||
test_invalid_number('hypot(1 - )');
|
||||
test_invalid_number('hypot(1 * )');
|
||||
test_invalid_number('hypot(1 / )');
|
||||
test_invalid_number('hypot(1 2)');
|
||||
test_invalid_number('hypot(1, , 2)');
|
||||
test_invalid_number('sqrt()');
|
||||
test_invalid_number('sqrt( )');
|
||||
test_invalid_number('sqrt(,)');
|
||||
test_invalid_number('sqrt(1, )');
|
||||
test_invalid_number('sqrt(, 1)');
|
||||
test_invalid_number('sqrt(1 + )');
|
||||
test_invalid_number('sqrt(1 - )');
|
||||
test_invalid_number('sqrt(1 * )');
|
||||
test_invalid_number('sqrt(1 / )');
|
||||
test_invalid_number('sqrt(1 2)');
|
||||
test_invalid_number('sqrt(1, , 2)');
|
||||
test_invalid_number('sqrt(1, 2)');
|
||||
test_invalid_number('pow( )');
|
||||
test_invalid_number('pow(,)');
|
||||
test_invalid_number('pow(1, )');
|
||||
test_invalid_number('pow(, 1)');
|
||||
test_invalid_number('pow(1 + )');
|
||||
test_invalid_number('pow(1 - )');
|
||||
test_invalid_number('pow(1 * )');
|
||||
test_invalid_number('pow(1 / )');
|
||||
test_invalid_number('pow(1 2)');
|
||||
test_invalid_number('pow(1, , 2)');
|
||||
test_invalid_number('pow(2px, 2)');
|
||||
test_invalid_number('pow(10, 1px)');
|
||||
|
||||
// General tests
|
||||
test_invalid_length('calc(1px * pow(1))');
|
||||
test_invalid_length('calc(1px * pow(2px, 3px))');
|
||||
test_invalid_length('calc(sqrt(100px)');
|
||||
test_invalid_length('hypot(2px, 3)');
|
||||
test_invalid_length('hypot(3, ,4)');
|
||||
test_invalid_length('hypot(1, 2)');
|
||||
test_invalid_length('calc(1px * pow(2 3))');
|
||||
test_invalid_length('hypot()');
|
||||
test_invalid_length('calc(pow(2))');
|
||||
test_invalid_length('pow())');
|
||||
test_invalid_length('pow(1, 2)');
|
||||
test_invalid_length('calc(sqrt())');
|
||||
test_invalid_length('calc(sqrt(100, 200))');
|
||||
test_invalid_length('pow(10px, 1)');
|
||||
</script>
|
||||
Reference in New Issue
Block a user