mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-02 22:30:31 +00:00
LibURL: Add representations of URLPattern{Init,Options,Input}
The URLPattern spec is intended to be implemented inside of LibURL, with LibWeb only responsible for the IDL conversion layer, in a similar manner to how URL is implemented.
This commit is contained in:
parent
05351dfe45
commit
46bfced9ad
Notes:
github-actions[bot]
2025-01-27 18:08:26 +00:00
Author: https://github.com/shannonbooth
Commit: 46bfced9ad
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3224
Reviewed-by: https://github.com/AtkinsSJ ✅
2 changed files with 49 additions and 0 deletions
27
Libraries/LibURL/Pattern/Init.h
Normal file
27
Libraries/LibURL/Pattern/Init.h
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2025, Shannon Booth <shannon@serenityos.org>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <AK/Optional.h>
|
||||||
|
#include <AK/String.h>
|
||||||
|
|
||||||
|
namespace URL::Pattern {
|
||||||
|
|
||||||
|
// https://urlpattern.spec.whatwg.org/#dictdef-urlpatterninit
|
||||||
|
struct Init {
|
||||||
|
Optional<String> protocol;
|
||||||
|
Optional<String> username;
|
||||||
|
Optional<String> password;
|
||||||
|
Optional<String> hostname;
|
||||||
|
Optional<String> port;
|
||||||
|
Optional<String> pathname;
|
||||||
|
Optional<String> search;
|
||||||
|
Optional<String> hash;
|
||||||
|
Optional<String> base_url;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
22
Libraries/LibURL/Pattern/Pattern.h
Normal file
22
Libraries/LibURL/Pattern/Pattern.h
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2025, Shannon Booth <shannon@serenityos.org>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <AK/Variant.h>
|
||||||
|
#include <LibURL/Pattern/Init.h>
|
||||||
|
|
||||||
|
namespace URL::Pattern {
|
||||||
|
|
||||||
|
// https://urlpattern.spec.whatwg.org/#typedefdef-urlpatterninput
|
||||||
|
using Input = Variant<String, Init>;
|
||||||
|
|
||||||
|
// https://urlpattern.spec.whatwg.org/#dictdef-urlpatternoptions
|
||||||
|
struct Options {
|
||||||
|
bool ignore_case { false };
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue