1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-23 06:37:40 +00:00

LibWeb: Delay sub-Frame construction until host Document is attached

While we're parsing a new document, we don't have a Frame to grab at.
We now use the Node::document_did_attach_to_frame() notification hook
to delay subframe construction.

With this, subframes now always have a valid reference to their
enclosing main frame.
This commit is contained in:
Andreas Kling 2020-06-06 15:08:36 +02:00
parent 285a4165f3
commit 38ada2d102
4 changed files with 31 additions and 15 deletions

View file

@ -32,13 +32,16 @@
namespace Web {
Frame::Frame()
: m_loader(*this)
Frame::Frame(Element& host_element, Frame& main_frame)
: m_main_frame(main_frame)
, m_loader(*this)
, m_host_element(host_element.make_weak_ptr())
{
}
Frame::Frame(PageView& page_view)
: m_loader(*this)
: m_main_frame(*this)
, m_loader(*this)
, m_page_view(page_view.make_weak_ptr())
{
}