1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:37:45 +00:00

LibWeb: Add the Web::URL namespace and move URLEncoder to it

This namespace will be used for all interfaces defined in the URL
specification, like URL and URLSearchParams.

This has the unfortunate side-effect of requiring us to use the fully
qualified AK::URL name whenever we want to refer to the AK class, so
this commit also fixes all such references.
This commit is contained in:
Idan Horowitz 2021-09-13 00:33:23 +03:00 committed by Andreas Kling
parent 2b78e227f2
commit 4629f2e4ad
54 changed files with 236 additions and 225 deletions

View file

@ -57,7 +57,7 @@
namespace Web::DOM {
Document::Document(const URL& url)
Document::Document(const AK::URL& url)
: ParentNode(*this, NodeType::DOCUMENT_NODE)
, m_style_resolver(make<CSS::StyleResolver>(*this))
, m_style_sheets(CSS::StyleSheetList::create(*this))
@ -383,7 +383,7 @@ CSS::Repeat Document::background_repeat_y() const
}
// https://html.spec.whatwg.org/multipage/urls-and-fetching.html#parse-a-url
URL Document::parse_url(String const& url) const
AK::URL Document::parse_url(String const& url) const
{
// FIXME: Make sure we do this according to spec.
return m_url.complete_url(url);

View file

@ -45,7 +45,7 @@ class Document
public:
using WrapperType = Bindings::DocumentWrapper;
static NonnullRefPtr<Document> create(const URL& url = "about:blank")
static NonnullRefPtr<Document> create(const AK::URL& url = "about:blank")
{
return adopt_ref(*new Document(url));
}
@ -64,15 +64,15 @@ public:
bool should_invalidate_styles_on_attribute_changes() const { return m_should_invalidate_styles_on_attribute_changes; }
void set_should_invalidate_styles_on_attribute_changes(bool b) { m_should_invalidate_styles_on_attribute_changes = b; }
void set_url(const URL& url) { m_url = url; }
URL url() const { return m_url; }
void set_url(const AK::URL& url) { m_url = url; }
AK::URL url() const { return m_url; }
Origin origin() const;
void set_origin(const Origin& origin);
bool is_scripting_enabled() const { return true; }
URL parse_url(String const&) const;
AK::URL parse_url(String const&) const;
CSS::StyleResolver& style_resolver() { return *m_style_resolver; }
const CSS::StyleResolver& style_resolver() const { return *m_style_resolver; }
@ -282,7 +282,7 @@ public:
Bindings::LocationObject* location();
private:
explicit Document(const URL&);
explicit Document(const AK::URL&);
// ^DOM::Node
virtual RefPtr<Layout::Node> create_layout_node() override;
@ -316,7 +316,7 @@ private:
RefPtr<Node> m_hovered_node;
RefPtr<Node> m_inspected_node;
WeakPtr<BrowsingContext> m_browsing_context;
URL m_url;
AK::URL m_url;
RefPtr<Window> m_window;

View file

@ -138,7 +138,7 @@ void Window::cancel_animation_frame(i32 id)
GUI::DisplayLink::unregister_callback(id);
}
void Window::did_set_location_href(Badge<Bindings::LocationObject>, URL const& new_href)
void Window::did_set_location_href(Badge<Bindings::LocationObject>, AK::URL const& new_href)
{
auto* frame = associated_document().browsing_context();
if (!frame)

View file

@ -54,7 +54,7 @@ public:
int inner_width() const;
int inner_height() const;
void did_set_location_href(Badge<Bindings::LocationObject>, URL const& new_href);
void did_set_location_href(Badge<Bindings::LocationObject>, AK::URL const& new_href);
void did_call_location_reload(Badge<Bindings::LocationObject>);
Bindings::WindowObject* wrapper() { return m_wrapper; }