mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-19 15:32:31 +00:00
LibWeb: Bring back cache of intrinsic sizes across layout runs
12c6ac78e2
with fixed mistake when cache
slot is copied instead of being referenced:
```cpp
auto cache =
box.cached_intrinsic_sizes().min_content_height.ensure(width);
```
while it should've been:
```cpp
auto& cache =
box.cached_intrinsic_sizes().min_content_height.ensure(width);
```
This commit is contained in:
parent
73a4b176cf
commit
a4463c45b9
Notes:
github-actions[bot]
2025-03-08 13:53:25 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: a4463c45b9
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3857
13 changed files with 108 additions and 102 deletions
|
@ -1405,7 +1405,7 @@ void Node::set_needs_layout_tree_update(bool value)
|
|||
break;
|
||||
ancestor->m_child_needs_layout_tree_update = true;
|
||||
}
|
||||
document().set_needs_layout(SetNeedsLayoutReason::LayoutTreeUpdate);
|
||||
set_needs_layout_update(SetNeedsLayoutReason::LayoutTreeUpdate);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1425,6 +1425,27 @@ void Node::set_needs_style_update(bool value)
|
|||
}
|
||||
}
|
||||
|
||||
void Node::set_needs_layout_update(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() == this)
|
||||
dbgln_if(UPDATE_LAYOUT_DEBUG, "NEED LAYOUT {}", to_string(reason));
|
||||
}
|
||||
|
||||
m_needs_layout_update = true;
|
||||
|
||||
for (auto* ancestor = parent_or_shadow_host(); ancestor; ancestor = ancestor->parent_or_shadow_host()) {
|
||||
if (ancestor->m_needs_layout_update)
|
||||
break;
|
||||
ancestor->m_needs_layout_update = true;
|
||||
}
|
||||
}
|
||||
|
||||
void Node::post_connection()
|
||||
{
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue