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 ✅
@@ -353,14 +353,14 @@ GC::Ptr<DOM::Document> CSSStyleSheet::owning_document() const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool CSSStyleSheet::evaluate_media_queries(HTML::Window const& window)
|
||||
bool CSSStyleSheet::evaluate_media_queries(DOM::Document const& document)
|
||||
{
|
||||
bool any_media_queries_changed_match_state = false;
|
||||
|
||||
bool now_matches = m_media->evaluate(window);
|
||||
bool now_matches = m_media->evaluate(document);
|
||||
if (!m_did_match.has_value() || m_did_match.value() != now_matches)
|
||||
any_media_queries_changed_match_state = true;
|
||||
if (now_matches && m_rules->evaluate_media_queries(window))
|
||||
if (now_matches && m_rules->evaluate_media_queries(document))
|
||||
any_media_queries_changed_match_state = true;
|
||||
|
||||
m_did_match = now_matches;
|
||||
|
||||
Reference in New Issue
Block a user