mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-28 21:54:40 +03:00
AK: Add URL::raw_fragment()
This is a little hackish. Part of the algorithm to get the indicated part of a DOM::Document https://html.spec.whatwg.org/multipage/browsing-the-web.html#the-indicated-part-of-the-document wants to first get the URL's fragment, use it, and then later percent-decode it and use that. So, we need a way to get that un-decoded fragment.
This commit is contained in:
parent
c0cf6e3744
commit
28aa4ca767
Notes:
sideshowbarker
2024-07-17 01:12:07 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/28aa4ca767 Pull-request: https://github.com/SerenityOS/serenity/pull/20501 Reviewed-by: https://github.com/shannonbooth
@ -72,6 +72,11 @@ DeprecatedString URL::fragment() const
|
||||
return percent_decode(m_fragment);
|
||||
}
|
||||
|
||||
DeprecatedString URL::raw_fragment() const
|
||||
{
|
||||
return m_fragment;
|
||||
}
|
||||
|
||||
// NOTE: This only exists for compatibility with the existing URL tests which check for both .is_null() and .is_empty().
|
||||
static DeprecatedString deprecated_string_percent_encode(DeprecatedString const& input, URL::PercentEncodeSet set = URL::PercentEncodeSet::Userinfo, URL::SpaceAsPlus space_as_plus = URL::SpaceAsPlus::No)
|
||||
{
|
||||
|
2
AK/URL.h
2
AK/URL.h
@ -83,7 +83,9 @@ public:
|
||||
ErrorOr<String> serialized_host() const;
|
||||
DeprecatedString basename() const;
|
||||
DeprecatedString query() const;
|
||||
// NOTE: fragment() is percent-decoded, raw_fragment() is not.
|
||||
DeprecatedString fragment() const;
|
||||
DeprecatedString raw_fragment() const;
|
||||
Optional<u16> port() const { return m_port; }
|
||||
DeprecatedString path_segment_at_index(size_t index) const;
|
||||
size_t path_segment_count() const { return m_paths.size(); }
|
||||
|
Loading…
Reference in New Issue
Block a user