mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:47:34 +00:00
LibWebView: Add method to break a URL into parts for eTLD+1 highlighting
This is meant to serve as the method all Ladybird chromes can use to highlight the eTLD+1 substring of the URL. It uses the Public Suffix List to break the URL into 3 parts: the scheme and subdomain, the eTLD+1, and all remaining parts (port, path, query, etc.).
This commit is contained in:
parent
023309fdc4
commit
0715ba889e
2 changed files with 54 additions and 1 deletions
|
@ -16,7 +16,13 @@ enum class AppendTLD {
|
|||
No,
|
||||
Yes,
|
||||
};
|
||||
|
||||
Optional<URL> sanitize_url(StringView, Optional<StringView> search_engine = {}, AppendTLD = AppendTLD::No);
|
||||
|
||||
struct URLParts {
|
||||
StringView scheme_and_subdomain;
|
||||
StringView effective_tld_plus_one;
|
||||
StringView remainder;
|
||||
};
|
||||
Optional<URLParts> break_url_into_parts(StringView url);
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue