1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:37:46 +00:00

LibHTML: Add load(URL) and reload() functions to HtmlView

You can now pass a file:/// URL to HtmlView and it will take care of
the loading logic for you. Each Document remembers the URL it was
loaded from, which allows us to also have reload().

This patch also adds a very simple function for resolving relative
URL's into absolute ones.
This commit is contained in:
Andreas Kling 2019-10-05 10:16:27 +02:00
parent d64c054d25
commit 78d65c1c64
4 changed files with 69 additions and 0 deletions

View file

@ -3,6 +3,7 @@
#include <AK/NonnullRefPtrVector.h>
#include <AK/OwnPtr.h>
#include <AK/String.h>
#include <AK/URL.h>
#include <AK/WeakPtr.h>
#include <LibHTML/CSS/StyleResolver.h>
#include <LibHTML/CSS/StyleSheet.h>
@ -21,6 +22,11 @@ public:
Document();
virtual ~Document() override;
void set_url(const URL& url) { m_url = url; }
const URL& url() const { return m_url; }
URL complete_url(const String&) const;
void normalize();
StyleResolver& style_resolver();
@ -53,4 +59,5 @@ private:
NonnullRefPtrVector<StyleSheet> m_sheets;
RefPtr<Node> m_hovered_node;
WeakPtr<Frame> m_frame;
URL m_url;
};