mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
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:
Notes:
github-actions[bot]
2025-10-07 09:34:36 +00:00
Author: https://github.com/Calme1709 Commit: https://github.com/LadybirdBrowser/ladybird/commit/05c336ea4e0 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6412 Reviewed-by: https://github.com/AtkinsSJ ✅
@@ -109,7 +109,7 @@ void StyleSheetList::add_sheet(CSSStyleSheet& sheet)
|
||||
// NOTE: We evaluate media queries immediately when adding a new sheet.
|
||||
// This coalesces the full document style invalidations.
|
||||
// If we don't do this, we invalidate now, and then again when Document updates media rules.
|
||||
sheet.evaluate_media_queries(as<HTML::Window>(HTML::relevant_global_object(*this)));
|
||||
sheet.evaluate_media_queries(document());
|
||||
|
||||
if (sheet.rules().length() == 0) {
|
||||
// NOTE: If the added sheet has no rules, we don't have to invalidate anything.
|
||||
|
||||
Reference in New Issue
Block a user