1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:38:10 +00:00

LibWeb: Add a FrameLoader class and move PageView's loading logic there

Each Frame now has a FrameLoader which will be responsible for handling
loading inside that frame.
This commit is contained in:
Andreas Kling 2020-06-06 13:02:44 +02:00
parent 0cbef87944
commit 075bd75859
7 changed files with 400 additions and 268 deletions

View file

@ -33,11 +33,13 @@
namespace Web {
Frame::Frame()
: m_loader(*this)
{
}
Frame::Frame(PageView& page_view)
: m_page_view(page_view.make_weak_ptr())
: m_loader(*this)
, m_page_view(page_view.make_weak_ptr())
{
}
@ -57,6 +59,9 @@ void Frame::set_document(Document* document)
if (m_document)
m_document->attach_to_frame({}, *this);
if (on_set_document)
on_set_document(m_document);
}
void Frame::set_size(const Gfx::Size& size)
@ -98,4 +103,14 @@ void Frame::did_scroll(Badge<PageView>)
});
}
void Frame::scroll_to_anchor(const String& fragment)
{
// FIXME: We should be able to scroll iframes to an anchor, too!
if (!m_page_view)
return;
// FIXME: This logic is backwards, the work should be done in here,
// and then we just request that the "view" scrolls to a certain content offset.
m_page_view->scroll_to_anchor(fragment);
}
}