1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:38:12 +00:00

LibHTML: Introduce the HtmlView widget

This is a GWidget that can display contents of an HTML document.
It replaces the Frame class.
This commit is contained in:
Sergey Bugaev 2019-09-25 12:44:22 +03:00 committed by Andreas Kling
parent 8a2beaf52b
commit b9493ba783
6 changed files with 119 additions and 70 deletions

View file

@ -0,0 +1,26 @@
#pragma once
#include <LibGUI/GScrollableWidget.h>
#include <LibHTML/DOM/Document.h>
class HtmlView : public GScrollableWidget {
C_OBJECT(HtmlView)
public:
virtual ~HtmlView() override {}
Document* document() { return m_document; }
const Document* document() const { return m_document; }
void set_document(Document*);
protected:
HtmlView(GWidget* parent = nullptr);
virtual void resize_event(GResizeEvent&) override;
virtual void paint_event(GPaintEvent&) override;
private:
void layout_and_sync_size();
RefPtr<Document> m_document;
RefPtr<LayoutNode> m_layout_root;
};