mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-23 08:30:50 +00:00
LibWeb: Set up initial infrastructure for non-math functions in calc
There are some non-math functions (such as tree counting functions) which we should allow within `calc()`s . This commit implements the initial infrastructure for this. We don't yet parse any of these non-math functions in `parse_a_calculation` so there is no functional change.
This commit is contained in:
parent
831e471444
commit
55bcdcf824
Notes:
github-actions[bot]
2025-10-20 15:13:37 +00:00
Author: https://github.com/Calme1709
Commit: 55bcdcf824
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6426
Reviewed-by: https://github.com/AtkinsSJ ✅
5 changed files with 89 additions and 9 deletions
|
@ -19,6 +19,7 @@
|
|||
#include <AK/StringConversions.h>
|
||||
#include <AK/TemporaryChange.h>
|
||||
#include <LibWeb/CSS/FontFace.h>
|
||||
#include <LibWeb/CSS/MathFunctions.h>
|
||||
#include <LibWeb/CSS/Parser/ArbitrarySubstitutionFunctions.h>
|
||||
#include <LibWeb/CSS/Parser/ErrorReporter.h>
|
||||
#include <LibWeb/CSS/Parser/Parser.h>
|
||||
|
@ -4249,8 +4250,7 @@ RefPtr<CalculationNode const> Parser::convert_to_calculation_node(CalcParsing::N
|
|||
}
|
||||
|
||||
// 2. If leaf is a math function, replace leaf with the internal representation of that math function.
|
||||
// NOTE: All function tokens at this point should be math functions.
|
||||
if (component_value->is_function()) {
|
||||
if (component_value->is_function() && math_function_from_string(component_value->function().name).has_value()) {
|
||||
auto const& function = component_value->function();
|
||||
auto leaf_calculation = parse_a_calc_function_node(function, context);
|
||||
if (!leaf_calculation)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue