mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
LibWeb: Always do parent document layout updates before updating style
We were doing this manually within `Document::update_layout()` and `CSSStyleProperties::get_direct_property()` but we should do it for all callers of `Document::update_style()`
This commit is contained in:
parent
b5db79be6d
commit
56e2ac8a9d
Notes:
github-actions[bot]
2025-11-02 22:55:42 +00:00
Author: https://github.com/Calme1709
Commit: 56e2ac8a9d
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6642
Reviewed-by: https://github.com/AtkinsSJ ✅
5 changed files with 38 additions and 13 deletions
|
|
@ -517,14 +517,6 @@ Optional<StyleProperty> CSSStyleProperties::get_direct_property(PropertyNameAndI
|
|||
|
||||
Layout::NodeWithStyle* layout_node = abstract_element.layout_node();
|
||||
|
||||
// Pending changes to an ancestor document's layout can affect an element's computed style e.g. an IFrame's
|
||||
// width being changed can affect media query evaluation and the value of the `vw` unit.
|
||||
// FIXME: This is likely overkill and can be optimized
|
||||
for (auto const& navigable : abstract_element.document().ancestor_navigables()) {
|
||||
if (navigable->active_document())
|
||||
navigable->active_document()->update_layout(DOM::UpdateLayoutReason::ResolvedCSSStyleDeclarationProperty);
|
||||
}
|
||||
|
||||
// FIXME: Be smarter about updating layout if there's no layout node.
|
||||
// We may legitimately have no layout node if we're not visible, but this protects against situations
|
||||
// where we're requesting the computed style before layout has happened.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue