mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-16 13:09:41 +00:00
LibWeb/CSS: Stop rejecting declarations with vendor-prefixed keywords
property_accepts_type() only looks at the property itself, not any longhands it might have, so we thought that `font` didn't accept `<custom-ident>`s, and seeing "-apple-..." makes us throw out the declaration even though it's valid as a font name. We'll reject these like any other unrecognized value if it's somewhere that's not supported, so this was really just an optimization for a rare edge case, and removing the check doesn't have any observable effect except fixing this bug and any similar cases. Changing property_accepts_type() to look at longhands is not straightforward, as not all longhand values are valid in the shorthand.
This commit is contained in:
parent
b3bdb202f8
commit
89c89470ef
Notes:
github-actions[bot]
2025-10-02 11:27:30 +00:00
Author: https://github.com/AtkinsSJ
Commit: 89c89470ef
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6366
Reviewed-by: https://github.com/gmta ✅
3 changed files with 18 additions and 9 deletions
|
@ -396,10 +396,8 @@ Parser::ParseErrorOr<NonnullRefPtr<StyleValue const>> Parser::parse_css_value(Pr
|
|||
{
|
||||
auto context_guard = push_temporary_value_parsing_context(property_id);
|
||||
|
||||
// FIXME: Stop removing whitespace here. It's less helpful than it seems.
|
||||
Vector<ComponentValue> component_values;
|
||||
SubstitutionFunctionsPresence substitution_presence;
|
||||
bool const property_accepts_custom_ident = property_accepts_type(property_id, ValueType::CustomIdent);
|
||||
|
||||
while (unprocessed_tokens.has_next_token()) {
|
||||
auto const& token = unprocessed_tokens.consume_a_token();
|
||||
|
@ -409,13 +407,9 @@ Parser::ParseErrorOr<NonnullRefPtr<StyleValue const>> Parser::parse_css_value(Pr
|
|||
return ParseError::SyntaxError;
|
||||
}
|
||||
|
||||
if (property_id != PropertyID::Custom) {
|
||||
if (token.is(Token::Type::Whitespace))
|
||||
continue;
|
||||
|
||||
if (!property_accepts_custom_ident && token.is(Token::Type::Ident) && has_ignored_vendor_prefix(token.token().ident()))
|
||||
return ParseError::IncludesIgnoredVendorPrefix;
|
||||
}
|
||||
// FIXME: Stop removing whitespace here. It's less helpful than it seems.
|
||||
if (property_id != PropertyID::Custom && token.is(Token::Type::Whitespace))
|
||||
continue;
|
||||
|
||||
if (token.is_function())
|
||||
token.function().contains_arbitrary_substitution_function(substitution_presence);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue