summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2021-09-12 16:49:09 +0100
committerAndreas Kling <kling@serenityos.org>2021-09-12 21:34:57 +0200
commit7817c681d0dbae08e6421b8201911bbb1323cd03 (patch)
tree65442340ae59bd03f6f6ec68071516e994d682fd /Userland/Libraries/LibWeb
parentde31603028e6bf4e0840796d5d3162044c8d56b3 (diff)
downloadserenity-7817c681d0dbae08e6421b8201911bbb1323cd03.zip
LibWeb: Ignore CSS properties with other people's vendor prefixes
This removes some `Property '-webkit-foo' has no value.` log spam. :^)
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r--Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp25
-rw-r--r--Userland/Libraries/LibWeb/CSS/Parser/Parser.h2
2 files changed, 22 insertions, 5 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
index 0fe7343138..afb454a57c 100644
--- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
+++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
@@ -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 {
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.h b/Userland/Libraries/LibWeb/CSS/Parser/Parser.h
index 7b9c566fbc..66800c7cc1 100644
--- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.h
+++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.h
@@ -216,6 +216,8 @@ private:
Optional<Selector::Combinator> parse_selector_combinator(TokenStream<StyleComponentValueRule>&);
Result<Selector::SimpleSelector, SelectorParsingResult> parse_simple_selector(TokenStream<StyleComponentValueRule>&);
+ static bool has_ignored_vendor_prefix(StringView const&);
+
ParsingContext m_context;
Tokenizer m_tokenizer;