mirror of
https://github.com/RGBCube/serenity
synced 2025-05-15 02:04:59 +00:00
LibWeb: Rename URL platform object to DOMURL
Along with putting functions in the URL namespace into a DOMURL namespace. This is done as LibWeb is in an awkward situation where it needs two URL classes. AK::URL is the general purpose URL class which is all that is needed in 95% of cases. URL in the Web namespace is needed predominantly for interfacing with the javascript interfaces. Because of two URLs in the same namespace, AK::URL has had to be used throughout LibWeb. If we move AK::URL into a URL namespace, this becomes more painful - where ::URL::URL is required to specify the constructor (and something like ::URL::create_with_url_or_path in other places). To fix this problem - rename the class in LibWeb implementing the URL IDL interface to DOMURL, along with moving the other Web URL related classes into this DOMURL folder. One could argue that this name also makes the situation a little more clear in LibWeb for why these two URL classes need be used in the first place.
This commit is contained in:
parent
1b6346ee1c
commit
f9e5b43b7a
30 changed files with 125 additions and 125 deletions
|
@ -13,6 +13,7 @@
|
|||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/Event.h>
|
||||
#include <LibWeb/DOM/HTMLFormControlsCollection.h>
|
||||
#include <LibWeb/DOMURL/DOMURL.h>
|
||||
#include <LibWeb/HTML/BrowsingContext.h>
|
||||
#include <LibWeb/HTML/EventNames.h>
|
||||
#include <LibWeb/HTML/FormControlInfrastructure.h>
|
||||
|
@ -30,7 +31,6 @@
|
|||
#include <LibWeb/Infra/CharacterTypes.h>
|
||||
#include <LibWeb/Infra/Strings.h>
|
||||
#include <LibWeb/Page/Page.h>
|
||||
#include <LibWeb/URL/URL.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
|
@ -649,10 +649,10 @@ ErrorOr<String> HTMLFormElement::pick_an_encoding() const
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#convert-to-a-list-of-name-value-pairs
|
||||
static ErrorOr<Vector<URL::QueryParam>> convert_to_list_of_name_value_pairs(Vector<XHR::FormDataEntry> const& entry_list)
|
||||
static ErrorOr<Vector<DOMURL::QueryParam>> convert_to_list_of_name_value_pairs(Vector<XHR::FormDataEntry> const& entry_list)
|
||||
{
|
||||
// 1. Let list be an empty list of name-value pairs.
|
||||
Vector<URL::QueryParam> list;
|
||||
Vector<DOMURL::QueryParam> list;
|
||||
|
||||
// 2. For each entry of entry list:
|
||||
for (auto const& entry : entry_list) {
|
||||
|
@ -675,7 +675,7 @@ static ErrorOr<Vector<URL::QueryParam>> convert_to_list_of_name_value_pairs(Vect
|
|||
auto normalized_value = TRY(normalize_line_breaks(value));
|
||||
|
||||
// 4. Append to list a new name-value pair whose name is name and whose value is value.
|
||||
TRY(list.try_append(URL::QueryParam { .name = move(name), .value = move(normalized_value) }));
|
||||
TRY(list.try_append(DOMURL::QueryParam { .name = move(name), .value = move(normalized_value) }));
|
||||
}
|
||||
|
||||
// 3. Return list.
|
||||
|
@ -683,7 +683,7 @@ static ErrorOr<Vector<URL::QueryParam>> convert_to_list_of_name_value_pairs(Vect
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#text/plain-encoding-algorithm
|
||||
static ErrorOr<String> plain_text_encode(Vector<URL::QueryParam> const& pairs)
|
||||
static ErrorOr<String> plain_text_encode(Vector<DOMURL::QueryParam> const& pairs)
|
||||
{
|
||||
// 1. Let result be the empty string.
|
||||
StringBuilder result;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue