1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:07:47 +00:00

LibHTML: Create some subdirectories.

This commit is contained in:
Andreas Kling 2019-06-15 23:41:15 +02:00
parent 0522a8f71c
commit 1f51c2b7da
25 changed files with 49 additions and 50 deletions

View file

@ -0,0 +1,54 @@
#pragma once
#include <AK/Retained.h>
#include <AK/Vector.h>
class Node;
class LayoutNode {
public:
virtual ~LayoutNode();
void retain();
void release();
int retain_count() const { return m_retain_count; }
const Node* node() const { return m_node; }
LayoutNode* next_sibling() { return m_next_sibling; }
LayoutNode* previous_sibling() { return m_previous_sibling; }
LayoutNode* first_child() { return m_first_child; }
LayoutNode* last_child() { return m_last_child; }
const LayoutNode* next_sibling() const { return m_next_sibling; }
const LayoutNode* previous_sibling() const { return m_previous_sibling; }
const LayoutNode* first_child() const { return m_first_child; }
const LayoutNode* last_child() const { return m_last_child; }
void append_child(Retained<LayoutNode>);
void set_next_sibling(LayoutNode* node) { m_next_sibling = node; }
void set_previous_sibling(LayoutNode* node) { m_previous_sibling = node; }
template<typename Callback>
inline void for_each_child(Callback callback) const
{
for (auto* node = first_child(); node; node = node->next_sibling())
callback(*node);
}
virtual const char* class_name() const { return "LayoutNode"; }
virtual bool is_text() const { return false; }
protected:
explicit LayoutNode(const Node*);
private:
int m_retain_count { 1 };
const Node* m_node { nullptr };
LayoutNode* m_parent_node { nullptr };
LayoutNode* m_first_child { nullptr };
LayoutNode* m_last_child { nullptr };
LayoutNode* m_next_sibling { nullptr };
LayoutNode* m_previous_sibling { nullptr };
};