mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-15 21:41:58 +00:00
AK+LibJS: Do not set UTF-16 code point length to its code unit length
This commit is contained in:
parent
594194eb60
commit
efa9737cf7
Notes:
github-actions[bot]
2025-06-25 20:22:15 +00:00
Author: https://github.com/trflynn89
Commit: efa9737cf7
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5214
Reviewed-by: https://github.com/gmta ✅
3 changed files with 25 additions and 1 deletions
|
@ -45,8 +45,11 @@ NonnullRefPtr<Utf16StringImpl> Utf16StringImpl::create(Utf16View const& view)
|
|||
Utf16Data string;
|
||||
string.ensure_capacity(view.length_in_code_units());
|
||||
string.unchecked_append(view.data(), view.length_in_code_units());
|
||||
|
||||
auto impl = create(move(string));
|
||||
impl->m_cached_view.unsafe_set_code_point_length(view.length_in_code_units());
|
||||
if (auto length_in_code_points = view.length_in_code_points_if_known(); length_in_code_points.has_value())
|
||||
impl->m_cached_view.unsafe_set_code_point_length(*length_in_code_points);
|
||||
|
||||
return impl;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue