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

LibHTML: Add a Frame class and use it for document layout width

Each HtmlView now has a main_frame(), which represents the main frame
of the web page. Frame inherits from TreeNode<Frame>, which will allow
us to someday implement a Frame tree (to support the <frame> element.)
This commit is contained in:
Andreas Kling 2019-10-04 15:50:04 +02:00
parent b1758ae2b3
commit 7bc9310170
9 changed files with 101 additions and 8 deletions

View file

@ -3,15 +3,20 @@
#include <LibGUI/GScrollableWidget.h>
#include <LibHTML/DOM/Document.h>
class Frame;
class HtmlView : public GScrollableWidget {
C_OBJECT(HtmlView)
public:
virtual ~HtmlView() override {}
virtual ~HtmlView() override;
Document* document() { return m_document; }
const Document* document() const { return m_document; }
void set_document(Document*);
Frame& main_frame() { return *m_main_frame; }
const Frame& main_frame() const { return *m_main_frame; }
Function<void(const String&)> on_link_click;
Function<void(const String&)> on_title_change;
@ -26,6 +31,7 @@ protected:
private:
void layout_and_sync_size();
RefPtr<Frame> m_main_frame;
RefPtr<Document> m_document;
RefPtr<LayoutNode> m_layout_root;
};