diff --git a/Tests/LibWeb/Layout/expected/media-query-resolution.txt b/Tests/LibWeb/Layout/expected/media-query-resolution.txt new file mode 100644 index 0000000000..eae4f9b6b4 --- /dev/null +++ b/Tests/LibWeb/Layout/expected/media-query-resolution.txt @@ -0,0 +1,31 @@ +Viewport <#document> at (0,0) content-size 800x600 children: not-inline + BlockContainer at (0,0) content-size 800x600 [BFC] children: not-inline + BlockContainer at (8,16) content-size 784x68.875 children: not-inline + BlockContainer

at (8,16) content-size 784x35.40625 children: inline + line 0 width: 746.890625, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 88, rect: [8,16 746.890625x17.46875] + "NOTE: This test assumes that you're running with 1x pixels (which our test runner always" + line 1 width: 40.625, height: 17.9375, bottom: 35.40625, baseline: 13.53125 + frag 0 from TextNode start: 89, length: 5, rect: [8,33 40.625x17.46875] + "does." + TextNode <#text> + BlockContainer <(anonymous)> at (8,67.40625) content-size 784x0 children: inline + TextNode <#text> + BlockContainer at (8,67.40625) content-size 784x17.46875 children: inline + line 0 width: 49.734375, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 4, rect: [8,67.40625 49.734375x17.46875] + "PASS" + TextNode <#text> + BlockContainer <(anonymous)> at (8,84.875) content-size 784x0 children: inline + TextNode <#text> + TextNode <#text> + +ViewportPaintable (Viewport<#document>) [0,0 800x600] + PaintableWithLines (BlockContainer) [0,0 800x600] + PaintableWithLines (BlockContainer) [8,16 784x68.875] + PaintableWithLines (BlockContainer

) [8,16 784x35.40625] + TextPaintable (TextNode<#text>) + PaintableWithLines (BlockContainer(anonymous)) [8,67.40625 784x0] + PaintableWithLines (BlockContainer

.pass) [8,67.40625 784x17.46875] + TextPaintable (TextNode<#text>) + PaintableWithLines (BlockContainer(anonymous)) [8,84.875 784x0] diff --git a/Tests/LibWeb/Layout/input/media-query-resolution.html b/Tests/LibWeb/Layout/input/media-query-resolution.html new file mode 100644 index 0000000000..64264f6504 --- /dev/null +++ b/Tests/LibWeb/Layout/input/media-query-resolution.html @@ -0,0 +1,12 @@ + +

NOTE: This test assumes that you're running with 1x pixels (which our test runner always does.

+
PASS
+
FAIL
diff --git a/Userland/Libraries/LibWeb/HTML/Window.cpp b/Userland/Libraries/LibWeb/HTML/Window.cpp index 1b680335b0..cd08351429 100644 --- a/Userland/Libraries/LibWeb/HTML/Window.cpp +++ b/Userland/Libraries/LibWeb/HTML/Window.cpp @@ -546,7 +546,8 @@ Optional Window::query_media_feature(CSS::MediaFeatureID case CSS::MediaFeatureID::PrefersReducedTransparency: // FIXME: Make this a preference return CSS::MediaFeatureValue(CSS::ValueID::NoPreference); - // FIXME: resolution + case CSS::MediaFeatureID::Resolution: + return CSS::MediaFeatureValue(CSS::Resolution(device_pixel_ratio(), CSS::Resolution::Type::Dppx)); case CSS::MediaFeatureID::Scan: return CSS::MediaFeatureValue(CSS::ValueID::Progressive); case CSS::MediaFeatureID::Scripting: