From 00617884a66598c253032cd58a31a0351057d578 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Thu, 22 May 2025 16:57:38 +0100 Subject: [PATCH] LibWeb/CSS: Correct our `scan` media-feature Despite what the spec suggests, modern displays are not progressive, and WPT expects `@media (scan: progressive)` to fail. So, return `none` here to accurately represent that. I've left a FIXME in case we can detect the display type from the OS somehow in the future. Gets us 4 WPT subtest passes. --- Libraries/LibWeb/HTML/Window.cpp | 3 ++- .../css/mediaqueries/test_media_queries.txt | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Libraries/LibWeb/HTML/Window.cpp b/Libraries/LibWeb/HTML/Window.cpp index 133170f6052..eb214de60d7 100644 --- a/Libraries/LibWeb/HTML/Window.cpp +++ b/Libraries/LibWeb/HTML/Window.cpp @@ -406,7 +406,8 @@ Optional Window::query_media_feature(CSS::MediaFeatureID case CSS::MediaFeatureID::Resolution: return CSS::MediaFeatureValue(CSS::Resolution(device_pixel_ratio(), CSS::Resolution::Type::Dppx)); case CSS::MediaFeatureID::Scan: - return CSS::MediaFeatureValue(CSS::Keyword::Progressive); + // FIXME: Detect this from the display, if we can. Most displays aren't scanning and should return None. + return CSS::MediaFeatureValue(CSS::Keyword::None); case CSS::MediaFeatureID::Scripting: if (associated_document().is_scripting_enabled()) return CSS::MediaFeatureValue(CSS::Keyword::Enabled); 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 621cabb71b5..913dbcdd7ce 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 -1265 Pass -80 Fail +1269 Pass +76 Fail Pass query_should_be_parseable: (orientation) Pass query_should_be_parseable: not (orientation) Pass expression_should_be_known: (orientation) @@ -1211,11 +1211,11 @@ Pass expression_should_be_parseable: max-scan Pass expression_should_be_unknown: max-scan Pass expression_should_be_parseable: max-scan: progressive Pass expression_should_be_unknown: max-scan: progressive -Fail should_not_apply: (scan) -Fail should_not_apply: (scan: progressive) +Pass should_not_apply: (scan) +Pass should_not_apply: (scan: progressive) Pass should_not_apply: (scan: interlace) -Fail should_apply: not all and (scan) -Fail should_apply: not all and (scan: progressive) +Pass should_apply: not all and (scan) +Pass should_apply: not all and (scan: progressive) Pass should_apply: not all and (scan: interlace) Pass expression_should_be_known: grid Pass expression_should_be_known: grid: 0