mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb: Amend Element interface to make it compatible with TrustedTypes
This commit is contained in:
parent
1368744d33
commit
db41ea8117
Notes:
github-actions[bot]
2025-10-27 16:16:02 +00:00
Author: https://github.com/tete17
Commit: db41ea8117
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6057
Reviewed-by: https://github.com/AtkinsSJ
Reviewed-by: https://github.com/Lubrsi ✅
12 changed files with 93 additions and 61 deletions
|
|
@ -661,19 +661,19 @@ void ConnectionFromClient::get_dom_node_inner_html(u64 page_id, Web::UniqueNodeI
|
|||
if (!dom_node)
|
||||
return;
|
||||
|
||||
String html;
|
||||
Utf16String html;
|
||||
|
||||
if (dom_node->is_element()) {
|
||||
auto const& element = static_cast<Web::DOM::Element const&>(*dom_node);
|
||||
html = element.inner_html().release_value_but_fixme_should_propagate_errors();
|
||||
html = element.inner_html().release_value_but_fixme_should_propagate_errors().get<Utf16String>();
|
||||
} 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().to_utf8_but_should_be_ported_to_utf16();
|
||||
html = character_data.data();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
async_did_get_dom_node_html(page_id, html);
|
||||
async_did_get_dom_node_html(page_id, html.to_utf8_but_should_be_ported_to_utf16());
|
||||
}
|
||||
|
||||
void ConnectionFromClient::get_dom_node_outer_html(u64 page_id, Web::UniqueNodeID node_id)
|
||||
|
|
@ -682,19 +682,19 @@ void ConnectionFromClient::get_dom_node_outer_html(u64 page_id, Web::UniqueNodeI
|
|||
if (!dom_node)
|
||||
return;
|
||||
|
||||
String html;
|
||||
Utf16String html;
|
||||
|
||||
if (dom_node->is_element()) {
|
||||
auto const& element = static_cast<Web::DOM::Element const&>(*dom_node);
|
||||
html = element.outer_html().release_value_but_fixme_should_propagate_errors();
|
||||
html = element.outer_html().release_value_but_fixme_should_propagate_errors().get<Utf16String>();
|
||||
} 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().to_utf8_but_should_be_ported_to_utf16();
|
||||
html = character_data.data();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
async_did_get_dom_node_html(page_id, html);
|
||||
async_did_get_dom_node_html(page_id, html.to_utf8_but_should_be_ported_to_utf16());
|
||||
}
|
||||
|
||||
void ConnectionFromClient::set_dom_node_outer_html(u64 page_id, Web::UniqueNodeID node_id, String html)
|
||||
|
|
@ -707,7 +707,7 @@ void ConnectionFromClient::set_dom_node_outer_html(u64 page_id, Web::UniqueNodeI
|
|||
|
||||
if (dom_node->is_element()) {
|
||||
auto& element = static_cast<Web::DOM::Element&>(*dom_node);
|
||||
element.set_outer_html(html).release_value_but_fixme_should_propagate_errors();
|
||||
element.set_outer_html(Utf16String::from_utf8(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(Utf16String::from_utf8(html));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue