mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-05 15:49:15 +00:00
LibWeb/CSS: Reject @font-face
and margin rules that have a prelude
I couldn't find any WPT coverage for this, so here's a homemade test.
This commit is contained in:
parent
e072ddfebd
commit
1a599ceb98
Notes:
github-actions[bot]
2025-08-04 09:52:17 +00:00
Author: https://github.com/AtkinsSJ
Commit: 1a599ceb98
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5576
5 changed files with 47 additions and 2 deletions
|
@ -767,7 +767,16 @@ GC::Ptr<CSSFontFaceRule> Parser::convert_to_font_face_rule(AtRule const& rule)
|
|||
});
|
||||
return nullptr;
|
||||
}
|
||||
// FIXME: Prelude must be empty
|
||||
|
||||
prelude_stream.discard_whitespace();
|
||||
if (prelude_stream.has_next_token()) {
|
||||
ErrorReporter::the().report(CSS::Parser::InvalidRuleError {
|
||||
.rule_name = "@font-face"_fly_string,
|
||||
.prelude = prelude_stream.dump_string(),
|
||||
.description = "Prelude is not allowed."_string,
|
||||
});
|
||||
return {};
|
||||
}
|
||||
|
||||
DescriptorList descriptors { AtRuleID::FontFace };
|
||||
rule.for_each_as_declaration_list([&](auto& declaration) {
|
||||
|
@ -834,7 +843,15 @@ GC::Ptr<CSSMarginRule> Parser::convert_to_margin_rule(AtRule const& rule)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
// FIXME: Reject if there's a prelude
|
||||
prelude_stream.discard_whitespace();
|
||||
if (prelude_stream.has_next_token()) {
|
||||
ErrorReporter::the().report(CSS::Parser::InvalidRuleError {
|
||||
.rule_name = MUST(String::formatted("@{}", rule.name)),
|
||||
.prelude = prelude_stream.dump_string(),
|
||||
.description = "Prelude is not allowed."_string,
|
||||
});
|
||||
return {};
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/css-page-3/#syntax-page-selector
|
||||
// There are lots of these, but they're all in the format:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue