1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-02 23:12:08 +00:00

LibWeb: Implement <resolution> as a media feature type

This is the only dimension type besides `<length>` that is used in any
media queries in levels 4 or 5 right now. Others can be included
if/when they're needed.
This commit is contained in:
Sam Atkins 2022-02-22 14:09:19 +00:00 committed by Andreas Kling
parent 53a3937c34
commit fd2ef43cb4
3 changed files with 42 additions and 4 deletions

View file

@ -1149,8 +1149,12 @@ Optional<MediaFeatureValue> Parser::parse_media_feature_value(TokenStream<StyleC
return MediaFeatureValue(first.token().number_value());
// `<dimension>`
if (auto length = parse_length(first); length.has_value())
return MediaFeatureValue(length.release_value());
if (auto dimension = parse_dimension(first); dimension.has_value()) {
if (dimension->is_length())
return MediaFeatureValue(dimension->length());
if (dimension->is_resolution())
return MediaFeatureValue(dimension->resolution());
}
// `<ident>`
if (first.is(Token::Type::Ident))