summaryrefslogtreecommitdiff
path: root/Libraries
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-06-06 16:33:04 +0200
committerAndreas Kling <kling@serenityos.org>2020-06-06 16:36:18 +0200
commit37b21cfd7dff8e0d9fa2f65bcf6efab78b6f9c51 (patch)
tree152b85e03cda3ac161116ae6686f0f7c3471f6af /Libraries
parentbe6abce44f5a7d6601b2238f6a136cc8dcc7e558 (diff)
downloadserenity-37b21cfd7dff8e0d9fa2f65bcf6efab78b6f9c51.zip
LibWeb: Make Frame::page_view() always go via main_frame()
When you ask a subframe for its PageView, you'll now always get the main frame's PageView. Subframes don't have a PageView of their own.
Diffstat (limited to 'Libraries')
-rw-r--r--Libraries/LibWeb/Frame.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/Libraries/LibWeb/Frame.h b/Libraries/LibWeb/Frame.h
index 0a8ae556e6..cc98cbb629 100644
--- a/Libraries/LibWeb/Frame.h
+++ b/Libraries/LibWeb/Frame.h
@@ -47,13 +47,15 @@ public:
static NonnullRefPtr<Frame> create(PageView& page_view) { return adopt(*new Frame(page_view)); }
~Frame();
+ bool is_main_frame() const { return this == &m_main_frame; }
+
const Document* document() const { return m_document; }
Document* document() { return m_document; }
void set_document(Document*);
- PageView* page_view() { return m_page_view; }
- const PageView* page_view() const { return m_page_view; }
+ PageView* page_view() { return is_main_frame() ? m_page_view : main_frame().m_page_view; }
+ const PageView* page_view() const{ return is_main_frame() ? m_page_view : main_frame().m_page_view; }
const Gfx::Size& size() const { return m_size; }
void set_size(const Gfx::Size&);