style: Support -webkit-image-set as a parse-time alias to image-set()

The webkit syntax is an strict subset of the modern one, so this should
be doable, and is the simplest.

If my reading of the WebKit code is correct it should also be the way
WebKit deals with this (except they restrict -webkit-image-set() syntax
artificially).

 * https://github.com/w3c/csswg-drafts/issues/6285
 * https://github.com/whatwg/compat/issues/144

Differential Revision: https://phabricator.services.mozilla.com/D114912
This commit is contained in:
Emilio Cobos Álvarez 2023-05-21 21:25:19 +02:00 committed by Oriol Brufau
parent 032cf64d1b
commit 3cf8c19313

View file

@ -365,7 +365,14 @@ impl ImageSet {
cors_mode: CorsMode,
only_url: bool,
) -> Result<Self, ParseError<'i>> {
input.expect_function_matching("image-set")?;
let function = input.expect_function()?;
match_ignore_ascii_case! { &function,
"-webkit-image-set" | "image-set" => {},
_ => {
let func = function.clone();
return Err(input.new_custom_error(StyleParseErrorKind::UnexpectedFunction(func)));
}
}
let items = input.parse_nested_block(|input| {
input.parse_comma_separated(|input| ImageSetItem::parse(context, input, cors_mode, only_url))
})?;