mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:07:34 +00:00
LibWeb: Make StyleSheet mark its owner node
The garbage collector will take care of cycles.
This commit is contained in:
parent
36085676d2
commit
5724a04553
2 changed files with 4 additions and 7 deletions
|
@ -21,15 +21,13 @@ StyleSheet::StyleSheet(HTML::Window& window_object)
|
||||||
void StyleSheet::visit_edges(Cell::Visitor& visitor)
|
void StyleSheet::visit_edges(Cell::Visitor& visitor)
|
||||||
{
|
{
|
||||||
Base::visit_edges(visitor);
|
Base::visit_edges(visitor);
|
||||||
|
visitor.visit(m_owner_node);
|
||||||
visitor.visit(m_parent_style_sheet);
|
visitor.visit(m_parent_style_sheet);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StyleSheet::set_owner_node(DOM::Element* element)
|
void StyleSheet::set_owner_node(DOM::Element* element)
|
||||||
{
|
{
|
||||||
if (element)
|
m_owner_node = element;
|
||||||
m_owner_node = element->make_weak_ptr<DOM::Element>();
|
|
||||||
else
|
|
||||||
m_owner_node = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void StyleSheet::set_parent_css_style_sheet(CSSStyleSheet* parent)
|
void StyleSheet::set_parent_css_style_sheet(CSSStyleSheet* parent)
|
||||||
|
|
|
@ -50,9 +50,8 @@ protected:
|
||||||
virtual void visit_edges(Cell::Visitor&) override;
|
virtual void visit_edges(Cell::Visitor&) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WeakPtr<DOM::Element> m_owner_node;
|
JS::GCPtr<DOM::Element> m_owner_node;
|
||||||
|
JS::GCPtr<CSSStyleSheet> m_parent_style_sheet;
|
||||||
CSSStyleSheet* m_parent_style_sheet { nullptr };
|
|
||||||
|
|
||||||
String m_location;
|
String m_location;
|
||||||
String m_title;
|
String m_title;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue