mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-20 16:28:54 +00:00
LibWebView: Return a ByteString from WebView::url_text_to_copy
The result is currently only used as a StringView, but a future commit will place the result in Web::Clipboard::SystemClipboardRepresentation, which requires a ByteString (there's no UTF-8 clipboard requirement).
This commit is contained in:
parent
524a161a51
commit
171937cc72
Notes:
github-actions[bot]
2025-09-11 18:25:41 +00:00
Author: https://github.com/trflynn89
Commit: 171937cc72
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6062
2 changed files with 5 additions and 7 deletions
|
@ -176,16 +176,14 @@ URLType url_type(URL::URL const& url)
|
||||||
return URLType::Other;
|
return URLType::Other;
|
||||||
}
|
}
|
||||||
|
|
||||||
String url_text_to_copy(URL::URL const& url)
|
ByteString url_text_to_copy(URL::URL const& url)
|
||||||
{
|
{
|
||||||
auto url_text = url.to_string();
|
auto url_text = url.to_byte_string();
|
||||||
|
|
||||||
if (url.scheme() == "mailto"sv)
|
if (url.scheme() == "mailto"sv)
|
||||||
return MUST(url_text.substring_from_byte_offset("mailto:"sv.length()));
|
return url_text.substring("mailto:"sv.length());
|
||||||
|
|
||||||
if (url.scheme() == "tel"sv)
|
if (url.scheme() == "tel"sv)
|
||||||
return MUST(url_text.substring_from_byte_offset("tel:"sv.length()));
|
return url_text.substring("tel:"sv.length());
|
||||||
|
|
||||||
return url_text;
|
return url_text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,6 @@ enum class URLType {
|
||||||
Other,
|
Other,
|
||||||
};
|
};
|
||||||
WEBVIEW_API URLType url_type(URL::URL const&);
|
WEBVIEW_API URLType url_type(URL::URL const&);
|
||||||
WEBVIEW_API String url_text_to_copy(URL::URL const&);
|
WEBVIEW_API ByteString url_text_to_copy(URL::URL const&);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue