diff --git a/Ladybird/Android/src/main/cpp/WebViewImplementationNative.cpp b/Ladybird/Android/src/main/cpp/WebViewImplementationNative.cpp index b64dbfc1b8..6053b2505b 100644 --- a/Ladybird/Android/src/main/cpp/WebViewImplementationNative.cpp +++ b/Ladybird/Android/src/main/cpp/WebViewImplementationNative.cpp @@ -35,7 +35,7 @@ WebViewImplementationNative::WebViewImplementationNative(jobject thiz) env.get()->CallVoidMethod(m_java_instance, invalidate_layout_method); }; - on_load_start = [this](AK::URL const& url, bool is_redirect) { + on_load_start = [this](URL const& url, bool is_redirect) { JavaEnvironment env(global_vm); auto url_string = env.jstring_from_ak_string(MUST(url.to_string())); env.get()->CallVoidMethod(m_java_instance, on_load_start_method, url_string, is_redirect); diff --git a/Ladybird/Android/src/main/cpp/WebViewImplementationNativeJNI.cpp b/Ladybird/Android/src/main/cpp/WebViewImplementationNativeJNI.cpp index f94248ba2e..6f583c4144 100644 --- a/Ladybird/Android/src/main/cpp/WebViewImplementationNativeJNI.cpp +++ b/Ladybird/Android/src/main/cpp/WebViewImplementationNativeJNI.cpp @@ -82,7 +82,7 @@ Java_org_serenityos_ladybird_WebViewImplementation_nativeLoadURL(JNIEnv* env, jo { auto* impl = reinterpret_cast(instance); char const* raw_url = env->GetStringUTFChars(url, nullptr); - auto ak_url = AK::URL::create_with_url_or_path(StringView { raw_url, strlen(raw_url) }); + auto ak_url = URL::create_with_url_or_path(StringView { raw_url, strlen(raw_url) }); env->ReleaseStringUTFChars(url, raw_url); impl->load(ak_url); } diff --git a/Ladybird/Qt/AutoComplete.cpp b/Ladybird/Qt/AutoComplete.cpp index d743f93dd3..ae35e4acf5 100644 --- a/Ladybird/Qt/AutoComplete.cpp +++ b/Ladybird/Qt/AutoComplete.cpp @@ -124,7 +124,7 @@ ErrorOr AutoComplete::got_network_response(QNetworkReply* reply) String AutoComplete::auto_complete_url_from_query(StringView query) { auto autocomplete_engine = ak_string_from_qstring(Settings::the()->autocomplete_engine().url); - return MUST(autocomplete_engine.replace("{}"sv, AK::URL::percent_encode(query), ReplaceMode::FirstOnly)); + return MUST(autocomplete_engine.replace("{}"sv, URL::percent_encode(query), ReplaceMode::FirstOnly)); } void AutoComplete::clear_suggestions() diff --git a/Ladybird/Qt/BrowserWindow.cpp b/Ladybird/Qt/BrowserWindow.cpp index e6e900ec9a..fcd5601fc6 100644 --- a/Ladybird/Qt/BrowserWindow.cpp +++ b/Ladybird/Qt/BrowserWindow.cpp @@ -471,7 +471,7 @@ void BrowserWindow::debug_request(ByteString const& request, ByteString const& a m_current_tab->debug_request(request, argument); } -Tab& BrowserWindow::new_tab_from_url(AK::URL const& url, Web::HTML::ActivateTab activate_tab) +Tab& BrowserWindow::new_tab_from_url(URL const& url, Web::HTML::ActivateTab activate_tab) { auto& tab = create_new_tab(activate_tab); tab.navigate(url); diff --git a/Ladybird/Qt/BrowserWindow.h b/Ladybird/Qt/BrowserWindow.h index 0aa634ef29..d5508c9467 100644 --- a/Ladybird/Qt/BrowserWindow.h +++ b/Ladybird/Qt/BrowserWindow.h @@ -73,7 +73,7 @@ public slots: void device_pixel_ratio_changed(qreal dpi); void tab_title_changed(int index, QString const&); void tab_favicon_changed(int index, QIcon const& icon); - Tab& new_tab_from_url(AK::URL const&, Web::HTML::ActivateTab); + Tab& new_tab_from_url(URL const&, Web::HTML::ActivateTab); Tab& new_tab_from_content(StringView html, Web::HTML::ActivateTab); Tab& new_child_tab(Web::HTML::ActivateTab, Tab& parent, Web::HTML::WebViewHints, Optional page_index); void activate_tab(int index); diff --git a/Ladybird/Qt/RequestManagerQt.cpp b/Ladybird/Qt/RequestManagerQt.cpp index 7ff68da45a..e4657eab17 100644 --- a/Ladybird/Qt/RequestManagerQt.cpp +++ b/Ladybird/Qt/RequestManagerQt.cpp @@ -24,7 +24,7 @@ void RequestManagerQt::reply_finished(QNetworkReply* reply) request->did_finish(); } -RefPtr RequestManagerQt::start_request(ByteString const& method, AK::URL const& url, HashMap const& request_headers, ReadonlyBytes request_body, Core::ProxyData const& proxy) +RefPtr RequestManagerQt::start_request(ByteString const& method, URL const& url, HashMap const& request_headers, ReadonlyBytes request_body, Core::ProxyData const& proxy) { if (!url.scheme().bytes_as_string_view().is_one_of_ignoring_ascii_case("http"sv, "https"sv)) { return nullptr; @@ -38,7 +38,7 @@ RefPtr RequestManagerQt::start_request(Byte return request; } -ErrorOr> RequestManagerQt::Request::create(QNetworkAccessManager& qnam, ByteString const& method, AK::URL const& url, HashMap const& request_headers, ReadonlyBytes request_body, Core::ProxyData const&) +ErrorOr> RequestManagerQt::Request::create(QNetworkAccessManager& qnam, ByteString const& method, URL const& url, HashMap const& request_headers, ReadonlyBytes request_body, Core::ProxyData const&) { QNetworkRequest request { QString(url.to_byte_string().characters()) }; request.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::ManualRedirectPolicy); diff --git a/Ladybird/Qt/RequestManagerQt.h b/Ladybird/Qt/RequestManagerQt.h index 3b6a8faa97..3a1087f42d 100644 --- a/Ladybird/Qt/RequestManagerQt.h +++ b/Ladybird/Qt/RequestManagerQt.h @@ -24,10 +24,10 @@ public: virtual ~RequestManagerQt() override { } - virtual void prefetch_dns(AK::URL const&) override { } - virtual void preconnect(AK::URL const&) override { } + virtual void prefetch_dns(URL const&) override { } + virtual void preconnect(URL const&) override { } - virtual RefPtr start_request(ByteString const& method, AK::URL const&, HashMap const& request_headers, ReadonlyBytes request_body, Core::ProxyData const&) override; + virtual RefPtr start_request(ByteString const& method, URL const&, HashMap const& request_headers, ReadonlyBytes request_body, Core::ProxyData const&) override; private slots: void reply_finished(QNetworkReply*); @@ -38,7 +38,7 @@ private: class Request : public Web::ResourceLoaderConnectorRequest { public: - static ErrorOr> create(QNetworkAccessManager& qnam, ByteString const& method, AK::URL const& url, HashMap const& request_headers, ReadonlyBytes request_body, Core::ProxyData const&); + static ErrorOr> create(QNetworkAccessManager& qnam, ByteString const& method, URL const& url, HashMap const& request_headers, ReadonlyBytes request_body, Core::ProxyData const&); virtual ~Request() override; diff --git a/Ladybird/Qt/StringUtils.cpp b/Ladybird/Qt/StringUtils.cpp index e5a63f495f..09cd5cbdee 100644 --- a/Ladybird/Qt/StringUtils.cpp +++ b/Ladybird/Qt/StringUtils.cpp @@ -23,13 +23,13 @@ QString qstring_from_ak_string(StringView ak_string) return QString::fromUtf8(ak_string.characters_without_null_termination(), static_cast(ak_string.length())); } -AK::URL ak_url_from_qstring(QString const& qstring) +URL ak_url_from_qstring(QString const& qstring) { auto utf8_data = qstring.toUtf8(); - return AK::URL(StringView(utf8_data.data(), utf8_data.size())); + return URL(StringView(utf8_data.data(), utf8_data.size())); } -AK::URL ak_url_from_qurl(QUrl const& qurl) +URL ak_url_from_qurl(QUrl const& qurl) { return ak_url_from_qstring(qurl.toString()); } diff --git a/Ladybird/Qt/StringUtils.h b/Ladybird/Qt/StringUtils.h index fd1323c0ea..70a1040e92 100644 --- a/Ladybird/Qt/StringUtils.h +++ b/Ladybird/Qt/StringUtils.h @@ -17,5 +17,5 @@ AK::ByteString ak_byte_string_from_qstring(QString const&); String ak_string_from_qstring(QString const&); QString qstring_from_ak_string(StringView); -AK::URL ak_url_from_qstring(QString const&); -AK::URL ak_url_from_qurl(QUrl const&); +URL ak_url_from_qstring(QString const&); +URL ak_url_from_qurl(QUrl const&); diff --git a/Ladybird/Qt/Tab.cpp b/Ladybird/Qt/Tab.cpp index 2265ed0ea5..9a8869f98c 100644 --- a/Ladybird/Qt/Tab.cpp +++ b/Ladybird/Qt/Tab.cpp @@ -309,7 +309,7 @@ Tab::Tab(BrowserWindow* window, WebContentOptions const& web_content_options, St search_selected_text_action->setIcon(load_icon_from_uri("resource://icons/16x16/find.png"sv)); QObject::connect(search_selected_text_action, &QAction::triggered, this, [this]() { auto url = MUST(String::formatted(Settings::the()->search_engine().query_url, URL::percent_encode(*m_page_context_menu_search_text))); - m_window->new_tab_from_url(AK::URL(url), Web::HTML::ActivateTab::Yes); + m_window->new_tab_from_url(URL(url), Web::HTML::ActivateTab::Yes); }); auto take_screenshot = [this](auto type) { @@ -658,7 +658,7 @@ void Tab::focus_location_editor() m_location_edit->selectAll(); } -void Tab::navigate(AK::URL const& url) +void Tab::navigate(URL const& url) { view().load(url); } diff --git a/Ladybird/Qt/Tab.h b/Ladybird/Qt/Tab.h index bb70c16e13..954d870249 100644 --- a/Ladybird/Qt/Tab.h +++ b/Ladybird/Qt/Tab.h @@ -33,7 +33,7 @@ public: WebContentView& view() { return *m_view; } - void navigate(AK::URL const&); + void navigate(URL const&); void load_html(StringView); void back(); diff --git a/Ladybird/Qt/WebContentView.h b/Ladybird/Qt/WebContentView.h index fb6b526657..d7211ec612 100644 --- a/Ladybird/Qt/WebContentView.h +++ b/Ladybird/Qt/WebContentView.h @@ -45,7 +45,7 @@ public: WebContentView(QWidget* window, WebContentOptions const&, StringView webdriver_content_ipc_path, RefPtr parent_client = nullptr, size_t page_index = 0); virtual ~WebContentView() override; - Function on_tab_open_request; + Function on_tab_open_request; virtual void paintEvent(QPaintEvent*) override; virtual void resizeEvent(QResizeEvent*) override; diff --git a/Ladybird/Qt/WebSocketClientManagerQt.cpp b/Ladybird/Qt/WebSocketClientManagerQt.cpp index e8087579ab..401566ee21 100644 --- a/Ladybird/Qt/WebSocketClientManagerQt.cpp +++ b/Ladybird/Qt/WebSocketClientManagerQt.cpp @@ -19,7 +19,7 @@ NonnullRefPtr WebSocketClientManagerQt::create() WebSocketClientManagerQt::WebSocketClientManagerQt() = default; WebSocketClientManagerQt::~WebSocketClientManagerQt() = default; -RefPtr WebSocketClientManagerQt::connect(AK::URL const& url, ByteString const& origin, Vector const& protocols) +RefPtr WebSocketClientManagerQt::connect(URL const& url, ByteString const& origin, Vector const& protocols) { WebSocket::ConnectionInfo connection_info(url); connection_info.set_origin(origin); diff --git a/Ladybird/Qt/WebSocketClientManagerQt.h b/Ladybird/Qt/WebSocketClientManagerQt.h index 85930ef7cd..a60ec0b4b2 100644 --- a/Ladybird/Qt/WebSocketClientManagerQt.h +++ b/Ladybird/Qt/WebSocketClientManagerQt.h @@ -19,7 +19,7 @@ public: static NonnullRefPtr create(); virtual ~WebSocketClientManagerQt() override; - virtual RefPtr connect(AK::URL const&, ByteString const& origin, Vector const& protocols) override; + virtual RefPtr connect(URL const&, ByteString const& origin, Vector const& protocols) override; private: WebSocketClientManagerQt(); diff --git a/Userland/Applications/Maps/SearchPanel.cpp b/Userland/Applications/Maps/SearchPanel.cpp index b5ec9410d2..82cf13330c 100644 --- a/Userland/Applications/Maps/SearchPanel.cpp +++ b/Userland/Applications/Maps/SearchPanel.cpp @@ -55,7 +55,7 @@ void SearchPanel::search(StringView query) HashMap headers; headers.set("User-Agent", "SerenityOS Maps"); headers.set("Accept", "application/json"); - URL url(MUST(String::formatted("https://nominatim.openstreetmap.org/search?q={}&format=json", AK::URL::percent_encode(query, AK::URL::PercentEncodeSet::Query)))); + URL url(MUST(String::formatted("https://nominatim.openstreetmap.org/search?q={}&format=json", URL::percent_encode(query, URL::PercentEncodeSet::Query)))); auto request = m_request_client->start_request("GET", url, headers, {}); VERIFY(!request.is_null()); m_request = request; diff --git a/Userland/Libraries/LibWeb/CSS/CSSFontFaceRule.cpp b/Userland/Libraries/LibWeb/CSS/CSSFontFaceRule.cpp index 15398cb2a2..75d46146ac 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSFontFaceRule.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSFontFaceRule.cpp @@ -64,8 +64,8 @@ String CSSFontFaceRule::serialized() const // 2. The result of invoking serialize a comma-separated list on performing serialize a URL or serialize a LOCAL for each source on the source list. serialize_a_comma_separated_list(builder, m_font_face.sources(), [&](StringBuilder& builder, FontFace::Source source) -> void { - if (source.local_or_url.has()) { - serialize_a_url(builder, MUST(source.local_or_url.get().to_string())); + if (source.local_or_url.has()) { + serialize_a_url(builder, MUST(source.local_or_url.get().to_string())); } else { builder.appendff("local({})", source.local_or_url.get()); } diff --git a/Userland/Libraries/LibWeb/CSS/CSSImportRule.cpp b/Userland/Libraries/LibWeb/CSS/CSSImportRule.cpp index 20f872eb24..f13e24fb1f 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSImportRule.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSImportRule.cpp @@ -21,13 +21,13 @@ namespace Web::CSS { JS_DEFINE_ALLOCATOR(CSSImportRule); -JS::NonnullGCPtr CSSImportRule::create(AK::URL url, DOM::Document& document) +JS::NonnullGCPtr CSSImportRule::create(URL url, DOM::Document& document) { auto& realm = document.realm(); return realm.heap().allocate(realm, move(url), document); } -CSSImportRule::CSSImportRule(AK::URL url, DOM::Document& document) +CSSImportRule::CSSImportRule(URL url, DOM::Document& document) : CSSRule(document.realm()) , m_url(move(url)) , m_document(document) diff --git a/Userland/Libraries/LibWeb/CSS/CSSImportRule.h b/Userland/Libraries/LibWeb/CSS/CSSImportRule.h index 50e44b51b9..d3fd12f419 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSImportRule.h +++ b/Userland/Libraries/LibWeb/CSS/CSSImportRule.h @@ -23,11 +23,11 @@ class CSSImportRule final JS_DECLARE_ALLOCATOR(CSSImportRule); public: - [[nodiscard]] static JS::NonnullGCPtr create(AK::URL, DOM::Document&); + [[nodiscard]] static JS::NonnullGCPtr create(URL, DOM::Document&); virtual ~CSSImportRule() = default; - AK::URL const& url() const { return m_url; } + URL const& url() const { return m_url; } // FIXME: This should return only the specified part of the url. eg, "stuff/foo.css", not "https://example.com/stuff/foo.css". String href() const { return MUST(m_url.to_string()); } @@ -39,7 +39,7 @@ public: virtual Type type() const override { return Type::Import; } private: - CSSImportRule(AK::URL, DOM::Document&); + CSSImportRule(URL, DOM::Document&); virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; @@ -50,7 +50,7 @@ private: virtual void resource_did_fail() override; virtual void resource_did_load() override; - AK::URL m_url; + URL m_url; JS::GCPtr m_document; JS::GCPtr m_style_sheet; Optional m_document_load_event_delayer; diff --git a/Userland/Libraries/LibWeb/CSS/CSSStyleSheet.cpp b/Userland/Libraries/LibWeb/CSS/CSSStyleSheet.cpp index 0a49ab9bbc..70c8da6329 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSStyleSheet.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSStyleSheet.cpp @@ -20,7 +20,7 @@ namespace Web::CSS { JS_DEFINE_ALLOCATOR(CSSStyleSheet); -JS::NonnullGCPtr CSSStyleSheet::create(JS::Realm& realm, CSSRuleList& rules, MediaList& media, Optional location) +JS::NonnullGCPtr CSSStyleSheet::create(JS::Realm& realm, CSSRuleList& rules, MediaList& media, Optional location) { return realm.heap().allocate(realm, realm, rules, media, move(location)); } @@ -37,12 +37,12 @@ WebIDL::ExceptionOr> CSSStyleSheet::construct_im // 3. Set sheet’s stylesheet base URL to the baseURL attribute value from options. if (options.has_value() && options->base_url.has_value()) { - Optional sheet_location_url; + Optional sheet_location_url; if (sheet->location().has_value()) sheet_location_url = sheet->location().release_value(); // AD-HOC: This isn't explicitly mentioned in the specification, but multiple modern browsers do this. - AK::URL url = sheet->location().has_value() ? sheet_location_url->complete_url(options->base_url.value()) : options->base_url.value(); + URL url = sheet->location().has_value() ? sheet_location_url->complete_url(options->base_url.value()) : options->base_url.value(); if (!url.is_valid()) return WebIDL::NotAllowedError::create(realm, "Constructed style sheets must have a valid base URL"_fly_string); @@ -91,7 +91,7 @@ WebIDL::ExceptionOr> CSSStyleSheet::construct_im return sheet; } -CSSStyleSheet::CSSStyleSheet(JS::Realm& realm, CSSRuleList& rules, MediaList& media, Optional location) +CSSStyleSheet::CSSStyleSheet(JS::Realm& realm, CSSRuleList& rules, MediaList& media, Optional location) : StyleSheet(realm, media) , m_rules(&rules) { diff --git a/Userland/Libraries/LibWeb/CSS/CSSStyleSheet.h b/Userland/Libraries/LibWeb/CSS/CSSStyleSheet.h index 9f02ff8da5..46e1ce4aca 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSStyleSheet.h +++ b/Userland/Libraries/LibWeb/CSS/CSSStyleSheet.h @@ -32,7 +32,7 @@ class CSSStyleSheet final JS_DECLARE_ALLOCATOR(CSSStyleSheet); public: - [[nodiscard]] static JS::NonnullGCPtr create(JS::Realm&, CSSRuleList&, MediaList&, Optional location); + [[nodiscard]] static JS::NonnullGCPtr create(JS::Realm&, CSSRuleList&, MediaList&, Optional location); static WebIDL::ExceptionOr> construct_impl(JS::Realm&, Optional const& options = {}); virtual ~CSSStyleSheet() override = default; @@ -67,8 +67,8 @@ public: Optional default_namespace() const; Optional namespace_uri(StringView namespace_prefix) const; - Optional base_url() const { return m_base_url; } - void set_base_url(Optional base_url) { m_base_url = move(base_url); } + Optional base_url() const { return m_base_url; } + void set_base_url(Optional base_url) { m_base_url = move(base_url); } bool constructed() const { return m_constructed; } @@ -78,7 +78,7 @@ public: bool disallow_modification() const { return m_disallow_modification; } private: - CSSStyleSheet(JS::Realm&, CSSRuleList&, MediaList&, Optional location); + CSSStyleSheet(JS::Realm&, CSSRuleList&, MediaList&, Optional location); virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; @@ -95,7 +95,7 @@ private: JS::GCPtr m_style_sheet_list; JS::GCPtr m_owner_css_rule; - Optional m_base_url; + Optional m_base_url; JS::GCPtr m_constructor_document; bool m_constructed { false }; bool m_disallow_modification { false }; diff --git a/Userland/Libraries/LibWeb/CSS/ComputedValues.h b/Userland/Libraries/LibWeb/CSS/ComputedValues.h index a3b1447c54..616e6736ed 100644 --- a/Userland/Libraries/LibWeb/CSS/ComputedValues.h +++ b/Userland/Libraries/LibWeb/CSS/ComputedValues.h @@ -183,33 +183,33 @@ public: : m_value(color) { } - SVGPaint(AK::URL const& url) + SVGPaint(URL const& url) : m_value(url) { } bool is_color() const { return m_value.has(); } - bool is_url() const { return m_value.has(); } + bool is_url() const { return m_value.has(); } Color as_color() const { return m_value.get(); } - AK::URL const& as_url() const { return m_value.get(); } + URL const& as_url() const { return m_value.get(); } private: - Variant m_value; + Variant m_value; }; // https://drafts.fxtf.org/css-masking-1/#typedef-mask-reference class MaskReference { public: // TODO: Support other mask types. - MaskReference(AK::URL const& url) + MaskReference(URL const& url) : m_url(url) { } - AK::URL const& url() const { return m_url; } + URL const& url() const { return m_url; } private: - AK::URL m_url; + URL m_url; }; struct BackgroundLayerData { diff --git a/Userland/Libraries/LibWeb/CSS/FontFace.h b/Userland/Libraries/LibWeb/CSS/FontFace.h index 5257b51ac8..561374d075 100644 --- a/Userland/Libraries/LibWeb/CSS/FontFace.h +++ b/Userland/Libraries/LibWeb/CSS/FontFace.h @@ -16,7 +16,7 @@ namespace Web::CSS { class FontFace { public: struct Source { - Variant local_or_url; + Variant local_or_url; // FIXME: Do we need to keep this around, or is it only needed to discard unwanted formats during parsing? Optional format; }; diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Helpers.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Helpers.cpp index c7c053b351..0ee97f00a7 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Helpers.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Helpers.cpp @@ -15,7 +15,7 @@ namespace Web { -CSS::CSSStyleSheet* parse_css_stylesheet(CSS::Parser::ParsingContext const& context, StringView css, Optional location) +CSS::CSSStyleSheet* parse_css_stylesheet(CSS::Parser::ParsingContext const& context, StringView css, Optional location) { if (css.is_empty()) { auto rule_list = CSS::CSSRuleList::create_empty(context.realm()); diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp index f38249cb95..3e14432385 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -124,7 +124,7 @@ Parser::Parser(Parser&& other) // 5.3.3. Parse a stylesheet // https://www.w3.org/TR/css-syntax-3/#parse-stylesheet template -Parser::ParsedStyleSheet Parser::parse_a_stylesheet(TokenStream& tokens, Optional location) +Parser::ParsedStyleSheet Parser::parse_a_stylesheet(TokenStream& tokens, Optional location) { // To parse a stylesheet from an input given an optional url location: @@ -144,7 +144,7 @@ Parser::ParsedStyleSheet Parser::parse_a_stylesheet(TokenStream& tokens, Opti } // https://www.w3.org/TR/css-syntax-3/#parse-a-css-stylesheet -CSSStyleSheet* Parser::parse_as_css_stylesheet(Optional location) +CSSStyleSheet* Parser::parse_as_css_stylesheet(Optional location) { // To parse a CSS stylesheet, first parse a stylesheet. auto style_sheet = parse_a_stylesheet(m_token_stream, {}); @@ -1160,11 +1160,11 @@ ElementInlineCSSStyleDeclaration* Parser::parse_as_style_attribute(DOM::Element& return ElementInlineCSSStyleDeclaration::create(element, move(properties), move(custom_properties)); } -Optional Parser::parse_url_function(ComponentValue const& component_value) +Optional Parser::parse_url_function(ComponentValue const& component_value) { // FIXME: Handle list of media queries. https://www.w3.org/TR/css-cascade-3/#conditional-import - auto convert_string_to_url = [&](StringView url_string) -> Optional { + auto convert_string_to_url = [&](StringView url_string) -> Optional { auto url = m_context.complete_url(url_string); if (url.is_valid()) return url; @@ -1215,7 +1215,7 @@ CSSRule* Parser::convert_to_rule(NonnullRefPtr rule) return parse_font_face_rule(tokens); } if (rule->at_rule_name().equals_ignoring_ascii_case("import"sv) && !rule->prelude().is_empty()) { - Optional url; + Optional url; for (auto const& token : rule->prelude()) { if (token.is(Token::Type::Whitespace)) continue; diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.h b/Userland/Libraries/LibWeb/CSS/Parser/Parser.h index e3927fb236..d9b0b8a85c 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.h +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.h @@ -44,7 +44,7 @@ public: Parser(Parser&&); - CSSStyleSheet* parse_as_css_stylesheet(Optional location); + CSSStyleSheet* parse_as_css_stylesheet(Optional location); ElementInlineCSSStyleDeclaration* parse_as_style_attribute(DOM::Element&); CSSRule* parse_as_css_rule(); Optional parse_as_supports_condition(); @@ -86,11 +86,11 @@ private: // "Parse a stylesheet" is intended to be the normal parser entry point, for parsing stylesheets. struct ParsedStyleSheet { - Optional location; + Optional location; Vector> rules; }; template - ParsedStyleSheet parse_a_stylesheet(TokenStream&, Optional location); + ParsedStyleSheet parse_a_stylesheet(TokenStream&, Optional location); // "Parse a list of rules" is intended for the content of at-rules such as @media. It differs from "Parse a stylesheet" in the handling of and . template @@ -195,7 +195,7 @@ private: Optional parse_repeat(Vector const&); Optional parse_track_sizing_function(ComponentValue const&); - Optional parse_url_function(ComponentValue const&); + Optional parse_url_function(ComponentValue const&); RefPtr parse_url_value(ComponentValue const&); Optional> parse_linear_color_stop_list(TokenStream&); @@ -330,7 +330,7 @@ private: namespace Web { -CSS::CSSStyleSheet* parse_css_stylesheet(CSS::Parser::ParsingContext const&, StringView, Optional location = {}); +CSS::CSSStyleSheet* parse_css_stylesheet(CSS::Parser::ParsingContext const&, StringView, Optional location = {}); CSS::ElementInlineCSSStyleDeclaration* parse_css_style_attribute(CSS::Parser::ParsingContext const&, StringView, DOM::Element&); RefPtr parse_css_value(CSS::Parser::ParsingContext const&, StringView, CSS::PropertyID property_id = CSS::PropertyID::Invalid); Optional parse_selector(CSS::Parser::ParsingContext const&, StringView); diff --git a/Userland/Libraries/LibWeb/CSS/Parser/ParsingContext.cpp b/Userland/Libraries/LibWeb/CSS/Parser/ParsingContext.cpp index 0af33ebdc1..156523cce1 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/ParsingContext.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/ParsingContext.cpp @@ -19,7 +19,7 @@ ParsingContext::ParsingContext(JS::Realm& realm, Mode mode) { } -ParsingContext::ParsingContext(DOM::Document const& document, AK::URL url, Mode mode) +ParsingContext::ParsingContext(DOM::Document const& document, URL url, Mode mode) : m_realm(const_cast(document.realm())) , m_document(&document) , m_url(move(url)) @@ -49,7 +49,7 @@ bool ParsingContext::in_quirks_mode() const } // https://www.w3.org/TR/css-values-4/#relative-urls -AK::URL ParsingContext::complete_url(StringView relative_url) const +URL ParsingContext::complete_url(StringView relative_url) const { return m_url.complete_url(relative_url); } diff --git a/Userland/Libraries/LibWeb/CSS/Parser/ParsingContext.h b/Userland/Libraries/LibWeb/CSS/Parser/ParsingContext.h index a2550e04b8..fef3d7e6d9 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/ParsingContext.h +++ b/Userland/Libraries/LibWeb/CSS/Parser/ParsingContext.h @@ -21,7 +21,7 @@ public: explicit ParsingContext(JS::Realm&, Mode = Mode::Normal); explicit ParsingContext(DOM::Document const&, Mode = Mode::Normal); - explicit ParsingContext(DOM::Document const&, AK::URL, Mode = Mode::Normal); + explicit ParsingContext(DOM::Document const&, URL, Mode = Mode::Normal); explicit ParsingContext(DOM::ParentNode&, Mode = Mode::Normal); Mode mode() const { return m_mode; } @@ -30,7 +30,7 @@ public: bool in_quirks_mode() const; DOM::Document const* document() const { return m_document; } HTML::Window const* window() const; - AK::URL complete_url(StringView) const; + URL complete_url(StringView) const; PropertyID current_property_id() const { return m_current_property_id; } void set_current_property_id(PropertyID property_id) { m_current_property_id = property_id; } @@ -41,7 +41,7 @@ private: JS::NonnullGCPtr m_realm; JS::GCPtr m_document; PropertyID m_current_property_id { PropertyID::Invalid }; - AK::URL m_url; + URL m_url; Mode m_mode { Mode::Normal }; }; diff --git a/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp b/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp index 6a3d189cdd..5008a24c93 100644 --- a/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp +++ b/Userland/Libraries/LibWeb/CSS/SelectorEngine.cpp @@ -276,10 +276,10 @@ static inline bool matches_pseudo_class(CSS::Selector::SimpleSelector::PseudoCla if (!matches_link_pseudo_class(element)) return false; auto document_url = element.document().url(); - AK::URL target_url = element.document().parse_url(element.attribute(HTML::AttributeNames::href).value_or({})); + URL target_url = element.document().parse_url(element.attribute(HTML::AttributeNames::href).value_or({})); if (target_url.fragment().has_value()) - return document_url.equals(target_url, AK::URL::ExcludeFragment::No); - return document_url.equals(target_url, AK::URL::ExcludeFragment::Yes); + return document_url.equals(target_url, URL::ExcludeFragment::No); + return document_url.equals(target_url, URL::ExcludeFragment::Yes); } case CSS::PseudoClass::Visited: // FIXME: Maybe match this selector sometimes? diff --git a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp index d7ee606e56..5298a1d3b6 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp @@ -100,7 +100,7 @@ StyleComputer::~StyleComputer() = default; class StyleComputer::FontLoader : public ResourceClient { public: - explicit FontLoader(StyleComputer& style_computer, FlyString family_name, Vector unicode_ranges, Vector urls) + explicit FontLoader(StyleComputer& style_computer, FlyString family_name, Vector unicode_ranges, Vector urls) : m_style_computer(style_computer) , m_family_name(move(family_name)) , m_unicode_ranges(move(unicode_ranges)) @@ -185,7 +185,7 @@ private: FlyString m_family_name; Vector m_unicode_ranges; RefPtr m_vector_font; - Vector m_urls; + Vector m_urls; }; struct StyleComputer::MatchingFontCandidate { @@ -1999,11 +1999,11 @@ void StyleComputer::load_fonts_from_sheet(CSSStyleSheet const& sheet) .slope = font_face.slope().value_or(0), }; - Vector urls; + Vector urls; for (auto& source : font_face.sources()) { // FIXME: These should be loaded relative to the stylesheet URL instead of the document URL. - if (source.local_or_url.has()) - urls.append(m_document->parse_url(MUST(source.local_or_url.get().to_string()))); + if (source.local_or_url.has()) + urls.append(m_document->parse_url(MUST(source.local_or_url.get().to_string()))); // FIXME: Handle local() } diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/ImageStyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValues/ImageStyleValue.cpp index ab7c8f6aa5..587f0602b7 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/ImageStyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/ImageStyleValue.cpp @@ -20,7 +20,7 @@ namespace Web::CSS { -ImageStyleValue::ImageStyleValue(AK::URL const& url) +ImageStyleValue::ImageStyleValue(URL const& url) : AbstractImageStyleValue(Type::Image) , m_url(url) { diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/ImageStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/ImageStyleValue.h index 2363330674..875f65c1ce 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/ImageStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/ImageStyleValue.h @@ -22,7 +22,7 @@ class ImageStyleValue final : public AbstractImageStyleValue , public Weakable { public: - static ValueComparingNonnullRefPtr create(AK::URL const& url) + static ValueComparingNonnullRefPtr create(URL const& url) { return adopt_ref(*new (nothrow) ImageStyleValue(url)); } @@ -54,14 +54,14 @@ public: JS::GCPtr image_data() const; private: - ImageStyleValue(AK::URL const&); + ImageStyleValue(URL const&); JS::GCPtr m_image_request; void animate(); Gfx::ImmutableBitmap const* bitmap(size_t frame_index, Gfx::IntSize = {}) const; - AK::URL m_url; + URL m_url; WeakPtr m_document; size_t m_current_frame_index { 0 }; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/URLStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/URLStyleValue.h index feeb66c96c..573ae5215d 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/URLStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/URLStyleValue.h @@ -14,14 +14,14 @@ namespace Web::CSS { class URLStyleValue final : public StyleValueWithDefaultOperators { public: - static ValueComparingNonnullRefPtr create(AK::URL const& url) + static ValueComparingNonnullRefPtr create(URL const& url) { return adopt_ref(*new (nothrow) URLStyleValue(url)); } virtual ~URLStyleValue() override = default; - AK::URL const& url() const { return m_url; } + URL const& url() const { return m_url; } bool properties_equal(URLStyleValue const& other) const { return m_url == other.m_url; } @@ -31,13 +31,13 @@ public: } private: - URLStyleValue(AK::URL const& url) + URLStyleValue(URL const& url) : StyleValueWithDefaultOperators(Type::URL) , m_url(url) { } - AK::URL m_url; + URL m_url; }; } diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index 268ea76956..2eebc56413 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -312,8 +312,8 @@ WebIDL::ExceptionOr> Document::create_and_initialize( auto const& referrer = navigation_params.request->referrer(); // 3. If referrer is a URL record, then set document's referrer to the serialization of referrer. - if (referrer.has()) { - document->m_referrer = MUST(String::from_byte_string(referrer.get().serialize())); + if (referrer.has()) { + document->m_referrer = MUST(String::from_byte_string(referrer.get().serialize())); } } @@ -337,12 +337,12 @@ WebIDL::ExceptionOr> Document::construct_impl(JS::Rea return Document::create(realm); } -JS::NonnullGCPtr Document::create(JS::Realm& realm, AK::URL const& url) +JS::NonnullGCPtr Document::create(JS::Realm& realm, URL const& url) { return realm.heap().allocate(realm, realm, url); } -Document::Document(JS::Realm& realm, const AK::URL& url) +Document::Document(JS::Realm& realm, const URL& url) : ParentNode(realm, *this, NodeType::DOCUMENT_NODE) , m_page(Bindings::host_defined_page(realm)) , m_style_computer(make(*this)) @@ -938,7 +938,7 @@ JS::GCPtr Document::first_base_element_with_href_in } // https://html.spec.whatwg.org/multipage/urls-and-fetching.html#fallback-base-url -AK::URL Document::fallback_base_url() const +URL Document::fallback_base_url() const { // 1. If document is an iframe srcdoc document, then: if (HTML::url_matches_about_srcdoc(m_url)) { @@ -958,7 +958,7 @@ AK::URL Document::fallback_base_url() const } // https://html.spec.whatwg.org/multipage/urls-and-fetching.html#document-base-url -AK::URL Document::base_url() const +URL Document::base_url() const { // 1. If there is no base element that has an href attribute in the Document, then return the Document's fallback base URL. auto base_element = first_base_element_with_href_in_tree_order(); @@ -970,7 +970,7 @@ AK::URL Document::base_url() const } // https://html.spec.whatwg.org/multipage/urls-and-fetching.html#parse-a-url -AK::URL Document::parse_url(StringView url) const +URL Document::parse_url(StringView url) const { // FIXME: Pass in document's character encoding. return base_url().complete_url(url); @@ -1855,7 +1855,7 @@ Document::IndicatedPart Document::determine_the_indicated_part() const // 5. Let fragmentBytes be the result of percent-decoding fragment. // 6. Let decodedFragment be the result of running UTF-8 decode without BOM on fragmentBytes. - auto decoded_fragment = AK::URL::percent_decode(*fragment); + auto decoded_fragment = URL::percent_decode(*fragment); // 7. Set potentialIndicatedElement to the result of finding a potential indicated element given document and decodedFragment. potential_indicated_element = find_a_potential_indicated_element(MUST(FlyString::from_deprecated_fly_string(decoded_fragment))); @@ -3768,7 +3768,7 @@ void Document::update_for_history_step_application(JS::NonnullGCPtrurl : AK::URL {}; + auto old_url = m_latest_entry ? m_latest_entry->url : URL {}; // 2. Set document's latest entry to entry. m_latest_entry = entry; @@ -3831,7 +3831,7 @@ void Document::update_for_history_step_application(JS::NonnullGCPtr>& Document::shared_image_requests() +HashMap>& Document::shared_image_requests() { return m_shared_image_requests; } diff --git a/Userland/Libraries/LibWeb/DOM/Document.h b/Userland/Libraries/LibWeb/DOM/Document.h index bc53f0ee3e..530ca53522 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.h +++ b/Userland/Libraries/LibWeb/DOM/Document.h @@ -92,7 +92,7 @@ public: static WebIDL::ExceptionOr> create_and_initialize(Type, String content_type, HTML::NavigationParams&); - [[nodiscard]] static JS::NonnullGCPtr create(JS::Realm&, AK::URL const& url = "about:blank"sv); + [[nodiscard]] static JS::NonnullGCPtr create(JS::Realm&, URL const& url = "about:blank"sv); static WebIDL::ExceptionOr> construct_impl(JS::Realm&); virtual ~Document() override; @@ -106,10 +106,10 @@ public: String referrer() const; void set_referrer(String); - void set_url(const AK::URL& url) { m_url = url; } - AK::URL url() const { return m_url; } - AK::URL fallback_base_url() const; - AK::URL base_url() const; + void set_url(const URL& url) { m_url = url; } + URL url() const { return m_url; } + URL fallback_base_url() const; + URL base_url() const; void update_base_element(Badge); JS::GCPtr first_base_element_with_href_in_tree_order() const; @@ -123,7 +123,7 @@ public: HTML::CrossOriginOpenerPolicy const& cross_origin_opener_policy() const { return m_cross_origin_opener_policy; } void set_cross_origin_opener_policy(HTML::CrossOriginOpenerPolicy policy) { m_cross_origin_opener_policy = move(policy); } - AK::URL parse_url(StringView) const; + URL parse_url(StringView) const; CSS::StyleComputer& style_computer() { return *m_style_computer; } const CSS::StyleComputer& style_computer() const { return *m_style_computer; } @@ -451,8 +451,8 @@ public: void set_is_initial_about_blank(bool b) { m_is_initial_about_blank = b; } // https://html.spec.whatwg.org/multipage/dom.html#concept-document-about-base-url - Optional about_base_url() const { return m_about_base_url; } - void set_about_base_url(Optional url) { m_about_base_url = url; } + Optional about_base_url() const { return m_about_base_url; } + void set_about_base_url(Optional url) { m_about_base_url = url; } String domain() const; void set_domain(String const&); @@ -544,7 +544,7 @@ public: void update_for_history_step_application(JS::NonnullGCPtr, bool do_not_reactivate, size_t script_history_length, size_t script_history_index, Optional>> entries_for_navigation_api = {}, bool update_navigation_api = true); - HashMap>& shared_image_requests(); + HashMap>& shared_image_requests(); void restore_the_history_object_state(JS::NonnullGCPtr entry); @@ -602,7 +602,7 @@ protected: virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; - Document(JS::Realm&, AK::URL const&); + Document(JS::Realm&, URL const&); private: // ^HTML::GlobalEventHandlers @@ -631,7 +631,7 @@ private: Optional m_inspected_pseudo_element; JS::GCPtr m_active_favicon; WeakPtr m_browsing_context; - AK::URL m_url; + URL m_url; JS::GCPtr m_window; @@ -732,7 +732,7 @@ private: bool m_is_initial_about_blank { false }; // https://html.spec.whatwg.org/multipage/dom.html#concept-document-about-base-url - Optional m_about_base_url; + Optional m_about_base_url; // https://html.spec.whatwg.org/multipage/dom.html#concept-document-coop HTML::CrossOriginOpenerPolicy m_cross_origin_opener_policy; @@ -808,7 +808,7 @@ private: // https://html.spec.whatwg.org/multipage/browsing-the-web.html#latest-entry JS::GCPtr m_latest_entry; - HashMap> m_shared_image_requests; + HashMap> m_shared_image_requests; // https://www.w3.org/TR/web-animations-1/#timeline-associated-with-a-document HashTable> m_associated_animation_timelines; diff --git a/Userland/Libraries/LibWeb/DOM/DocumentLoading.h b/Userland/Libraries/LibWeb/DOM/DocumentLoading.h index 0ae6a48072..e249be31f6 100644 --- a/Userland/Libraries/LibWeb/DOM/DocumentLoading.h +++ b/Userland/Libraries/LibWeb/DOM/DocumentLoading.h @@ -31,7 +31,7 @@ JS::NonnullGCPtr create_document_for_inline_content(JS::GCPtr create_document_for_inline_content(JS::GCPtrurl_list().append(AK::URL("about:error")); // AD-HOC: https://github.com/whatwg/html/issues/9122 + response->url_list().append(URL("about:error")); // AD-HOC: https://github.com/whatwg/html/issues/9122 HTML::NavigationParams navigation_params { .id = navigation_id, .navigable = navigable, diff --git a/Userland/Libraries/LibWeb/DOM/XMLDocument.cpp b/Userland/Libraries/LibWeb/DOM/XMLDocument.cpp index 0377372d94..13804e030e 100644 --- a/Userland/Libraries/LibWeb/DOM/XMLDocument.cpp +++ b/Userland/Libraries/LibWeb/DOM/XMLDocument.cpp @@ -11,12 +11,12 @@ namespace Web::DOM { JS_DEFINE_ALLOCATOR(XMLDocument); -JS::NonnullGCPtr XMLDocument::create(JS::Realm& realm, AK::URL const& url) +JS::NonnullGCPtr XMLDocument::create(JS::Realm& realm, URL const& url) { return realm.heap().allocate(realm, realm, url); } -XMLDocument::XMLDocument(JS::Realm& realm, AK::URL const& url) +XMLDocument::XMLDocument(JS::Realm& realm, URL const& url) : Document(realm, url) { } diff --git a/Userland/Libraries/LibWeb/DOM/XMLDocument.h b/Userland/Libraries/LibWeb/DOM/XMLDocument.h index 468dcac5da..1f715df282 100644 --- a/Userland/Libraries/LibWeb/DOM/XMLDocument.h +++ b/Userland/Libraries/LibWeb/DOM/XMLDocument.h @@ -15,11 +15,11 @@ class XMLDocument final : public Document { JS_DECLARE_ALLOCATOR(XMLDocument); public: - static JS::NonnullGCPtr create(JS::Realm&, AK::URL const& url = "about:blank"sv); + static JS::NonnullGCPtr create(JS::Realm&, URL const& url = "about:blank"sv); virtual ~XMLDocument() override = default; private: - XMLDocument(JS::Realm& realm, AK::URL const& url); + XMLDocument(JS::Realm& realm, URL const& url); virtual void initialize(JS::Realm&) override; }; diff --git a/Userland/Libraries/LibWeb/DOMURL/DOMURL.cpp b/Userland/Libraries/LibWeb/DOMURL/DOMURL.cpp index 03f9f48840..d6d5969ebb 100644 --- a/Userland/Libraries/LibWeb/DOMURL/DOMURL.cpp +++ b/Userland/Libraries/LibWeb/DOMURL/DOMURL.cpp @@ -18,19 +18,19 @@ namespace Web::DOMURL { JS_DEFINE_ALLOCATOR(DOMURL); -JS::NonnullGCPtr DOMURL::create(JS::Realm& realm, AK::URL url, JS::NonnullGCPtr query) +JS::NonnullGCPtr DOMURL::create(JS::Realm& realm, URL url, JS::NonnullGCPtr query) { return realm.heap().allocate(realm, realm, move(url), move(query)); } // https://url.spec.whatwg.org/#api-url-parser -static Optional parse_api_url(String const& url, Optional const& base) +static Optional parse_api_url(String const& url, Optional const& base) { // FIXME: We somewhat awkwardly have two failure states encapsulated in the return type (and convert between them in the steps), // ideally we'd get rid of URL's valid flag // 1. Let parsedBase be null. - Optional parsed_base; + Optional parsed_base; // 2. If base is non-null: if (base.has_value()) { @@ -46,7 +46,7 @@ static Optional parse_api_url(String const& url, Optional const // 3. Return the result of running the basic URL parser on url with parsedBase. auto parsed = URLParser::basic_parse(url, parsed_base); - return parsed.is_valid() ? parsed : Optional {}; + return parsed.is_valid() ? parsed : Optional {}; } // https://url.spec.whatwg.org/#dom-url-url @@ -75,7 +75,7 @@ WebIDL::ExceptionOr> DOMURL::construct_impl(JS::Realm& return result_url; } -DOMURL::DOMURL(JS::Realm& realm, AK::URL url, JS::NonnullGCPtr query) +DOMURL::DOMURL(JS::Realm& realm, URL url, JS::NonnullGCPtr query) : PlatformObject(realm) , m_url(move(url)) , m_query(move(query)) @@ -166,7 +166,7 @@ WebIDL::ExceptionOr DOMURL::set_href(String const& href) auto& vm = realm().vm(); // 1. Let parsedURL be the result of running the basic URL parser on the given value. - AK::URL parsed_url = href; + URL parsed_url = href; // 2. If parsedURL is failure, then throw a TypeError. if (!parsed_url.is_valid()) @@ -355,7 +355,7 @@ WebIDL::ExceptionOr DOMURL::pathname() const auto& vm = realm().vm(); // The pathname getter steps are to return the result of URL path serializing this’s URL. - return TRY_OR_THROW_OOM(vm, String::from_byte_string(m_url.serialize_path(AK::URL::ApplyPercentDecoding::No))); + return TRY_OR_THROW_OOM(vm, String::from_byte_string(m_url.serialize_path(URL::ApplyPercentDecoding::No))); } // https://url.spec.whatwg.org/#ref-for-dom-url-pathname%E2%91%A0 @@ -482,7 +482,7 @@ void DOMURL::set_hash(String const& hash) } // https://url.spec.whatwg.org/#concept-url-origin -HTML::Origin url_origin(AK::URL const& url) +HTML::Origin url_origin(URL const& url) { // FIXME: We should probably have an extended version of AK::URL for LibWeb instead of standalone functions like this. @@ -533,7 +533,7 @@ HTML::Origin url_origin(AK::URL const& url) } // https://url.spec.whatwg.org/#concept-domain -bool host_is_domain(AK::URL::Host const& host) +bool host_is_domain(URL::Host const& host) { // A domain is a non-empty ASCII string that identifies a realm within a network. return host.has() && host.get() != String {}; @@ -563,7 +563,7 @@ void strip_trailing_spaces_from_an_opaque_path(DOMURL& url) } // https://url.spec.whatwg.org/#concept-url-parser -AK::URL parse(StringView input, Optional const& base_url) +URL parse(StringView input, Optional const& base_url) { // FIXME: We should probably have an extended version of AK::URL for LibWeb instead of standalone functions like this. diff --git a/Userland/Libraries/LibWeb/DOMURL/DOMURL.h b/Userland/Libraries/LibWeb/DOMURL/DOMURL.h index d8a96b7b4e..62df78f46b 100644 --- a/Userland/Libraries/LibWeb/DOMURL/DOMURL.h +++ b/Userland/Libraries/LibWeb/DOMURL/DOMURL.h @@ -79,22 +79,22 @@ public: void set_query(Badge, Optional query) { m_url.set_query(move(query)); } private: - DOMURL(JS::Realm&, AK::URL, JS::NonnullGCPtr query); + DOMURL(JS::Realm&, URL, JS::NonnullGCPtr query); virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; - AK::URL m_url; + URL m_url; JS::NonnullGCPtr m_query; }; -HTML::Origin url_origin(AK::URL const&); -bool host_is_domain(AK::URL::Host const&); +HTML::Origin url_origin(URL const&); +bool host_is_domain(URL::Host const&); // https://url.spec.whatwg.org/#potentially-strip-trailing-spaces-from-an-opaque-path void strip_trailing_spaces_from_an_opaque_path(DOMURL& url); // https://url.spec.whatwg.org/#concept-url-parser -AK::URL parse(StringView input, Optional const& base_url = {}); +URL parse(StringView input, Optional const& base_url = {}); } diff --git a/Userland/Libraries/LibWeb/DOMURL/URLSearchParams.cpp b/Userland/Libraries/LibWeb/DOMURL/URLSearchParams.cpp index 5c15e8b481..581aab7628 100644 --- a/Userland/Libraries/LibWeb/DOMURL/URLSearchParams.cpp +++ b/Userland/Libraries/LibWeb/DOMURL/URLSearchParams.cpp @@ -55,11 +55,11 @@ ErrorOr url_encode(Vector const& tuples, StringView encoding // 2. Let name be the result of running percent-encode after encoding with encoding, tuple’s name, the application/x-www-form-urlencoded percent-encode set, and true. // FIXME: URLParser does not currently implement encoding. - auto name = TRY(URLParser::percent_encode_after_encoding(tuple.name, AK::URL::PercentEncodeSet::ApplicationXWWWFormUrlencoded, true)); + auto name = TRY(URLParser::percent_encode_after_encoding(tuple.name, URL::PercentEncodeSet::ApplicationXWWWFormUrlencoded, true)); // 3. Let value be the result of running percent-encode after encoding with encoding, tuple’s value, the application/x-www-form-urlencoded percent-encode set, and true. // FIXME: URLParser does not currently implement encoding. - auto value = TRY(URLParser::percent_encode_after_encoding(tuple.value, AK::URL::PercentEncodeSet::ApplicationXWWWFormUrlencoded, true)); + auto value = TRY(URLParser::percent_encode_after_encoding(tuple.value, URL::PercentEncodeSet::ApplicationXWWWFormUrlencoded, true)); // 4. If output is not the empty string, then append U+0026 (&) to output. if (!output.is_empty()) @@ -109,8 +109,8 @@ ErrorOr> url_decode(StringView input) auto space_decoded_name = name.replace("+"sv, " "sv, ReplaceMode::All); // 5. Let nameString and valueString be the result of running UTF-8 decode without BOM on the percent-decoding of name and value, respectively. - auto name_string = TRY(String::from_byte_string(AK::URL::percent_decode(space_decoded_name))); - auto value_string = TRY(String::from_byte_string(AK::URL::percent_decode(value))); + auto name_string = TRY(String::from_byte_string(URL::percent_decode(space_decoded_name))); + auto value_string = TRY(String::from_byte_string(URL::percent_decode(value))); TRY(output.try_empend(move(name_string), move(value_string))); } diff --git a/Userland/Libraries/LibWeb/Dump.cpp b/Userland/Libraries/LibWeb/Dump.cpp index 70769641a9..3f72ec1a58 100644 --- a/Userland/Libraries/LibWeb/Dump.cpp +++ b/Userland/Libraries/LibWeb/Dump.cpp @@ -647,8 +647,8 @@ void dump_font_face_rule(StringBuilder& builder, CSS::CSSFontFaceRule const& rul builder.append("sources:\n"sv); for (auto const& source : font_face.sources()) { indent(builder, indent_levels + 2); - if (source.local_or_url.has()) - builder.appendff("url={}, format={}\n", source.local_or_url.get(), source.format.value_or("???"_string)); + if (source.local_or_url.has()) + builder.appendff("url={}, format={}\n", source.local_or_url.get(), source.format.value_or("???"_string)); else builder.appendff("local={}\n", source.local_or_url.get()); } diff --git a/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp b/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp index be37557c64..a1278395c1 100644 --- a/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp @@ -1335,9 +1335,9 @@ WebIDL::ExceptionOr> http_network_or_cache_fet } // 11. If httpRequest’s referrer is a URL, then: - if (http_request->referrer().has()) { + if (http_request->referrer().has()) { // 1. Let referrerValue be httpRequest’s referrer, serialized and isomorphic encoded. - auto referrer_value = TRY_OR_THROW_OOM(vm, ByteBuffer::copy(http_request->referrer().get().serialize().bytes())); + auto referrer_value = TRY_OR_THROW_OOM(vm, ByteBuffer::copy(http_request->referrer().get().serialize().bytes())); // 2. Append (`Referer`, referrerValue) to httpRequest’s header list. auto header = Infrastructure::Header { diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.cpp b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.cpp index f4555d321d..b2fac3a52d 100644 --- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.cpp @@ -44,7 +44,7 @@ JS::NonnullGCPtr Request::create(JS::VM& vm) } // https://fetch.spec.whatwg.org/#concept-request-url -AK::URL& Request::url() +URL& Request::url() { // A request has an associated URL (a URL). // NOTE: Implementations are encouraged to make this a pointer to the first URL in request’s URL list. It is provided as a distinct field solely for the convenience of other standards hooking into Fetch. @@ -53,13 +53,13 @@ AK::URL& Request::url() } // https://fetch.spec.whatwg.org/#concept-request-url -AK::URL const& Request::url() const +URL const& Request::url() const { return const_cast(*this).url(); } // https://fetch.spec.whatwg.org/#concept-request-current-url -AK::URL& Request::current_url() +URL& Request::current_url() { // A request has an associated current URL. It is a pointer to the last URL in request’s URL list. VERIFY(!m_url_list.is_empty()); @@ -67,12 +67,12 @@ AK::URL& Request::current_url() } // https://fetch.spec.whatwg.org/#concept-request-current-url -AK::URL const& Request::current_url() const +URL const& Request::current_url() const { return const_cast(*this).current_url(); } -void Request::set_url(AK::URL url) +void Request::set_url(URL url) { // Sometimes setting the URL and URL list are done as two distinct steps in the spec, // but since we know the URL is always the URL list's first item and doesn't change later @@ -163,7 +163,7 @@ bool Request::has_redirect_tainted_origin() const // A request request has a redirect-tainted origin if these steps return true: // 1. Let lastURL be null. - Optional last_url; + Optional last_url; // 2. For each url of request’s URL list: for (auto const& url : m_url_list) { diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.h b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.h index bcc00bc778..9323561c16 100644 --- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.h +++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.h @@ -164,7 +164,7 @@ public: using BodyType = Variant>; using OriginType = Variant; using PolicyContainerType = Variant; - using ReferrerType = Variant; + using ReferrerType = Variant; using ReservedClientType = Variant>; using WindowType = Variant>; @@ -263,9 +263,9 @@ public: [[nodiscard]] bool render_blocking() const { return m_render_blocking; } void set_render_blocking(bool render_blocking) { m_render_blocking = render_blocking; } - [[nodiscard]] Vector const& url_list() const { return m_url_list; } - [[nodiscard]] Vector& url_list() { return m_url_list; } - void set_url_list(Vector url_list) { m_url_list = move(url_list); } + [[nodiscard]] Vector const& url_list() const { return m_url_list; } + [[nodiscard]] Vector& url_list() { return m_url_list; } + void set_url_list(Vector url_list) { m_url_list = move(url_list); } [[nodiscard]] u8 redirect_count() const { return m_redirect_count; } void set_redirect_count(u8 redirect_count) { m_redirect_count = redirect_count; } @@ -288,11 +288,11 @@ public: [[nodiscard]] bool timing_allow_failed() const { return m_timing_allow_failed; } void set_timing_allow_failed(bool timing_allow_failed) { m_timing_allow_failed = timing_allow_failed; } - [[nodiscard]] AK::URL& url(); - [[nodiscard]] AK::URL const& url() const; - [[nodiscard]] AK::URL& current_url(); - [[nodiscard]] AK::URL const& current_url() const; - void set_url(AK::URL url); + [[nodiscard]] URL& url(); + [[nodiscard]] URL const& url() const; + [[nodiscard]] URL& current_url(); + [[nodiscard]] URL const& current_url() const; + void set_url(URL url); [[nodiscard]] bool destination_is_script_like() const; @@ -487,7 +487,7 @@ private: // https://fetch.spec.whatwg.org/#concept-request-url-list // A request has an associated URL list (a list of one or more URLs). Unless stated otherwise, it is a list // containing a copy of request’s URL. - Vector m_url_list; + Vector m_url_list; // https://fetch.spec.whatwg.org/#concept-request-redirect-count // A request has an associated redirect count. Unless stated otherwise, it is zero. diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.cpp b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.cpp index 232a5835e9..bb508de114 100644 --- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.cpp @@ -104,7 +104,7 @@ bool Response::is_network_error() const } // https://fetch.spec.whatwg.org/#concept-response-url -Optional Response::url() const +Optional Response::url() const { // A response has an associated URL. It is a pointer to the last URL in response’s URL list and null if response’s URL list is empty. // NOTE: We have to use the virtual getter here to not bypass filtered responses. @@ -114,23 +114,23 @@ Optional Response::url() const } // https://fetch.spec.whatwg.org/#concept-response-location-url -ErrorOr> Response::location_url(Optional const& request_fragment) const +ErrorOr> Response::location_url(Optional const& request_fragment) const { // The location URL of a response response, given null or an ASCII string requestFragment, is the value returned by the following steps. They return null, failure, or a URL. // 1. If response’s status is not a redirect status, then return null. // NOTE: We have to use the virtual getter here to not bypass filtered responses. if (!is_redirect_status(status())) - return Optional {}; + return Optional {}; // 2. Let location be the result of extracting header list values given `Location` and response’s header list. auto location_values_or_failure = TRY(extract_header_list_values("Location"sv.bytes(), m_header_list)); if (location_values_or_failure.has() || location_values_or_failure.has()) - return Optional {}; + return Optional {}; auto const& location_values = location_values_or_failure.get>(); if (location_values.size() != 1) - return Optional {}; + return Optional {}; // 3. If location is a header value, then set location to the result of parsing location with response’s URL. auto location = DOMURL::parse(location_values.first(), url()); diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.h b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.h index 4dae9240bc..21896567f5 100644 --- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.h +++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.h @@ -65,9 +65,9 @@ public: [[nodiscard]] virtual bool aborted() const { return m_aborted; } void set_aborted(bool aborted) { m_aborted = aborted; } - [[nodiscard]] virtual Vector const& url_list() const { return m_url_list; } - [[nodiscard]] virtual Vector& url_list() { return m_url_list; } - void set_url_list(Vector url_list) { m_url_list = move(url_list); } + [[nodiscard]] virtual Vector const& url_list() const { return m_url_list; } + [[nodiscard]] virtual Vector& url_list() { return m_url_list; } + void set_url_list(Vector url_list) { m_url_list = move(url_list); } [[nodiscard]] virtual Status status() const { return m_status; } void set_status(Status status) { m_status = status; } @@ -106,8 +106,8 @@ public: [[nodiscard]] bool is_aborted_network_error() const; [[nodiscard]] bool is_network_error() const; - [[nodiscard]] Optional url() const; - [[nodiscard]] ErrorOr> location_url(Optional const& request_fragment) const; + [[nodiscard]] Optional url() const; + [[nodiscard]] ErrorOr> location_url(Optional const& request_fragment) const; [[nodiscard]] WebIDL::ExceptionOr> clone(JS::Realm&) const; @@ -134,7 +134,7 @@ private: // https://fetch.spec.whatwg.org/#concept-response-url-list // A response has an associated URL list (a list of zero or more URLs). Unless stated otherwise, it is the empty list. - Vector m_url_list; + Vector m_url_list; // https://fetch.spec.whatwg.org/#concept-response-status // A response has an associated status, which is a status. Unless stated otherwise it is 200. @@ -197,8 +197,8 @@ public: [[nodiscard]] virtual Type type() const override { return m_internal_response->type(); } [[nodiscard]] virtual bool aborted() const override { return m_internal_response->aborted(); } - [[nodiscard]] virtual Vector const& url_list() const override { return m_internal_response->url_list(); } - [[nodiscard]] virtual Vector& url_list() override { return m_internal_response->url_list(); } + [[nodiscard]] virtual Vector const& url_list() const override { return m_internal_response->url_list(); } + [[nodiscard]] virtual Vector& url_list() override { return m_internal_response->url_list(); } [[nodiscard]] virtual Status status() const override { return m_internal_response->status(); } [[nodiscard]] virtual ReadonlyBytes status_message() const override { return m_internal_response->status_message(); } [[nodiscard]] virtual JS::NonnullGCPtr header_list() const override { return m_internal_response->header_list(); } @@ -268,8 +268,8 @@ public: [[nodiscard]] static JS::NonnullGCPtr create(JS::VM&, JS::NonnullGCPtr); [[nodiscard]] virtual Type type() const override { return Type::Opaque; } - [[nodiscard]] virtual Vector const& url_list() const override { return m_url_list; } - [[nodiscard]] virtual Vector& url_list() override { return m_url_list; } + [[nodiscard]] virtual Vector const& url_list() const override { return m_url_list; } + [[nodiscard]] virtual Vector& url_list() override { return m_url_list; } [[nodiscard]] virtual Status status() const override { return 0; } [[nodiscard]] virtual ReadonlyBytes status_message() const override { return {}; } [[nodiscard]] virtual JS::NonnullGCPtr header_list() const override { return m_header_list; } @@ -281,7 +281,7 @@ private: virtual void visit_edges(JS::Cell::Visitor&) override; - Vector m_url_list; + Vector m_url_list; JS::NonnullGCPtr m_header_list; JS::GCPtr m_body; }; diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/URL.cpp b/Userland/Libraries/LibWeb/Fetch/Infrastructure/URL.cpp index 2c1f0bfeea..d9caad07d8 100644 --- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/URL.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/URL.cpp @@ -10,7 +10,7 @@ namespace Web::Fetch::Infrastructure { // https://fetch.spec.whatwg.org/#is-local -bool is_local_url(AK::URL const& url) +bool is_local_url(URL const& url) { // A URL is local if its scheme is a local scheme. return any_of(LOCAL_SCHEMES, [&](auto scheme) { return url.scheme() == scheme; }); diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/URL.h b/Userland/Libraries/LibWeb/Fetch/Infrastructure/URL.h index ad1048007c..4a4cbb6180 100644 --- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/URL.h +++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/URL.h @@ -33,7 +33,7 @@ inline constexpr Array FETCH_SCHEMES = { "resource"sv }; -[[nodiscard]] bool is_local_url(AK::URL const&); +[[nodiscard]] bool is_local_url(URL const&); [[nodiscard]] bool is_fetch_scheme(StringView); [[nodiscard]] bool is_http_or_https_scheme(StringView); diff --git a/Userland/Libraries/LibWeb/Fetch/Request.cpp b/Userland/Libraries/LibWeb/Fetch/Request.cpp index 2a9f2413e7..c652a4e948 100644 --- a/Userland/Libraries/LibWeb/Fetch/Request.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Request.cpp @@ -548,7 +548,7 @@ WebIDL::ExceptionOr Request::referrer() const VERIFY_NOT_REACHED(); } }, - [&](AK::URL const& url) -> WebIDL::ExceptionOr { + [&](URL const& url) -> WebIDL::ExceptionOr { // 3. Return this’s request’s referrer, serialized. return TRY_OR_THROW_OOM(vm, String::from_byte_string(url.serialize())); }); diff --git a/Userland/Libraries/LibWeb/Fetch/Response.cpp b/Userland/Libraries/LibWeb/Fetch/Response.cpp index f290fc5b1e..80c80681b9 100644 --- a/Userland/Libraries/LibWeb/Fetch/Response.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Response.cpp @@ -239,7 +239,7 @@ WebIDL::ExceptionOr Response::url() const // The url getter steps are to return the empty string if this’s response’s URL is null; otherwise this’s response’s URL, serialized with exclude fragment set to true. return !m_response->url().has_value() ? String {} - : TRY_OR_THROW_OOM(vm, String::from_byte_string(m_response->url()->serialize(AK::URL::ExcludeFragment::Yes))); + : TRY_OR_THROW_OOM(vm, String::from_byte_string(m_response->url()->serialize(URL::ExcludeFragment::Yes))); } // https://fetch.spec.whatwg.org/#dom-response-redirected diff --git a/Userland/Libraries/LibWeb/FileAPI/BlobURLStore.cpp b/Userland/Libraries/LibWeb/FileAPI/BlobURLStore.cpp index 2f93f20d7f..fafadab99a 100644 --- a/Userland/Libraries/LibWeb/FileAPI/BlobURLStore.cpp +++ b/Userland/Libraries/LibWeb/FileAPI/BlobURLStore.cpp @@ -82,7 +82,7 @@ ErrorOr remove_entry_from_blob_url_store(StringView url) auto& store = blob_url_store(); // 2. Let url string be the result of serializing url. - auto url_string = TRY(AK::URL { url }.to_string()); + auto url_string = TRY(URL { url }.to_string()); // 3. Remove store[url string]. store.remove(url_string); diff --git a/Userland/Libraries/LibWeb/FileAPI/FileReader.cpp b/Userland/Libraries/LibWeb/FileAPI/FileReader.cpp index 405d0f0f1f..e52a842d76 100644 --- a/Userland/Libraries/LibWeb/FileAPI/FileReader.cpp +++ b/Userland/Libraries/LibWeb/FileAPI/FileReader.cpp @@ -70,7 +70,7 @@ WebIDL::ExceptionOr FileReader::blob_package_data(JS::Realm& // Return bytes as a DataURL [RFC2397] subject to the considerations below: // Use mimeType as part of the Data URL if it is available in keeping with the Data URL specification [RFC2397]. // If mimeType is not available return a Data URL without a media-type. [RFC2397]. - return MUST(AK::URL::create_with_data(mime_type.value_or(String {}), MUST(encode_base64(bytes)), true).to_string()); + return MUST(URL::create_with_data(mime_type.value_or(String {}), MUST(encode_base64(bytes)), true).to_string()); case Type::Text: { // 1. Let encoding be failure. Optional encoding; diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp index d987b3ba4b..291946acbb 100644 --- a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp +++ b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp @@ -36,7 +36,7 @@ namespace Web::HTML { JS_DEFINE_ALLOCATOR(BrowsingContext); // https://html.spec.whatwg.org/multipage/urls-and-fetching.html#matches-about:blank -bool url_matches_about_blank(AK::URL const& url) +bool url_matches_about_blank(URL const& url) { // A URL matches about:blank if its scheme is "about", its path contains a single string "blank", its username and password are the empty string, and its host is null. return url.scheme() == "about"sv @@ -47,7 +47,7 @@ bool url_matches_about_blank(AK::URL const& url) } // https://html.spec.whatwg.org/multipage/urls-and-fetching.html#matches-about:srcdoc -bool url_matches_about_srcdoc(AK::URL const& url) +bool url_matches_about_srcdoc(URL const& url) { // A URL matches about:srcdoc if its scheme is "about", its path contains a single string "srcdoc", its query is null, its username and password are the empty string, and its host is null. return url.scheme() == "about"sv @@ -59,7 +59,7 @@ bool url_matches_about_srcdoc(AK::URL const& url) } // https://html.spec.whatwg.org/multipage/document-sequences.html#determining-the-origin -HTML::Origin determine_the_origin(AK::URL const& url, SandboxingFlagSet sandbox_flags, Optional source_origin) +HTML::Origin determine_the_origin(URL const& url, SandboxingFlagSet sandbox_flags, Optional source_origin) { // 1. If sandboxFlags has its sandboxed origin browsing context flag set, then return a new opaque origin. if (has_flag(sandbox_flags, SandboxingFlagSet::SandboxedOrigin)) { @@ -132,7 +132,7 @@ WebIDL::ExceptionOr BrowsingContext Optional creator_origin = {}; // FIXME: This algorithm needs re-aligned with the spec - Optional creator_base_url = {}; + Optional creator_base_url = {}; // 4. If creator is non-null, then: if (creator) { @@ -151,7 +151,7 @@ WebIDL::ExceptionOr BrowsingContext SandboxingFlagSet sandbox_flags = {}; // 6. Let origin be the result of determining the origin given about:blank, sandboxFlags, and creatorOrigin. - auto origin = determine_the_origin(AK::URL("about:blank"sv), sandbox_flags, creator_origin); + auto origin = determine_the_origin(URL("about:blank"sv), sandbox_flags, creator_origin); // FIXME: 7. Let permissionsPolicy be the result of creating a permissions policy given browsingContext and origin. [PERMISSIONSPOLICY] @@ -176,7 +176,7 @@ WebIDL::ExceptionOr BrowsingContext }); // 10. Let topLevelCreationURL be about:blank if embedder is null; otherwise embedder's relevant settings object's top-level creation URL. - auto top_level_creation_url = !embedder ? AK::URL("about:blank") : relevant_settings_object(*embedder).top_level_creation_url; + auto top_level_creation_url = !embedder ? URL("about:blank") : relevant_settings_object(*embedder).top_level_creation_url; // 11. Let topLevelOrigin be origin if embedder is null; otherwise embedder's relevant settings object's top-level origin. auto top_level_origin = !embedder ? origin : relevant_settings_object(*embedder).origin(); @@ -184,7 +184,7 @@ WebIDL::ExceptionOr BrowsingContext // 12. Set up a window environment settings object with about:blank, realm execution context, null, topLevelCreationURL, and topLevelOrigin. WindowEnvironmentSettingsObject::setup( page, - AK::URL("about:blank"), + URL("about:blank"), move(realm_execution_context), {}, top_level_creation_url, diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContext.h b/Userland/Libraries/LibWeb/HTML/BrowsingContext.h index 84171bb007..a46a3b3997 100644 --- a/Userland/Libraries/LibWeb/HTML/BrowsingContext.h +++ b/Userland/Libraries/LibWeb/HTML/BrowsingContext.h @@ -179,7 +179,7 @@ private: bool m_is_auxiliary { false }; // https://html.spec.whatwg.org/multipage/document-sequences.html#browsing-context-initial-url - Optional m_initial_url; + Optional m_initial_url; // https://html.spec.whatwg.org/multipage/document-sequences.html#virtual-browsing-context-group-id u64 m_virtual_browsing_context_group_id = { 0 }; @@ -199,12 +199,12 @@ private: JS::GCPtr m_previous_sibling; }; -HTML::Origin determine_the_origin(AK::URL const& url, SandboxingFlagSet sandbox_flags, Optional source_origin); +HTML::Origin determine_the_origin(URL const& url, SandboxingFlagSet sandbox_flags, Optional source_origin); SandboxingFlagSet determine_the_creation_sandboxing_flags(BrowsingContext const&, JS::GCPtr embedder); // FIXME: Find a better home for these -bool url_matches_about_blank(AK::URL const& url); -bool url_matches_about_srcdoc(AK::URL const& url); +bool url_matches_about_blank(URL const& url); +bool url_matches_about_srcdoc(URL const& url); } diff --git a/Userland/Libraries/LibWeb/HTML/CrossOrigin/CrossOriginOpenerPolicyEnforcementResult.h b/Userland/Libraries/LibWeb/HTML/CrossOrigin/CrossOriginOpenerPolicyEnforcementResult.h index 607497412d..45f17d755f 100644 --- a/Userland/Libraries/LibWeb/HTML/CrossOrigin/CrossOriginOpenerPolicyEnforcementResult.h +++ b/Userland/Libraries/LibWeb/HTML/CrossOrigin/CrossOriginOpenerPolicyEnforcementResult.h @@ -21,7 +21,7 @@ struct CrossOriginOpenerPolicyEnforcementResult { bool would_need_a_browsing_context_group_switch_due_to_report_only { false }; // A URL url. - AK::URL url; + URL url; // An origin origin. Origin origin; diff --git a/Userland/Libraries/LibWeb/HTML/DocumentState.h b/Userland/Libraries/LibWeb/HTML/DocumentState.h index 275e2dbd0d..e30efb40c7 100644 --- a/Userland/Libraries/LibWeb/HTML/DocumentState.h +++ b/Userland/Libraries/LibWeb/HTML/DocumentState.h @@ -53,8 +53,8 @@ public: [[nodiscard]] Optional origin() const { return m_origin; } void set_origin(Optional origin) { m_origin = move(origin); } - [[nodiscard]] Optional const& about_base_url() const { return m_about_base_url; } - void set_about_base_url(Optional url) { m_about_base_url = move(url); } + [[nodiscard]] Optional const& about_base_url() const { return m_about_base_url; } + void set_about_base_url(Optional url) { m_about_base_url = move(url); } [[nodiscard]] Vector const& nested_histories() const { return m_nested_histories; } [[nodiscard]] Vector& nested_histories() { return m_nested_histories; } @@ -95,7 +95,7 @@ private: Optional m_origin; // https://html.spec.whatwg.org/multipage/browsing-the-web.html#document-state-about-base-url - Optional m_about_base_url = {}; + Optional m_about_base_url = {}; // https://html.spec.whatwg.org/multipage/browsing-the-web.html#document-state-nested-histories Vector m_nested_histories; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.h b/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.h index 9186008ad3..8311204f49 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.h @@ -20,7 +20,7 @@ public: String href() const; WebIDL::ExceptionOr set_href(String const& href); - AK::URL const& frozen_base_url() const { return m_frozen_base_url; } + URL const& frozen_base_url() const { return m_frozen_base_url; } virtual void inserted() override; virtual void removed_from(Node*) override; @@ -34,7 +34,7 @@ private: // https://html.spec.whatwg.org/multipage/semantics.html#frozen-base-url // A base element that is the first base element with an href content attribute in a document tree has a frozen base URL. - AK::URL m_frozen_base_url; + URL m_frozen_base_url; void set_the_frozen_base_url(); }; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp index dd999d68bd..0d111573e8 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp @@ -275,7 +275,7 @@ String HTMLCanvasElement::to_data_url(StringView type, Optional quality) if (base64_encoded_or_error.is_error()) { return "data:,"_string; } - return MUST(AK::URL::create_with_data(file.value().mime_type, base64_encoded_or_error.release_value(), true).to_string()); + return MUST(URL::create_with_data(file.value().mime_type, base64_encoded_or_error.release_value(), true).to_string()); } // https://html.spec.whatwg.org/multipage/canvas.html#dom-canvas-toblob diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDocument.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDocument.cpp index 7a4c785363..df8b25dbd1 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDocument.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLDocument.cpp @@ -10,7 +10,7 @@ namespace Web::HTML { JS_DEFINE_ALLOCATOR(HTMLDocument); -HTMLDocument::HTMLDocument(JS::Realm& realm, AK::URL const& url) +HTMLDocument::HTMLDocument(JS::Realm& realm, URL const& url) : Document(realm, url) { } @@ -22,7 +22,7 @@ WebIDL::ExceptionOr> HTMLDocument::construct_impl return HTMLDocument::create(realm); } -JS::NonnullGCPtr HTMLDocument::create(JS::Realm& realm, AK::URL const& url) +JS::NonnullGCPtr HTMLDocument::create(JS::Realm& realm, URL const& url) { return realm.heap().allocate(realm, realm, url); } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDocument.h b/Userland/Libraries/LibWeb/HTML/HTMLDocument.h index 465f931ae2..29c2bc953c 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDocument.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLDocument.h @@ -21,11 +21,11 @@ class HTMLDocument final : public DOM::Document { public: virtual ~HTMLDocument() override; - [[nodiscard]] static JS::NonnullGCPtr create(JS::Realm&, AK::URL const& url = "about:blank"sv); + [[nodiscard]] static JS::NonnullGCPtr create(JS::Realm&, URL const& url = "about:blank"sv); WebIDL::ExceptionOr> construct_impl(JS::Realm&); private: - HTMLDocument(JS::Realm&, AK::URL const&); + HTMLDocument(JS::Realm&, URL const&); }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp index 0be3905cb9..e973b6194c 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp @@ -708,7 +708,7 @@ static ErrorOr plain_text_encode(Vector const& pairs } // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#submit-mutate-action -ErrorOr HTMLFormElement::mutate_action_url(AK::URL parsed_action, Vector entry_list, String encoding, JS::NonnullGCPtr target_navigable, Bindings::NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement) +ErrorOr HTMLFormElement::mutate_action_url(URL parsed_action, Vector entry_list, String encoding, JS::NonnullGCPtr target_navigable, Bindings::NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement) { // 1. Let pairs be the result of converting to a list of name-value pairs with entry list. auto pairs = TRY(convert_to_list_of_name_value_pairs(entry_list)); @@ -725,7 +725,7 @@ ErrorOr HTMLFormElement::mutate_action_url(AK::URL parsed_action, Vector HTMLFormElement::submit_as_entity_body(AK::URL parsed_action, Vector entry_list, EncodingTypeAttributeState encoding_type, [[maybe_unused]] String encoding, JS::NonnullGCPtr target_navigable, Bindings::NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement) +ErrorOr HTMLFormElement::submit_as_entity_body(URL parsed_action, Vector entry_list, EncodingTypeAttributeState encoding_type, [[maybe_unused]] String encoding, JS::NonnullGCPtr target_navigable, Bindings::NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement) { // 1. Assert: method is POST. @@ -784,7 +784,7 @@ ErrorOr HTMLFormElement::submit_as_entity_body(AK::URL parsed_action, Vect } // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#submit-get-action -void HTMLFormElement::get_action_url(AK::URL parsed_action, JS::NonnullGCPtr target_navigable, Bindings::NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement) +void HTMLFormElement::get_action_url(URL parsed_action, JS::NonnullGCPtr target_navigable, Bindings::NavigationHistoryBehavior history_handling, UserNavigationInvolvement user_involvement) { // 1. Plan to navigate to parsed action. // Spec Note: entry list is discarded. @@ -792,7 +792,7 @@ void HTMLFormElement::get_action_url(AK::URL parsed_action, JS::NonnullGCPtr