mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-17 16:42:54 +00:00
LibHTML+Browser: Add a simple DOM inspector popup window
LibHTML now provides a DOMTreeModel which can be used to view a given Document's DOM tree. :^)
This commit is contained in:
parent
0f76366b34
commit
e3d975e943
Notes:
sideshowbarker
2024-07-19 11:18:57 +09:00
Author: https://github.com/awesomekling
Commit: e3d975e943
5 changed files with 188 additions and 0 deletions
|
@ -45,6 +45,30 @@ public:
|
|||
const T* first_child() const { return m_first_child; }
|
||||
const T* last_child() const { return m_last_child; }
|
||||
|
||||
int child_count() const
|
||||
{
|
||||
int count = 0;
|
||||
for (auto* child = first_child(); child; child = child->next_sibling())
|
||||
++count;
|
||||
return count;
|
||||
}
|
||||
|
||||
T* child_at_index(int index)
|
||||
{
|
||||
int count = 0;
|
||||
for (auto* child = first_child(); child; child = child->next_sibling()) {
|
||||
if (count == index)
|
||||
return child;
|
||||
++count;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const T* child_at_index(int index) const
|
||||
{
|
||||
return const_cast<TreeNode*>(this)->child_at_index(index);
|
||||
}
|
||||
|
||||
bool is_ancestor_of(const TreeNode&) const;
|
||||
|
||||
void prepend_child(NonnullRefPtr<T> node, bool call_inserted_into = true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue