diff --git a/Libraries/LibWeb/HTML/Window.cpp b/Libraries/LibWeb/HTML/Window.cpp index 3baff34016a..133170f6052 100644 --- a/Libraries/LibWeb/HTML/Window.cpp +++ b/Libraries/LibWeb/HTML/Window.cpp @@ -323,7 +323,10 @@ Optional 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: diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/mediaqueries/test_media_queries.txt b/Tests/LibWeb/Text/expected/wpt-import/css/mediaqueries/test_media_queries.txt index ed5e943fd28..621cabb71b5 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/css/mediaqueries/test_media_queries.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/css/mediaqueries/test_media_queries.txt @@ -2,8 +2,8 @@ Harness status: OK Found 1345 tests -1257 Pass -88 Fail +1265 Pass +80 Fail Pass query_should_be_parseable: (orientation) Pass query_should_be_parseable: not (orientation) Pass expression_should_be_known: (orientation) @@ -1015,22 +1015,22 @@ Fail should_apply: (max-aspect-ratio: 60/80) Fail should_apply: (max-aspect-ratio: 59/79) Pass expression_should_be_parseable: max-aspect-ratio Pass expression_should_be_unknown: max-aspect-ratio -Fail should_apply: (device-aspect-ratio: ${real_dar}) +Pass should_apply: (device-aspect-ratio: ${real_dar}) Pass should_apply: not all and (device-aspect-ratio: ${high_dar_1}) Pass should_not_apply: all and (device-aspect-ratio: ${high_dar_2}) Pass should_not_apply: all and (device-aspect-ratio: ${low_dar_1}) Pass should_apply: not all and (device-aspect-ratio: ${low_dar_2}) -Fail should_apply: (device-aspect-ratio) -Fail should_apply: (min-device-aspect-ratio: ${real_dar}) +Pass should_apply: (device-aspect-ratio) +Pass should_apply: (min-device-aspect-ratio: ${real_dar}) Pass should_not_apply: all and (min-device-aspect-ratio: ${high_dar_1}) Pass should_apply: not all and (min-device-aspect-ratio: ${high_dar_2}) -Fail should_not_apply: not all and (min-device-aspect-ratio: ${low_dar_1}) -Fail should_apply: all and (min-device-aspect-ratio: ${low_dar_2}) +Pass should_not_apply: not all and (min-device-aspect-ratio: ${low_dar_1}) +Pass should_apply: all and (min-device-aspect-ratio: ${low_dar_2}) Pass expression_should_be_parseable: min-device-aspect-ratio Pass expression_should_be_unknown: min-device-aspect-ratio -Fail should_apply: all and (max-device-aspect-ratio: ${real_dar}) -Fail should_apply: (max-device-aspect-ratio: ${high_dar_1}) -Fail should_apply: (max-device-aspect-ratio: ${high_dar_2}) +Pass should_apply: all and (max-device-aspect-ratio: ${real_dar}) +Pass should_apply: (max-device-aspect-ratio: ${high_dar_1}) +Pass should_apply: (max-device-aspect-ratio: ${high_dar_2}) Pass should_not_apply: all and (max-device-aspect-ratio: ${low_dar_1}) Pass should_apply: not all and (max-device-aspect-ratio: ${low_dar_2}) Pass expression_should_be_parseable: max-device-aspect-ratio