LibWeb/CSS: Implement device-aspect-ratio media feature

Gets us 8 WPT passes, and prevents a regression in the following commit.
This commit is contained in:
Sam Atkins 2025-05-22 12:02:01 +01:00
parent b577302f07
commit 72f50217b0
Notes: github-actions[bot] 2025-05-23 09:19:23 +00:00
2 changed files with 14 additions and 11 deletions

View file

@ -323,7 +323,10 @@ Optional<CSS::MediaFeatureValue> Window::query_media_feature(CSS::MediaFeatureID
return CSS::MediaFeatureValue(CSS::Keyword::Srgb);
case CSS::MediaFeatureID::ColorIndex:
return CSS::MediaFeatureValue(0);
// FIXME: device-aspect-ratio
case CSS::MediaFeatureID::DeviceAspectRatio: {
auto screen_area = page().client().screen_rect();
return CSS::MediaFeatureValue(CSS::Ratio(screen_area.width().value(), screen_area.height().value()));
}
case CSS::MediaFeatureID::DeviceHeight:
return CSS::MediaFeatureValue(CSS::Length::make_px(page().web_exposed_screen_area().height()));
case CSS::MediaFeatureID::DeviceWidth: