|
@@ -432,7 +432,7 @@ void ConnectionFromClient::get_source(u64 page_id)
|
|
{
|
|
{
|
|
if (auto page = this->page(page_id); page.has_value()) {
|
|
if (auto page = this->page(page_id); page.has_value()) {
|
|
if (auto* doc = page->page().top_level_browsing_context().active_document())
|
|
if (auto* doc = page->page().top_level_browsing_context().active_document())
|
|
- async_did_get_source(page_id, doc->url(), doc->source().to_byte_string());
|
|
|
|
|
|
+ async_did_get_source(page_id, doc->url(), doc->base_url(), doc->source());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -444,7 +444,7 @@ void ConnectionFromClient::inspect_dom_tree(u64 page_id)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-void ConnectionFromClient::inspect_dom_node(u64 page_id, i32 node_id, Optional<Web::CSS::Selector::PseudoElement::Type> const& pseudo_element)
|
|
|
|
|
|
+void ConnectionFromClient::inspect_dom_node(u64 page_id, Web::UniqueNodeID const& node_id, Optional<Web::CSS::Selector::PseudoElement::Type> const& pseudo_element)
|
|
{
|
|
{
|
|
auto page = this->page(page_id);
|
|
auto page = this->page(page_id);
|
|
if (!page.has_value())
|
|
if (!page.has_value())
|
|
@@ -459,7 +459,7 @@ void ConnectionFromClient::inspect_dom_node(u64 page_id, i32 node_id, Optional<W
|
|
return Web::TraversalDecision::Continue;
|
|
return Web::TraversalDecision::Continue;
|
|
});
|
|
});
|
|
|
|
|
|
- Web::DOM::Node* node = Web::DOM::Node::from_unique_id(node_id);
|
|
|
|
|
|
+ auto* node = Web::DOM::Node::from_unique_id(node_id);
|
|
// Note: Nodes without layout (aka non-visible nodes, don't have style computed)
|
|
// Note: Nodes without layout (aka non-visible nodes, don't have style computed)
|
|
if (!node || !node->layout_node()) {
|
|
if (!node || !node->layout_node()) {
|
|
async_did_inspect_dom_node(page_id, false, {}, {}, {}, {}, {}, {});
|
|
async_did_inspect_dom_node(page_id, false, {}, {}, {}, {}, {}, {});
|
|
@@ -618,7 +618,7 @@ void ConnectionFromClient::get_hovered_node_id(u64 page_id)
|
|
if (!page.has_value())
|
|
if (!page.has_value())
|
|
return;
|
|
return;
|
|
|
|
|
|
- i32 node_id = 0;
|
|
|
|
|
|
+ Web::UniqueNodeID node_id = 0;
|
|
|
|
|
|
if (auto* document = page->page().top_level_browsing_context().active_document()) {
|
|
if (auto* document = page->page().top_level_browsing_context().active_document()) {
|
|
if (auto* hovered_node = document->hovered_node())
|
|
if (auto* hovered_node = document->hovered_node())
|
|
@@ -644,13 +644,12 @@ void ConnectionFromClient::request_style_sheet_source(u64 page_id, Web::CSS::Sty
|
|
return;
|
|
return;
|
|
|
|
|
|
if (auto* document = page->page().top_level_browsing_context().active_document()) {
|
|
if (auto* document = page->page().top_level_browsing_context().active_document()) {
|
|
- auto stylesheet = document->get_style_sheet_source(identifier);
|
|
|
|
- if (stylesheet.has_value())
|
|
|
|
- async_did_request_style_sheet_source(page_id, identifier, stylesheet.value());
|
|
|
|
|
|
+ if (auto stylesheet = document->get_style_sheet_source(identifier); stylesheet.has_value())
|
|
|
|
+ async_did_get_style_sheet_source(page_id, identifier, document->base_url(), stylesheet.value());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-void ConnectionFromClient::set_dom_node_text(u64 page_id, i32 node_id, String const& text)
|
|
|
|
|
|
+void ConnectionFromClient::set_dom_node_text(u64 page_id, Web::UniqueNodeID const& node_id, String const& text)
|
|
{
|
|
{
|
|
auto* dom_node = Web::DOM::Node::from_unique_id(node_id);
|
|
auto* dom_node = Web::DOM::Node::from_unique_id(node_id);
|
|
if (!dom_node || (!dom_node->is_text() && !dom_node->is_comment())) {
|
|
if (!dom_node || (!dom_node->is_text() && !dom_node->is_comment())) {
|
|
@@ -664,7 +663,7 @@ void ConnectionFromClient::set_dom_node_text(u64 page_id, i32 node_id, String co
|
|
async_did_finish_editing_dom_node(page_id, character_data.unique_id());
|
|
async_did_finish_editing_dom_node(page_id, character_data.unique_id());
|
|
}
|
|
}
|
|
|
|
|
|
-void ConnectionFromClient::set_dom_node_tag(u64 page_id, i32 node_id, String const& name)
|
|
|
|
|
|
+void ConnectionFromClient::set_dom_node_tag(u64 page_id, Web::UniqueNodeID const& node_id, String const& name)
|
|
{
|
|
{
|
|
auto* dom_node = Web::DOM::Node::from_unique_id(node_id);
|
|
auto* dom_node = Web::DOM::Node::from_unique_id(node_id);
|
|
if (!dom_node || !dom_node->is_element() || !dom_node->parent()) {
|
|
if (!dom_node || !dom_node->is_element() || !dom_node->parent()) {
|
|
@@ -688,7 +687,7 @@ void ConnectionFromClient::set_dom_node_tag(u64 page_id, i32 node_id, String con
|
|
async_did_finish_editing_dom_node(page_id, new_element->unique_id());
|
|
async_did_finish_editing_dom_node(page_id, new_element->unique_id());
|
|
}
|
|
}
|
|
|
|
|
|
-void ConnectionFromClient::add_dom_node_attributes(u64 page_id, i32 node_id, Vector<WebView::Attribute> const& attributes)
|
|
|
|
|
|
+void ConnectionFromClient::add_dom_node_attributes(u64 page_id, Web::UniqueNodeID const& node_id, Vector<WebView::Attribute> const& attributes)
|
|
{
|
|
{
|
|
auto* dom_node = Web::DOM::Node::from_unique_id(node_id);
|
|
auto* dom_node = Web::DOM::Node::from_unique_id(node_id);
|
|
if (!dom_node || !dom_node->is_element()) {
|
|
if (!dom_node || !dom_node->is_element()) {
|
|
@@ -706,7 +705,7 @@ void ConnectionFromClient::add_dom_node_attributes(u64 page_id, i32 node_id, Vec
|
|
async_did_finish_editing_dom_node(page_id, element.unique_id());
|
|
async_did_finish_editing_dom_node(page_id, element.unique_id());
|
|
}
|
|
}
|
|
|
|
|
|
-void ConnectionFromClient::replace_dom_node_attribute(u64 page_id, i32 node_id, String const& name, Vector<WebView::Attribute> const& replacement_attributes)
|
|
|
|
|
|
+void ConnectionFromClient::replace_dom_node_attribute(u64 page_id, Web::UniqueNodeID const& node_id, String const& name, Vector<WebView::Attribute> const& replacement_attributes)
|
|
{
|
|
{
|
|
auto* dom_node = Web::DOM::Node::from_unique_id(node_id);
|
|
auto* dom_node = Web::DOM::Node::from_unique_id(node_id);
|
|
if (!dom_node || !dom_node->is_element()) {
|
|
if (!dom_node || !dom_node->is_element()) {
|
|
@@ -731,7 +730,7 @@ void ConnectionFromClient::replace_dom_node_attribute(u64 page_id, i32 node_id,
|
|
async_did_finish_editing_dom_node(page_id, element.unique_id());
|
|
async_did_finish_editing_dom_node(page_id, element.unique_id());
|
|
}
|
|
}
|
|
|
|
|
|
-void ConnectionFromClient::create_child_element(u64 page_id, i32 node_id)
|
|
|
|
|
|
+void ConnectionFromClient::create_child_element(u64 page_id, Web::UniqueNodeID const& node_id)
|
|
{
|
|
{
|
|
auto* dom_node = Web::DOM::Node::from_unique_id(node_id);
|
|
auto* dom_node = Web::DOM::Node::from_unique_id(node_id);
|
|
if (!dom_node) {
|
|
if (!dom_node) {
|
|
@@ -745,7 +744,7 @@ void ConnectionFromClient::create_child_element(u64 page_id, i32 node_id)
|
|
async_did_finish_editing_dom_node(page_id, element->unique_id());
|
|
async_did_finish_editing_dom_node(page_id, element->unique_id());
|
|
}
|
|
}
|
|
|
|
|
|
-void ConnectionFromClient::create_child_text_node(u64 page_id, i32 node_id)
|
|
|
|
|
|
+void ConnectionFromClient::create_child_text_node(u64 page_id, Web::UniqueNodeID const& node_id)
|
|
{
|
|
{
|
|
auto* dom_node = Web::DOM::Node::from_unique_id(node_id);
|
|
auto* dom_node = Web::DOM::Node::from_unique_id(node_id);
|
|
if (!dom_node) {
|
|
if (!dom_node) {
|
|
@@ -759,7 +758,7 @@ void ConnectionFromClient::create_child_text_node(u64 page_id, i32 node_id)
|
|
async_did_finish_editing_dom_node(page_id, text_node->unique_id());
|
|
async_did_finish_editing_dom_node(page_id, text_node->unique_id());
|
|
}
|
|
}
|
|
|
|
|
|
-void ConnectionFromClient::clone_dom_node(u64 page_id, i32 node_id)
|
|
|
|
|
|
+void ConnectionFromClient::clone_dom_node(u64 page_id, Web::UniqueNodeID const& node_id)
|
|
{
|
|
{
|
|
auto* dom_node = Web::DOM::Node::from_unique_id(node_id);
|
|
auto* dom_node = Web::DOM::Node::from_unique_id(node_id);
|
|
if (!dom_node || !dom_node->parent_node()) {
|
|
if (!dom_node || !dom_node->parent_node()) {
|
|
@@ -773,7 +772,7 @@ void ConnectionFromClient::clone_dom_node(u64 page_id, i32 node_id)
|
|
async_did_finish_editing_dom_node(page_id, dom_node_clone->unique_id());
|
|
async_did_finish_editing_dom_node(page_id, dom_node_clone->unique_id());
|
|
}
|
|
}
|
|
|
|
|
|
-void ConnectionFromClient::remove_dom_node(u64 page_id, i32 node_id)
|
|
|
|
|
|
+void ConnectionFromClient::remove_dom_node(u64 page_id, Web::UniqueNodeID const& node_id)
|
|
{
|
|
{
|
|
auto page = this->page(page_id);
|
|
auto page = this->page(page_id);
|
|
if (!page.has_value())
|
|
if (!page.has_value())
|
|
@@ -800,7 +799,7 @@ void ConnectionFromClient::remove_dom_node(u64 page_id, i32 node_id)
|
|
async_did_finish_editing_dom_node(page_id, previous_dom_node->unique_id());
|
|
async_did_finish_editing_dom_node(page_id, previous_dom_node->unique_id());
|
|
}
|
|
}
|
|
|
|
|
|
-void ConnectionFromClient::get_dom_node_html(u64 page_id, i32 node_id)
|
|
|
|
|
|
+void ConnectionFromClient::get_dom_node_html(u64 page_id, Web::UniqueNodeID const& node_id)
|
|
{
|
|
{
|
|
auto* dom_node = Web::DOM::Node::from_unique_id(node_id);
|
|
auto* dom_node = Web::DOM::Node::from_unique_id(node_id);
|
|
if (!dom_node)
|
|
if (!dom_node)
|
|
@@ -830,7 +829,7 @@ void ConnectionFromClient::take_document_screenshot(u64 page_id)
|
|
page->queue_screenshot_task({});
|
|
page->queue_screenshot_task({});
|
|
}
|
|
}
|
|
|
|
|
|
-void ConnectionFromClient::take_dom_node_screenshot(u64 page_id, i32 node_id)
|
|
|
|
|
|
+void ConnectionFromClient::take_dom_node_screenshot(u64 page_id, Web::UniqueNodeID const& node_id)
|
|
{
|
|
{
|
|
auto page = this->page(page_id);
|
|
auto page = this->page(page_id);
|
|
if (!page.has_value())
|
|
if (!page.has_value())
|