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:
Andreas Kling 2019-11-09 11:31:03 +01:00
parent 0f76366b34
commit e3d975e943
Notes: sideshowbarker 2024-07-19 11:18:57 +09:00
5 changed files with 188 additions and 0 deletions

View file

@ -0,0 +1,30 @@
#pragma once
#include <LibGUI/GModel.h>
class Document;
class DOMTreeModel final : public GModel {
public:
static NonnullRefPtr<DOMTreeModel> create(Document& document)
{
return adopt(*new DOMTreeModel(document));
}
virtual ~DOMTreeModel() override;
virtual int row_count(const GModelIndex& = GModelIndex()) const override;
virtual int column_count(const GModelIndex& = GModelIndex()) const override;
virtual GVariant data(const GModelIndex&, Role = Role::Display) const override;
virtual GModelIndex index(int row, int column, const GModelIndex& parent = GModelIndex()) const override;
virtual GModelIndex parent_index(const GModelIndex&) const override;
virtual void update() override;
private:
explicit DOMTreeModel(Document&);
Document& m_document;
GIcon m_element_icon;
GIcon m_text_icon;
};