1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:17:35 +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

31
Libraries/LibHTML/Frame.h Normal file
View file

@ -0,0 +1,31 @@
#pragma once
#include <AK/Noncopyable.h>
#include <AK/RefPtr.h>
#include <AK/Weakable.h>
#include <LibDraw/Size.h>
#include <LibHTML/TreeNode.h>
class Document;
class Frame
: public TreeNode<Frame>
, public Weakable<Frame> {
public:
static NonnullRefPtr<Frame> create() { return adopt(*new Frame); }
~Frame();
const Document* document() const { return m_document; }
Document* document() { return m_document; }
void set_document(Document*);
const Size& size() const { return m_size; }
void set_size(const Size&);
private:
Frame();
RefPtr<Document> m_document;
Size m_size;
};