LibWeb: Fix a LibJSGCVerifier warning in DOM::Text

This commit is contained in:
Matthew Olsson 2024-04-05 15:32:21 -07:00 committed by Andreas Kling
commit 7001e0a428
Notes: sideshowbarker 2024-07-17 16:23:55 +09:00
3 changed files with 14 additions and 6 deletions

View file

@ -35,8 +35,7 @@ void Text::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);
SlottableMixin::visit_edges(visitor);
visitor.visit(dynamic_cast<JS::Cell*>(m_owner.ptr()));
visitor.visit(m_owner);
}
// https://dom.spec.whatwg.org/#dom-text-text
@ -47,6 +46,15 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Text>> Text::construct_impl(JS::Realm& real
return realm.heap().allocate<Text>(realm, window.associated_document(), data);
}
EditableTextNodeOwner* Text::editable_text_node_owner()
{
if (!m_owner)
return nullptr;
EditableTextNodeOwner* owner = dynamic_cast<EditableTextNodeOwner*>(m_owner.ptr());
VERIFY(owner);
return owner;
}
// https://dom.spec.whatwg.org/#dom-text-splittext
// https://dom.spec.whatwg.org/#concept-text-split
WebIDL::ExceptionOr<JS::NonnullGCPtr<Text>> Text::split_text(size_t offset)