mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:47:34 +00:00
LibWeb: Use a JS::NonnullGCPtr for DOMTokenList::m_associated_element
Both Element and DOMTokenList are GC-allocated objects so they can just mark each other instead of using the old strong/weak pattern we use in ref-counting ownership models.
This commit is contained in:
parent
59d9d1d07a
commit
7d863174b3
2 changed files with 9 additions and 1 deletions
|
@ -68,6 +68,12 @@ DOMTokenList::DOMTokenList(Element const& associated_element, FlyString associat
|
||||||
associated_attribute_changed(value);
|
associated_attribute_changed(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DOMTokenList::visit_edges(Cell::Visitor& visitor)
|
||||||
|
{
|
||||||
|
Base::visit_edges(visitor);
|
||||||
|
visitor.visit(m_associated_element);
|
||||||
|
}
|
||||||
|
|
||||||
// https://dom.spec.whatwg.org/#ref-for-domtokenlist%E2%91%A0%E2%91%A1
|
// https://dom.spec.whatwg.org/#ref-for-domtokenlist%E2%91%A0%E2%91%A1
|
||||||
void DOMTokenList::associated_attribute_changed(StringView value)
|
void DOMTokenList::associated_attribute_changed(StringView value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,10 +45,12 @@ public:
|
||||||
private:
|
private:
|
||||||
DOMTokenList(Element const& associated_element, FlyString associated_attribute);
|
DOMTokenList(Element const& associated_element, FlyString associated_attribute);
|
||||||
|
|
||||||
|
virtual void visit_edges(Cell::Visitor&) override;
|
||||||
|
|
||||||
WebIDL::ExceptionOr<void> validate_token(StringView token) const;
|
WebIDL::ExceptionOr<void> validate_token(StringView token) const;
|
||||||
void run_update_steps();
|
void run_update_steps();
|
||||||
|
|
||||||
WeakPtr<Element> m_associated_element;
|
JS::NonnullGCPtr<Element> m_associated_element;
|
||||||
FlyString m_associated_attribute;
|
FlyString m_associated_attribute;
|
||||||
Vector<DeprecatedString> m_token_set;
|
Vector<DeprecatedString> m_token_set;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue