LibWeb: Make DOM Node unique IDs strongly typed (and 64 bit)

This is strictly nicer than passing them around as i32 everywhere,
and by switching to i64 as the underlying type, ID allocation becomes as
simple as incrementing an integer.
This commit is contained in:
Andreas Kling
2024-10-20 10:37:44 +02:00
committed by Andreas Kling
parent eca2318390
commit 4fdb266077
28 changed files with 227 additions and 189 deletions

View File

@@ -250,7 +250,7 @@ void ViewImplementation::inspect_dom_tree()
client().async_inspect_dom_tree(page_id());
}
void ViewImplementation::inspect_dom_node(i32 node_id, Optional<Web::CSS::Selector::PseudoElement::Type> pseudo_element)
void ViewImplementation::inspect_dom_node(Web::UniqueNodeID node_id, Optional<Web::CSS::Selector::PseudoElement::Type> pseudo_element)
{
client().async_inspect_dom_node(page_id(), node_id, move(pseudo_element));
}
@@ -270,47 +270,47 @@ void ViewImplementation::get_hovered_node_id()
client().async_get_hovered_node_id(page_id());
}
void ViewImplementation::set_dom_node_text(i32 node_id, String text)
void ViewImplementation::set_dom_node_text(Web::UniqueNodeID node_id, String text)
{
client().async_set_dom_node_text(page_id(), node_id, move(text));
}
void ViewImplementation::set_dom_node_tag(i32 node_id, String name)
void ViewImplementation::set_dom_node_tag(Web::UniqueNodeID node_id, String name)
{
client().async_set_dom_node_tag(page_id(), node_id, move(name));
}
void ViewImplementation::add_dom_node_attributes(i32 node_id, Vector<Attribute> attributes)
void ViewImplementation::add_dom_node_attributes(Web::UniqueNodeID node_id, Vector<Attribute> attributes)
{
client().async_add_dom_node_attributes(page_id(), node_id, move(attributes));
}
void ViewImplementation::replace_dom_node_attribute(i32 node_id, String name, Vector<Attribute> replacement_attributes)
void ViewImplementation::replace_dom_node_attribute(Web::UniqueNodeID node_id, String name, Vector<Attribute> replacement_attributes)
{
client().async_replace_dom_node_attribute(page_id(), node_id, move(name), move(replacement_attributes));
}
void ViewImplementation::create_child_element(i32 node_id)
void ViewImplementation::create_child_element(Web::UniqueNodeID node_id)
{
client().async_create_child_element(page_id(), node_id);
}
void ViewImplementation::create_child_text_node(i32 node_id)
void ViewImplementation::create_child_text_node(Web::UniqueNodeID node_id)
{
client().async_create_child_text_node(page_id(), node_id);
}
void ViewImplementation::clone_dom_node(i32 node_id)
void ViewImplementation::clone_dom_node(Web::UniqueNodeID node_id)
{
client().async_clone_dom_node(page_id(), node_id);
}
void ViewImplementation::remove_dom_node(i32 node_id)
void ViewImplementation::remove_dom_node(Web::UniqueNodeID node_id)
{
client().async_remove_dom_node(page_id(), node_id);
}
void ViewImplementation::get_dom_node_html(i32 node_id)
void ViewImplementation::get_dom_node_html(Web::UniqueNodeID node_id)
{
client().async_get_dom_node_html(page_id(), node_id);
}
@@ -563,7 +563,7 @@ NonnullRefPtr<Core::Promise<LexicalPath>> ViewImplementation::take_screenshot(Sc
return promise;
}
NonnullRefPtr<Core::Promise<LexicalPath>> ViewImplementation::take_dom_node_screenshot(i32 node_id)
NonnullRefPtr<Core::Promise<LexicalPath>> ViewImplementation::take_dom_node_screenshot(Web::UniqueNodeID node_id)
{
auto promise = Core::Promise<LexicalPath>::construct();