summaryrefslogtreecommitdiff
path: root/Libraries/LibHTML/Frame.h
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-11-25 21:19:03 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-11-25 21:19:21 +0100
commit8dc6f7cd4f3408a4c8551c68127d8167d87c28c2 (patch)
tree9c1cadffe7d3961f9f08b40136725bd9cdbb9066 /Libraries/LibHTML/Frame.h
parent94bc46ee70a8f0c642297828dab8ab6502d03bd9 (diff)
downloadserenity-8dc6f7cd4f3408a4c8551c68127d8167d87c28c2.zip
LibHTML: Give Frame a (weak) back-pointer to the HtmlView
This will be the official path from DOM/layout code to the HtmlView for now. Perhaps in the future we will have a fancier abstraction.
Diffstat (limited to 'Libraries/LibHTML/Frame.h')
-rw-r--r--Libraries/LibHTML/Frame.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/Libraries/LibHTML/Frame.h b/Libraries/LibHTML/Frame.h
index 38a8d8bedb..bf28e8cd34 100644
--- a/Libraries/LibHTML/Frame.h
+++ b/Libraries/LibHTML/Frame.h
@@ -3,15 +3,17 @@
#include <AK/Function.h>
#include <AK/Noncopyable.h>
#include <AK/RefPtr.h>
+#include <AK/WeakPtr.h>
#include <LibDraw/Rect.h>
#include <LibDraw/Size.h>
#include <LibHTML/TreeNode.h>
class Document;
+class HtmlView;
class Frame : public TreeNode<Frame> {
public:
- static NonnullRefPtr<Frame> create() { return adopt(*new Frame); }
+ static NonnullRefPtr<Frame> create(HtmlView& html_view) { return adopt(*new Frame(html_view)); }
~Frame();
const Document* document() const { return m_document; }
@@ -19,6 +21,9 @@ public:
void set_document(Document*);
+ HtmlView* html_view() { return m_html_view; }
+ const HtmlView* html_view() const { return m_html_view; }
+
const Size& size() const { return m_size; }
void set_size(const Size&);
@@ -26,8 +31,9 @@ public:
Function<void(const Rect&)> on_set_needs_display;
private:
- Frame();
+ explicit Frame(HtmlView&);
+ WeakPtr<HtmlView> m_html_view;
RefPtr<Document> m_document;
Size m_size;
};