mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb+LibUnicode+WebContent: Port DOM:CharacterData to UTF-16
This replaces the underlying storage of CharacterData with Utf16String and deals with the fallout.
This commit is contained in:
parent
cb85eac3d8
commit
8b6e3cb735
Notes:
github-actions[bot]
2025-07-24 17:01:33 +00:00
Author: https://github.com/trflynn89
Commit: 8b6e3cb735
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5592
Reviewed-by: https://github.com/gmta ✅
56 changed files with 233 additions and 245 deletions
|
|
@ -650,7 +650,7 @@ void ConnectionFromClient::get_dom_node_inner_html(u64 page_id, Web::UniqueNodeI
|
|||
html = element.inner_html().release_value_but_fixme_should_propagate_errors();
|
||||
} else if (dom_node->is_text() || dom_node->is_comment()) {
|
||||
auto const& character_data = static_cast<Web::DOM::CharacterData const&>(*dom_node);
|
||||
html = character_data.data();
|
||||
html = character_data.data().to_utf8_but_should_be_ported_to_utf16();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
|
@ -671,7 +671,7 @@ void ConnectionFromClient::get_dom_node_outer_html(u64 page_id, Web::UniqueNodeI
|
|||
html = element.outer_html().release_value_but_fixme_should_propagate_errors();
|
||||
} else if (dom_node->is_text() || dom_node->is_comment()) {
|
||||
auto const& character_data = static_cast<Web::DOM::CharacterData const&>(*dom_node);
|
||||
html = character_data.data();
|
||||
html = character_data.data().to_utf8_but_should_be_ported_to_utf16();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
|
@ -692,7 +692,7 @@ void ConnectionFromClient::set_dom_node_outer_html(u64 page_id, Web::UniqueNodeI
|
|||
element.set_outer_html(html).release_value_but_fixme_should_propagate_errors();
|
||||
} else if (dom_node->is_text() || dom_node->is_comment()) {
|
||||
auto& character_data = static_cast<Web::DOM::CharacterData&>(*dom_node);
|
||||
character_data.set_data(html);
|
||||
character_data.set_data(Utf16String::from_utf8(html));
|
||||
} else {
|
||||
async_did_finish_editing_dom_node(page_id, {});
|
||||
return;
|
||||
|
|
@ -710,7 +710,7 @@ void ConnectionFromClient::set_dom_node_text(u64 page_id, Web::UniqueNodeID node
|
|||
}
|
||||
|
||||
auto& character_data = static_cast<Web::DOM::CharacterData&>(*dom_node);
|
||||
character_data.set_data(text);
|
||||
character_data.set_data(Utf16String::from_utf8(text));
|
||||
|
||||
async_did_finish_editing_dom_node(page_id, character_data.unique_id());
|
||||
}
|
||||
|
|
@ -804,7 +804,7 @@ void ConnectionFromClient::create_child_text_node(u64 page_id, Web::UniqueNodeID
|
|||
return;
|
||||
}
|
||||
|
||||
auto text_node = dom_node->realm().create<Web::DOM::Text>(dom_node->document(), "text"_string);
|
||||
auto text_node = dom_node->realm().create<Web::DOM::Text>(dom_node->document(), "text"_utf16);
|
||||
dom_node->append_child(text_node).release_value_but_fixme_should_propagate_errors();
|
||||
|
||||
async_did_finish_editing_dom_node(page_id, text_node->unique_id());
|
||||
|
|
|
|||
|
|
@ -667,7 +667,7 @@ void PageClient::page_did_mutate_dom(FlyString const& type, Web::DOM::Node const
|
|||
mutation = WebView::AttributeMutation { *attribute_name, element.attribute(*attribute_name) };
|
||||
} else if (type == Web::DOM::MutationType::characterData) {
|
||||
auto const& character_data = as<Web::DOM::CharacterData>(target);
|
||||
mutation = WebView::CharacterDataMutation { character_data.data() };
|
||||
mutation = WebView::CharacterDataMutation { character_data.data().to_utf8_but_should_be_ported_to_utf16() };
|
||||
} else if (type == Web::DOM::MutationType::childList) {
|
||||
Vector<Web::UniqueNodeID> added;
|
||||
added.ensure_capacity(added_nodes.length());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue