1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 07:18:13 +00:00

LibHTML: Move is_ancestor_of() from LayoutNode to TreeNode

This way it becomes available to all the different TreeNode subclasses.
This commit is contained in:
Andreas Kling 2019-10-09 21:33:34 +02:00
parent fdbad6284c
commit 159507f2a6
2 changed files with 13 additions and 11 deletions

View file

@ -81,8 +81,6 @@ public:
void set_needs_display();
bool is_ancestor_of(const LayoutNode&) const;
template<typename Callback>
void for_each_fragment_of_this(Callback);
@ -130,12 +128,3 @@ inline const LayoutNodeWithStyle* LayoutNode::parent() const
{
return static_cast<const LayoutNodeWithStyle*>(TreeNode<LayoutNode>::parent());
}
inline bool LayoutNode::is_ancestor_of(const LayoutNode& other) const
{
for (auto* ancestor = other.parent(); ancestor; ancestor = ancestor->parent()) {
if (ancestor == this)
return true;
}
return false;
}