1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 21:17:44 +00:00

LibWeb: Rename DOM::Node::id() to unique_id()

The old name was pretty confusing, since it had nothing to do with the
common "id" content attribute.

This makes way for using id() to return the "id" attribute instead. :^)
This commit is contained in:
Andreas Kling 2023-11-02 14:30:00 +01:00
parent 1030776f92
commit 6b580d68a3
8 changed files with 27 additions and 27 deletions

View file

@ -517,7 +517,7 @@ Messages::WebContentServer::InspectDomNodeResponse ConnectionFromClient::inspect
return IterationDecision::Continue;
});
Web::DOM::Node* node = Web::DOM::Node::from_id(node_id);
Web::DOM::Node* node = Web::DOM::Node::from_unique_id(node_id);
// Note: Nodes without layout (aka non-visible nodes, don't have style computed)
if (!node || !node->layout_node()) {
return { false, "", "", "", "", "" };
@ -642,7 +642,7 @@ Messages::WebContentServer::GetHoveredNodeIdResponse ConnectionFromClient::get_h
if (auto* document = page().top_level_browsing_context().active_document()) {
auto hovered_node = document->hovered_node();
if (hovered_node)
return hovered_node->id();
return hovered_node->unique_id();
}
return (i32)0;
}

View file

@ -123,7 +123,7 @@ static DeprecatedString get_or_create_a_web_element_reference(Web::DOM::Node con
// FIXME: 2. Add element to the list of known elements of the current browsing context.
// FIXME: 3. Return success with the elements web element reference.
return DeprecatedString::number(element.id());
return DeprecatedString::number(element.unique_id());
}
// https://w3c.github.io/webdriver/#dfn-web-element-reference-object
@ -154,7 +154,7 @@ static ErrorOr<Web::DOM::Element*, Web::WebDriver::Error> get_known_connected_el
if (!element.has_value())
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, "Element ID is not an integer");
auto* node = Web::DOM::Node::from_id(*element);
auto* node = Web::DOM::Node::from_unique_id(*element);
if (!node || !node->is_element())
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchElement, DeprecatedString::formatted("Could not find element with ID: {}", element_id));
@ -170,7 +170,7 @@ static DeprecatedString get_or_create_a_shadow_root_reference(Web::DOM::ShadowRo
// FIXME: 2. Add shadow to the list of known shadow roots of the current browsing context.
// FIXME: 3. Return success with the shadows shadow root reference.
return DeprecatedString::number(shadow_root.id());
return DeprecatedString::number(shadow_root.unique_id());
}
// https://w3c.github.io/webdriver/#dfn-shadow-root-reference-object
@ -201,7 +201,7 @@ static ErrorOr<Web::DOM::ShadowRoot*, Web::WebDriver::Error> get_known_shadow_ro
if (!shadow_root.has_value())
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, "Shadow ID is not an integer");
auto* node = Web::DOM::Node::from_id(*shadow_root);
auto* node = Web::DOM::Node::from_unique_id(*shadow_root);
if (!node || !node->is_shadow_root())
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchElement, DeprecatedString::formatted("Could not find shadow root with ID: {}", shadow_id));
@ -982,7 +982,7 @@ Messages::WebDriverClient::GetActiveElementResponse WebDriverConnection::get_act
// 4. If active element is a non-null element, return success with data set to web element reference object for active element.
// Otherwise, return error with error code no such element.
if (active_element)
return DeprecatedString::number(active_element->id());
return DeprecatedString::number(active_element->unique_id());
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchElement, "The current document does not have an active element"sv);
}