1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:17:46 +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:
Andreas Kling 2023-08-18 12:30:27 +02:00
parent 4d4dbacfc3
commit 216bd513fa
5 changed files with 33 additions and 46 deletions

View file

@ -48,17 +48,14 @@ enum class HitTestType {
TextCursor, // Clicking past the right/bottom edge of text will still hit the text
};
class Paintable : public JS::Cell {
class Paintable
: public JS::Cell
, public TreeNode<Paintable> {
JS_CELL(Paintable, Cell);
public:
virtual ~Paintable() = default;
Paintable const* first_child() const;
Paintable const* last_child() const;
Paintable const* next_sibling() const;
Paintable const* previous_sibling() const;
template<typename U, typename Callback>
TraversalDecision for_each_in_inclusive_subtree_of_type(Callback callback) const
{