mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 20:29:18 +00:00
LibWeb: Move "needs layout update" flag from DOM to layout tree
This is in preparation for allowing anonymous boxes to retain their intrinsic size cache across layouts.
This commit is contained in:
parent
a122685896
commit
3c15fec303
Notes:
github-actions[bot]
2025-04-20 22:32:22 +00:00
Author: https://github.com/awesomekling
Commit: 3c15fec303
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4411
11 changed files with 51 additions and 44 deletions
|
@ -1281,4 +1281,25 @@ void NodeWithStyleAndBoxModelMetrics::visit_edges(Cell::Visitor& visitor)
|
|||
visitor.visit(m_continuation_of_node);
|
||||
}
|
||||
|
||||
void Node::set_needs_layout_update(DOM::SetNeedsLayoutReason reason)
|
||||
{
|
||||
if (m_needs_layout_update)
|
||||
return;
|
||||
|
||||
if constexpr (UPDATE_LAYOUT_DEBUG) {
|
||||
// NOTE: We check some conditions here to avoid debug spam in documents that don't do layout.
|
||||
auto navigable = this->navigable();
|
||||
if (navigable && navigable->active_document() == &document())
|
||||
dbgln_if(UPDATE_LAYOUT_DEBUG, "NEED LAYOUT {}", DOM::to_string(reason));
|
||||
}
|
||||
|
||||
m_needs_layout_update = true;
|
||||
|
||||
for (auto* ancestor = parent(); ancestor; ancestor = ancestor->parent()) {
|
||||
if (ancestor->m_needs_layout_update)
|
||||
break;
|
||||
ancestor->m_needs_layout_update = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue