ladybird/Userland/Libraries/LibWeb/DOM/AbstractRange.cpp
Andreas Kling ffad902c07 LibWeb: Use cached_web_prototype() as much as possible
Unlike ensure_web_prototype<T>(), the cached version doesn't require the
prototype type to be fully formed, so we can use it without including
the FooPrototype.h header. It's also a bit less verbose. :^)
2022-09-06 00:27:09 +02:00

31 lines
825 B
C++

/*
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/DOM/AbstractRange.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/HTML/Window.h>
namespace Web::DOM {
AbstractRange::AbstractRange(Node& start_container, u32 start_offset, Node& end_container, u32 end_offset)
: Bindings::PlatformObject(start_container.document().window().cached_web_prototype("AbstractRange"))
, m_start_container(start_container)
, m_start_offset(start_offset)
, m_end_container(end_container)
, m_end_offset(end_offset)
{
}
AbstractRange::~AbstractRange() = default;
void AbstractRange::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);
visitor.visit(m_start_container.ptr());
visitor.visit(m_end_container.ptr());
}
}