LibWeb: Check navigable container for whether element needs style update

The style of an element depends on it's navigable's viewport size which
in turn depends on the navigable's container's style - so if requires a
style update then so does the original element.
This commit is contained in:
Callum Law
2026-03-02 14:37:49 +13:00
committed by Sam Atkins
parent 7f3b8bb587
commit 33c0e55762
Notes: github-actions[bot] 2026-03-09 14:37:47 +00:00
3 changed files with 53 additions and 0 deletions

View File

@@ -1826,6 +1826,15 @@ bool Document::element_needs_style_update(AbstractElement const& abstract_elemen
return true;
}
// If the navigable has a container and that container needs a style update, then we need one as well, since the
// container's style can affect this element (e.g. via media queries or viewport units).
if (auto navigable = this->navigable()) {
if (auto container = navigable->container()) {
if (container->document().element_needs_style_update(AbstractElement { *container }))
return true;
}
}
return false;
}