mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 17:55:07 +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 ✅
@@ -1188,7 +1188,7 @@ static void update_the_source_set(DOM::Element& element)
|
||||
if (child->has_attribute(HTML::AttributeNames::media)) {
|
||||
auto media_query = parse_media_query(CSS::Parser::ParsingParams { element.document() },
|
||||
child->get_attribute_value(HTML::AttributeNames::media));
|
||||
if (!media_query || !element.document().window() || !media_query->evaluate(*element.document().window())) {
|
||||
if (!media_query || !media_query->evaluate(element.document())) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user