1
Fork 0
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:
Timothy Flynn 2023-10-17 11:42:55 -04:00 committed by Andreas Kling
parent 023309fdc4
commit 0715ba889e
2 changed files with 54 additions and 1 deletions

View file

@ -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);
}