1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:38:11 +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

@ -30,7 +30,7 @@
namespace Web {
class HTMLIFrameElement : public HTMLElement {
class HTMLIFrameElement final : public HTMLElement {
public:
HTMLIFrameElement(Document&, const FlyString& tag_name);
virtual ~HTMLIFrameElement() override;
@ -40,9 +40,10 @@ public:
Frame* hosted_frame() { return m_hosted_frame; }
const Frame* hosted_frame() const { return m_hosted_frame; }
virtual void parse_attribute(const FlyString& name, const String& value) override;
private:
virtual void document_did_attach_to_frame(Frame&) override;
virtual void document_will_detach_from_frame(Frame&) override;
void load_src(const String&);
RefPtr<Frame> m_hosted_frame;