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

LibWeb: Add Ratio type to MediaFeatureValue

As noted, the Parser can't handle the `<number>` syntax for this - it
gets parsed instead by the `<number>` branch. We can't actually resolve
the ambiguity without making the Parser aware of what type each
media-feature is, but I will get to that soon. :^)
This commit is contained in:
Sam Atkins 2022-03-06 17:50:56 +00:00 committed by Andreas Kling
parent 5f93f1c161
commit deea129b8c
4 changed files with 50 additions and 7 deletions

View file

@ -381,7 +381,8 @@ Optional<CSS::MediaFeatureValue> Window::query_media_feature(FlyString const& na
return CSS::MediaFeatureValue("hover");
if (name.equals_ignoring_case("any-pointer"sv))
return CSS::MediaFeatureValue("fine");
// FIXME: aspect-ratio
if (name.equals_ignoring_case("aspect-ratio"sv))
return CSS::MediaFeatureValue(CSS::Ratio(inner_width(), inner_height()));
if (name.equals_ignoring_case("color"sv))
return CSS::MediaFeatureValue(8);
if (name.equals_ignoring_case("color-gamut"sv))