mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:27:35 +00:00
LibWeb: Make the paint tree a proper standalone tree
Until now, paint trees have been piggybacking on the layout tree for traversal, and paintables didn't actually have their own parent/child pointers. This patch changes that by making Paintable inherit from TreeNode, and adding a new pass to LayoutState::commit() where we recursively build the new paint tree.
This commit is contained in:
parent
4d4dbacfc3
commit
216bd513fa
5 changed files with 33 additions and 46 deletions
|
@ -44,38 +44,6 @@ Optional<HitTestResult> Paintable::hit_test(CSSPixelPoint, HitTestType) const
|
|||
return {};
|
||||
}
|
||||
|
||||
Paintable const* Paintable::first_child() const
|
||||
{
|
||||
auto const* layout_child = m_layout_node->first_child();
|
||||
for (; layout_child && !layout_child->paintable(); layout_child = layout_child->next_sibling())
|
||||
;
|
||||
return layout_child ? layout_child->paintable() : nullptr;
|
||||
}
|
||||
|
||||
Paintable const* Paintable::next_sibling() const
|
||||
{
|
||||
auto const* layout_node = m_layout_node->next_sibling();
|
||||
for (; layout_node && !layout_node->paintable(); layout_node = layout_node->next_sibling())
|
||||
;
|
||||
return layout_node ? layout_node->paintable() : nullptr;
|
||||
}
|
||||
|
||||
Paintable const* Paintable::last_child() const
|
||||
{
|
||||
auto const* layout_child = m_layout_node->last_child();
|
||||
for (; layout_child && !layout_child->paintable(); layout_child = layout_child->previous_sibling())
|
||||
;
|
||||
return layout_child ? layout_child->paintable() : nullptr;
|
||||
}
|
||||
|
||||
Paintable const* Paintable::previous_sibling() const
|
||||
{
|
||||
auto const* layout_node = m_layout_node->previous_sibling();
|
||||
for (; layout_node && !layout_node->paintable(); layout_node = layout_node->previous_sibling())
|
||||
;
|
||||
return layout_node ? layout_node->paintable() : nullptr;
|
||||
}
|
||||
|
||||
StackingContext const* Paintable::stacking_context_rooted_here() const
|
||||
{
|
||||
if (!layout_node().is_box())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue