1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:38:11 +00:00

LibWeb: Ignore CSS properties with other people's vendor prefixes

This removes some `Property '-webkit-foo' has no value.` log spam. :^)
This commit is contained in:
Sam Atkins 2021-09-12 16:49:09 +01:00 committed by Andreas Kling
parent de31603028
commit 7817c681d0
2 changed files with 22 additions and 5 deletions

View file

@ -1312,12 +1312,16 @@ Optional<StyleProperty> Parser::convert_to_style_property(StyleDeclarationRule&
auto& property_name = declaration.m_name;
auto property_id = property_id_from_string(property_name);
if (property_id == PropertyID::Invalid && property_name.starts_with("--"))
property_id = PropertyID::Custom;
if (property_id == PropertyID::Invalid && !property_name.starts_with("-")) {
dbgln("Parser::convert_to_style_property(): Unrecognized property '{}'", property_name);
return {};
if (property_id == PropertyID::Invalid) {
if (property_name.starts_with("--")) {
property_id = PropertyID::Custom;
} else if (has_ignored_vendor_prefix(property_name)) {
return {};
} else if (!property_name.starts_with("-")) {
dbgln("Parser::convert_to_style_property(): Unrecognized property '{}'", property_name);
return {};
}
}
auto value_token_stream = TokenStream(declaration.m_values);
@ -3475,6 +3479,17 @@ OwnPtr<CalculatedStyleValue::CalcSum> Parser::parse_calc_sum(ParsingContext cons
return make<CalculatedStyleValue::CalcSum>(parsed_calc_product.release_nonnull(), move(additional));
}
bool Parser::has_ignored_vendor_prefix(StringView const& string)
{
if (!string.starts_with('-'))
return false;
if (string.starts_with("--"))
return false;
if (string.starts_with("-libweb-"))
return false;
return true;
}
}
namespace Web {