mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-27 03:37:53 +00:00
LibWeb: Simplify <iframe> content frame construction
Now that documents are attached to their frame *before* parsing, we can create the content frame of <iframe> elements right away, instead of waiting for the host frame attachment. Fixes #4408.
This commit is contained in:
@@ -46,6 +46,8 @@ namespace Web::HTML {
|
||||
HTMLIFrameElement::HTMLIFrameElement(DOM::Document& document, const QualifiedName& qualified_name)
|
||||
: HTMLElement(document, qualified_name)
|
||||
{
|
||||
ASSERT(document.frame());
|
||||
m_content_frame = Frame::create_subframe(*this, document.frame()->main_frame());
|
||||
}
|
||||
|
||||
HTMLIFrameElement::~HTMLIFrameElement()
|
||||
@@ -58,18 +60,11 @@ RefPtr<Layout::Node> HTMLIFrameElement::create_layout_node(const CSS::StylePrope
|
||||
return adopt(*new Layout::FrameBox(document(), *this, move(style)));
|
||||
}
|
||||
|
||||
void HTMLIFrameElement::document_did_attach_to_frame(Frame& frame)
|
||||
{
|
||||
ASSERT(!m_content_frame);
|
||||
m_content_frame = Frame::create_subframe(*this, frame.main_frame());
|
||||
auto src = attribute(HTML::AttributeNames::src);
|
||||
if (src.is_null())
|
||||
return;
|
||||
load_src(src);
|
||||
}
|
||||
|
||||
void HTMLIFrameElement::document_will_detach_from_frame(Frame&)
|
||||
void HTMLIFrameElement::parse_attribute(const FlyString& name, const String& value)
|
||||
{
|
||||
HTMLElement::parse_attribute(name, value);
|
||||
if (name == HTML::AttributeNames::src)
|
||||
load_src(value);
|
||||
}
|
||||
|
||||
void HTMLIFrameElement::load_src(const String& value)
|
||||
|
||||
Reference in New Issue
Block a user