/* * Copyright (c) 2018-2020, Andreas Kling * Copyright (c) 2021, Max Wipfli * * SPDX-License-Identifier: BSD-2-Clause */ #include #include #include namespace Web::DOM { GC_DEFINE_ALLOCATOR(Position); Position::Position(GC::Ptr node, unsigned offset) : m_node(node) , m_offset(offset) { } void Position::visit_edges(Visitor& visitor) { Base::visit_edges(visitor); visitor.visit(m_node); } ErrorOr Position::to_string() const { if (!node()) return String::formatted("DOM::Position(nullptr, {})", offset()); return String::formatted("DOM::Position({} ({})), {})", node()->node_name(), node().ptr(), offset()); } }