mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-07 03:32:53 +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
30
Libraries/LibHTML/DOMTreeModel.h
Normal file
30
Libraries/LibHTML/DOMTreeModel.h
Normal 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;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue