mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:28:12 +00:00
LibWeb: Use FrameLoader to load iframes :^)
This commit is contained in:
parent
075bd75859
commit
5c0ee72b30
3 changed files with 9 additions and 16 deletions
|
@ -76,21 +76,12 @@ void HTMLIFrameElement::load_src(const String& value)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResourceLoader::the().load_sync(
|
m_hosted_frame->on_set_needs_display = [this](auto&) {
|
||||||
url,
|
if (layout_node())
|
||||||
[&](auto& data, auto& headers) {
|
layout_node()->set_needs_display();
|
||||||
(void)headers;
|
};
|
||||||
auto html_source = String::copy(data);
|
|
||||||
HTMLDocumentParser parser(html_source, "utf-8");
|
|
||||||
parser.run(url);
|
|
||||||
m_hosted_frame->set_document(&parser.document());
|
|
||||||
|
|
||||||
dbg() << "The hosted frame now has this DOM:";
|
m_hosted_frame->loader().load(url);
|
||||||
dump_tree(*m_hosted_frame->document());
|
|
||||||
},
|
|
||||||
[&](auto& error) {
|
|
||||||
dbg() << "<iframe> failed to load: " << error;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,8 @@ void Frame::set_size(const Gfx::Size& size)
|
||||||
if (m_size == size)
|
if (m_size == size)
|
||||||
return;
|
return;
|
||||||
m_size = size;
|
m_size = size;
|
||||||
|
if (m_document)
|
||||||
|
m_document->layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Frame::set_viewport_rect(const Gfx::Rect& rect)
|
void Frame::set_viewport_rect(const Gfx::Rect& rect)
|
||||||
|
|
|
@ -48,6 +48,8 @@ LayoutFrame::~LayoutFrame()
|
||||||
|
|
||||||
void LayoutFrame::layout(LayoutMode layout_mode)
|
void LayoutFrame::layout(LayoutMode layout_mode)
|
||||||
{
|
{
|
||||||
|
ASSERT(node().hosted_frame());
|
||||||
|
|
||||||
set_has_intrinsic_width(true);
|
set_has_intrinsic_width(true);
|
||||||
set_has_intrinsic_height(true);
|
set_has_intrinsic_height(true);
|
||||||
// FIXME: Do proper error checking, etc.
|
// FIXME: Do proper error checking, etc.
|
||||||
|
@ -81,8 +83,6 @@ void LayoutFrame::did_set_rect()
|
||||||
|
|
||||||
ASSERT(node().hosted_frame());
|
ASSERT(node().hosted_frame());
|
||||||
node().hosted_frame()->set_size(Gfx::Size(rect().width(), rect().height()));
|
node().hosted_frame()->set_size(Gfx::Size(rect().width(), rect().height()));
|
||||||
|
|
||||||
node().hosted_frame()->document()->layout();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue