1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:47:44 +00:00

LibWeb: Support parsing some data: URLs in CSS

For now, data URLs are explicitly limited to expected MIME types. For
example, image-related styles accept image MIME types.
This commit is contained in:
Timothy Flynn 2021-10-29 08:38:50 -04:00 committed by Andreas Kling
parent 1e6afa9fd5
commit eb0fb38cac
2 changed files with 28 additions and 11 deletions

View file

@ -195,7 +195,12 @@ private:
static Optional<float> try_parse_float(StringView string);
static Optional<Color> parse_color(ParsingContext const&, StyleComponentValueRule const&);
static Optional<Length> parse_length(ParsingContext const&, StyleComponentValueRule const&);
static Optional<AK::URL> parse_url_function(ParsingContext const&, StyleComponentValueRule const&);
enum class AllowedDataUrlType {
None,
Image,
};
static Optional<AK::URL> parse_url_function(ParsingContext const&, StyleComponentValueRule const&, AllowedDataUrlType = AllowedDataUrlType::None);
Result<NonnullRefPtr<StyleValue>, ParsingResult> parse_css_value(PropertyID, TokenStream<StyleComponentValueRule>&);
static RefPtr<StyleValue> parse_css_value(ParsingContext const&, StyleComponentValueRule const&);