LibWeb: Use document's viewport when resolving lengths in media queries

Previously we would always use the window's viewport which was incorrect
if we were within an iframe.

This is likely applicable to all uses of
`Length::ResolutionContext::for_window`.
This commit is contained in:
Callum Law
2025-10-07 00:54:19 +13:00
committed by Sam Atkins
parent c33be71df9
commit 05c336ea4e
Notes: github-actions[bot] 2025-10-07 09:34:36 +00:00
23 changed files with 198 additions and 83 deletions

View File

@@ -2,17 +2,17 @@ Harness status: OK
Found 12 tests
2 Pass
10 Fail
11 Pass
1 Fail
Pass box should be orange if the calc between px-em in @media was correct
Fail box should be orange if the calc between vh+em in @media was correct
Fail box should be orange if the calc between vw-em in @media was correct
Fail box should be orange if the calc between vw+vh in @media was correct
Fail box should be orange if the calc between vh+px in @media was correct
Fail box should be orange if the calc between vw+px in @media was correct
Pass box should be orange if the calc between vh+em in @media was correct
Pass box should be orange if the calc between vw-em in @media was correct
Pass box should be orange if the calc between vw+vh in @media was correct
Pass box should be orange if the calc between vh+px in @media was correct
Pass box should be orange if the calc between vw+px in @media was correct
Pass box should be orange if the calc between px/em*em in @media was correct
Fail box should be orange if the calc between vh*em in @media was correct
Pass box should be orange if the calc between vh*em in @media was correct
Fail box should be orange if the calc between vh*vw/em*px/vh in @media was correct
Fail box should be orange if the calc between vw/px*vh in @media was correct
Fail box should be orange if the calc between vh*vw/em*px in @media was correct
Fail box should be orange if the calc between vw*vh*px*em/px/px/px in @media was correct
Pass box should be orange if the calc between vw/px*vh in @media was correct
Pass box should be orange if the calc between vh*vw/em*px in @media was correct
Pass box should be orange if the calc between vw*vh*px*em/px/px/px in @media was correct

View File

@@ -0,0 +1,31 @@
Harness status: OK
Found 26 tests
26 Pass
Pass @media(width:100vw) applies
Pass @media(width:100vi) applies
Pass @media(width:100vmax) applies
Pass @media(width:100svw) applies
Pass @media(width:100svi) applies
Pass @media(width:100svmax) applies
Pass @media(width:100lvw) applies
Pass @media(width:100lvi) applies
Pass @media(width:100lvmax) applies
Pass @media(width:100dvw) applies
Pass @media(width:100dvi) applies
Pass @media(width:100dvmax) applies
Pass @media(height:100vh) applies
Pass @media(height:100vb) applies
Pass @media(height:100vmin) applies
Pass @media(height:100svh) applies
Pass @media(height:100svb) applies
Pass @media(height:100svmin) applies
Pass @media(height:100lvh) applies
Pass @media(height:100lvb) applies
Pass @media(height:100lvmin) applies
Pass @media(height:100dvh) applies
Pass @media(height:100dvb) applies
Pass @media(height:100dvmin) applies
Pass @media(width:90vw) does not apply
Pass @media(height:90vh) does not apply