mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 20:29:18 +00:00
LibWeb: Delete parent state pointer in LayoutState
It's safe to remove this pointer because intrinsic layout should never look up a box's state beyond its containing block. This change affects the expectations of two layout tests, but both already differ slightly from other browsers, and the difference between expectations is less than 5px.
This commit is contained in:
parent
53cac71cec
commit
d8ff71fbb5
Notes:
github-actions[bot]
2025-03-26 12:09:02 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: d8ff71fbb5
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3929
5 changed files with 29 additions and 58 deletions
|
@ -18,11 +18,6 @@
|
|||
|
||||
namespace Web::Layout {
|
||||
|
||||
LayoutState::LayoutState(LayoutState const* parent)
|
||||
: m_parent(parent)
|
||||
{
|
||||
}
|
||||
|
||||
LayoutState::~LayoutState()
|
||||
{
|
||||
}
|
||||
|
@ -32,15 +27,6 @@ LayoutState::UsedValues& LayoutState::get_mutable(NodeWithStyle const& node)
|
|||
if (auto* used_values = used_values_per_layout_node.get(node).value_or(nullptr))
|
||||
return *used_values;
|
||||
|
||||
for (auto const* ancestor = m_parent; ancestor; ancestor = ancestor->m_parent) {
|
||||
if (auto* ancestor_used_values = ancestor->used_values_per_layout_node.get(node).value_or(nullptr)) {
|
||||
auto cow_used_values = adopt_own(*new UsedValues(*ancestor_used_values));
|
||||
auto* cow_used_values_ptr = cow_used_values.ptr();
|
||||
used_values_per_layout_node.set(node, move(cow_used_values));
|
||||
return *cow_used_values_ptr;
|
||||
}
|
||||
}
|
||||
|
||||
auto const* containing_block_used_values = node.is_viewport() ? nullptr : &get(*node.containing_block());
|
||||
|
||||
auto new_used_values = adopt_own(*new UsedValues);
|
||||
|
@ -55,11 +41,6 @@ LayoutState::UsedValues const& LayoutState::get(NodeWithStyle const& node) const
|
|||
if (auto const* used_values = used_values_per_layout_node.get(node).value_or(nullptr))
|
||||
return *used_values;
|
||||
|
||||
for (auto const* ancestor = m_parent; ancestor; ancestor = ancestor->m_parent) {
|
||||
if (auto const* ancestor_used_values = ancestor->used_values_per_layout_node.get(node).value_or(nullptr))
|
||||
return *ancestor_used_values;
|
||||
}
|
||||
|
||||
auto const* containing_block_used_values = node.is_viewport() ? nullptr : &get(*node.containing_block());
|
||||
|
||||
auto new_used_values = adopt_own(*new UsedValues);
|
||||
|
@ -205,9 +186,6 @@ static void build_paint_tree(Node& node, Painting::Paintable* parent_paintable =
|
|||
|
||||
void LayoutState::commit(Box& root)
|
||||
{
|
||||
// Only the top-level LayoutState should ever be committed.
|
||||
VERIFY(!m_parent);
|
||||
|
||||
// NOTE: In case this is a relayout of an existing tree, we start by detaching the old paint tree
|
||||
// from the layout tree. This is done to ensure that we don't end up with any old-tree pointers
|
||||
// when text paintables shift around in the tree.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue