mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
AK+LibURL: Move AK::URL into a new URL library
This URL library ends up being a relatively fundamental base library of the system, as LibCore depends on LibURL. This change has two main benefits: * Moving AK back more towards being an agnostic library that can be used between the kernel and userspace. URL has never really fit that description - and is not used in the kernel. * URL _should_ depend on LibUnicode, as it needs punnycode support. However, it's not really possible to do this inside of AK as it can't depend on any external library. This change brings us a little closer to being able to do that, but unfortunately we aren't there quite yet, as the code generators depend on LibCore.
This commit is contained in:
parent
21bfa001b1
commit
e800605ad3
Notes:
sideshowbarker
2024-07-17 04:41:05 +09:00
Author: https://github.com/shannonbooth
Commit: e800605ad3
Pull-request: https://github.com/SerenityOS/serenity/pull/23443
Issue: https://github.com/SerenityOS/serenity/issues/22884
Reviewed-by: https://github.com/trflynn89
403 changed files with 1336 additions and 1305 deletions
|
@ -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<typename T>
|
||||
Parser::ParsedStyleSheet Parser::parse_a_stylesheet(TokenStream<T>& tokens, Optional<URL> location)
|
||||
Parser::ParsedStyleSheet Parser::parse_a_stylesheet(TokenStream<T>& tokens, Optional<URL::URL> location)
|
||||
{
|
||||
// To parse a stylesheet from an input given an optional url location:
|
||||
|
||||
|
@ -144,7 +144,7 @@ Parser::ParsedStyleSheet Parser::parse_a_stylesheet(TokenStream<T>& tokens, Opti
|
|||
}
|
||||
|
||||
// https://www.w3.org/TR/css-syntax-3/#parse-a-css-stylesheet
|
||||
CSSStyleSheet* Parser::parse_as_css_stylesheet(Optional<URL> location)
|
||||
CSSStyleSheet* Parser::parse_as_css_stylesheet(Optional<URL::URL> 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<URL> Parser::parse_url_function(ComponentValue const& component_value)
|
||||
Optional<URL::URL> 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<URL> {
|
||||
auto convert_string_to_url = [&](StringView url_string) -> Optional<URL::URL> {
|
||||
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> rule)
|
|||
return parse_font_face_rule(tokens);
|
||||
}
|
||||
if (rule->at_rule_name().equals_ignoring_ascii_case("import"sv) && !rule->prelude().is_empty()) {
|
||||
Optional<URL> url;
|
||||
Optional<URL::URL> url;
|
||||
for (auto const& token : rule->prelude()) {
|
||||
if (token.is(Token::Type::Whitespace))
|
||||
continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue