mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-24 03:52:58 +00:00
LibWeb: Simplify standalone CSS math functions when used outside calc()
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Math functions like abs(), clamp(), round(), etc, can be used by themselves in property values, without wrapping them in calc(). Before this change, we were neglecting to run calc simplification on the generated calculation node trees. By doing that manually after parsing a standalone math function, we score at least a couple hundred WPT points.
This commit is contained in:
parent
94ae63c436
commit
0553bcb35b
Notes:
github-actions[bot]
2025-04-24 18:38:57 +00:00
Author: https://github.com/awesomekling
Commit: 0553bcb35b
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4458
10 changed files with 1298 additions and 2 deletions
|
@ -3515,8 +3515,11 @@ RefPtr<CalculationNode const> Parser::parse_a_calc_function_node(Function const&
|
|||
if (function.name.equals_ignoring_ascii_case("calc"sv))
|
||||
return parse_a_calculation(function.value, context);
|
||||
|
||||
if (auto maybe_function = parse_math_function(function, context))
|
||||
return maybe_function;
|
||||
if (auto maybe_function = parse_math_function(function, context)) {
|
||||
// NOTE: We have to simplify manually here, since parse_math_function() is a helper for calc() parsing
|
||||
// that doesn't do it directly by itself.
|
||||
return simplify_a_calculation_tree(*maybe_function, context, CalculationResolutionContext {});
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue