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
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

@ -15,7 +15,7 @@ Supports::Supports(NonnullOwnPtr<BooleanExpression>&& condition)
m_matches = m_condition->evaluate_to_boolean(nullptr);
}
MatchResult Supports::Declaration::evaluate(HTML::Window const*) const
MatchResult Supports::Declaration::evaluate(DOM::Document const*) const
{
return as_match_result(m_matches);
}
@ -31,7 +31,7 @@ void Supports::Declaration::dump(StringBuilder& builder, int indent_levels) cons
builder.appendff("Declaration: `{}`, matches={}\n", m_declaration, m_matches);
}
MatchResult Supports::Selector::evaluate(HTML::Window const*) const
MatchResult Supports::Selector::evaluate(DOM::Document const*) const
{
return as_match_result(m_matches);
}
@ -47,7 +47,7 @@ void Supports::Selector::dump(StringBuilder& builder, int indent_levels) const
builder.appendff("Selector: `{}` matches={}\n", m_selector, m_matches);
}
MatchResult Supports::FontTech::evaluate(HTML::Window const*) const
MatchResult Supports::FontTech::evaluate(DOM::Document const*) const
{
return as_match_result(m_matches);
}
@ -63,7 +63,7 @@ void Supports::FontTech::dump(StringBuilder& builder, int indent_levels) const
builder.appendff("FontTech: `{}` matches={}\n", m_tech, m_matches);
}
MatchResult Supports::FontFormat::evaluate(HTML::Window const*) const
MatchResult Supports::FontFormat::evaluate(DOM::Document const*) const
{
return as_match_result(m_matches);
}