1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:57:45 +00:00

LibWeb: Make StyleSheet and CSSStyleSheet GC-allocated

This commit is contained in:
Andreas Kling 2022-08-07 13:14:54 +02:00
parent 0fe923e355
commit 5d60212076
21 changed files with 166 additions and 96 deletions

View file

@ -26,17 +26,17 @@ public:
return adopt_ref(*new StyleSheetList(document));
}
void add_sheet(NonnullRefPtr<CSSStyleSheet>);
void add_sheet(CSSStyleSheet&);
void remove_sheet(CSSStyleSheet&);
NonnullRefPtrVector<CSSStyleSheet> const& sheets() const { return m_sheets; }
NonnullRefPtrVector<CSSStyleSheet>& sheets() { return m_sheets; }
Vector<JS::Handle<CSSStyleSheet>> const& sheets() const { return m_sheets; }
Vector<JS::Handle<CSSStyleSheet>>& sheets() { return m_sheets; }
RefPtr<CSSStyleSheet> item(size_t index) const
CSSStyleSheet* item(size_t index) const
{
if (index >= m_sheets.size())
return {};
return m_sheets[index];
return const_cast<CSSStyleSheet*>(m_sheets[index].cell());
}
size_t length() const { return m_sheets.size(); }
@ -50,7 +50,7 @@ private:
explicit StyleSheetList(DOM::Document&);
DOM::Document& m_document;
NonnullRefPtrVector<CSSStyleSheet> m_sheets;
Vector<JS::Handle<CSSStyleSheet>> m_sheets;
};
}