LibWeb/CSS: Use ErrorReporter for value-parsing errors

Also remove some redundant reporting for `<urange>` parsing errors.
This commit is contained in:
Sam Atkins 2025-07-23 11:04:17 +01:00
commit cebdcd9f69
Notes: github-actions[bot] 2025-08-04 09:52:05 +00:00
5 changed files with 239 additions and 61 deletions

View file

@ -6,6 +6,7 @@
#include <AK/GenericShorthands.h>
#include <LibWeb/CSS/Parser/ArbitrarySubstitutionFunctions.h>
#include <LibWeb/CSS/Parser/ErrorReporter.h>
#include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/CSS/Parser/Syntax.h>
#include <LibWeb/CSS/Parser/SyntaxParsing.h>
@ -251,7 +252,11 @@ RefPtr<CSSStyleValue const> Parser::parse_according_to_syntax_node(TokenStream<C
return nullptr;
}
dbgln_if(CSS_PARSER_DEBUG, "Couldn't parse `<{}>` because we don't know what it is.", type_name);
ErrorReporter::the().report(InvalidValueError {
.value_type = MUST(String::formatted("<{}>", type_name)),
.value_string = tokens.dump_string(),
.description = "Unknown type in <syntax>."_string,
});
return nullptr;
}
case SyntaxNode::NodeType::Multiplier: {