1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:07:35 +00:00

LibWeb: Change DOM::Position to be GC-allocated

This commit is contained in:
Aliaksandr Kalenik 2023-09-26 19:34:21 +02:00 committed by Andreas Kling
parent 35623ad52e
commit 46254101f7
10 changed files with 72 additions and 62 deletions

View file

@ -13,8 +13,8 @@
namespace Web::DOM {
Position::Position(Node& node, unsigned offset)
: m_node(JS::make_handle(node))
Position::Position(JS::GCPtr<Node> node, unsigned offset)
: m_node(node)
, m_offset(offset)
{
}
@ -23,7 +23,7 @@ ErrorOr<String> Position::to_string() const
{
if (!node())
return String::formatted("DOM::Position(nullptr, {})", offset());
return String::formatted("DOM::Position({} ({})), {})", node()->node_name(), node(), offset());
return String::formatted("DOM::Position({} ({})), {})", node()->node_name(), node().ptr(), offset());
}
bool Position::increment_offset()