summaryrefslogtreecommitdiff
path: root/Libraries
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-06-06 13:10:11 +0200
committerAndreas Kling <kling@serenityos.org>2020-06-06 14:14:43 +0200
commit5c0ee72b30062e4d659108579fdedc597cf89c18 (patch)
treeb87bdc671c88aae976ca69a56158fd018eadee7a /Libraries
parent075bd75859bd534dea7c4aa51ac4bd5a492dcd08 (diff)
downloadserenity-5c0ee72b30062e4d659108579fdedc597cf89c18.zip
LibWeb: Use FrameLoader to load iframes :^)
Diffstat (limited to 'Libraries')
-rw-r--r--Libraries/LibWeb/DOM/HTMLIFrameElement.cpp19
-rw-r--r--Libraries/LibWeb/Frame.cpp2
-rw-r--r--Libraries/LibWeb/Layout/LayoutFrame.cpp4
3 files changed, 9 insertions, 16 deletions
diff --git a/Libraries/LibWeb/DOM/HTMLIFrameElement.cpp b/Libraries/LibWeb/DOM/HTMLIFrameElement.cpp
index aab32ea2b5..a929ac1405 100644
--- a/Libraries/LibWeb/DOM/HTMLIFrameElement.cpp
+++ b/Libraries/LibWeb/DOM/HTMLIFrameElement.cpp
@@ -76,21 +76,12 @@ void HTMLIFrameElement::load_src(const String& value)
return;
}
- ResourceLoader::the().load_sync(
- url,
- [&](auto& data, auto& headers) {
- (void)headers;
- auto html_source = String::copy(data);
- HTMLDocumentParser parser(html_source, "utf-8");
- parser.run(url);
- m_hosted_frame->set_document(&parser.document());
+ m_hosted_frame->on_set_needs_display = [this](auto&) {
+ if (layout_node())
+ layout_node()->set_needs_display();
+ };
- dbg() << "The hosted frame now has this DOM:";
- dump_tree(*m_hosted_frame->document());
- },
- [&](auto& error) {
- dbg() << "<iframe> failed to load: " << error;
- });
+ m_hosted_frame->loader().load(url);
}
}
diff --git a/Libraries/LibWeb/Frame.cpp b/Libraries/LibWeb/Frame.cpp
index 00688836fe..ebe06e62b0 100644
--- a/Libraries/LibWeb/Frame.cpp
+++ b/Libraries/LibWeb/Frame.cpp
@@ -69,6 +69,8 @@ void Frame::set_size(const Gfx::Size& size)
if (m_size == size)
return;
m_size = size;
+ if (m_document)
+ m_document->layout();
}
void Frame::set_viewport_rect(const Gfx::Rect& rect)
diff --git a/Libraries/LibWeb/Layout/LayoutFrame.cpp b/Libraries/LibWeb/Layout/LayoutFrame.cpp
index 288eac3648..3a39c42dcb 100644
--- a/Libraries/LibWeb/Layout/LayoutFrame.cpp
+++ b/Libraries/LibWeb/Layout/LayoutFrame.cpp
@@ -48,6 +48,8 @@ LayoutFrame::~LayoutFrame()
void LayoutFrame::layout(LayoutMode layout_mode)
{
+ ASSERT(node().hosted_frame());
+
set_has_intrinsic_width(true);
set_has_intrinsic_height(true);
// FIXME: Do proper error checking, etc.
@@ -81,8 +83,6 @@ void LayoutFrame::did_set_rect()
ASSERT(node().hosted_frame());
node().hosted_frame()->set_size(Gfx::Size(rect().width(), rect().height()));
-
- node().hosted_frame()->document()->layout();
}
}