1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:37: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

@ -1610,7 +1610,7 @@ void Document::evaluate_media_rules()
{
bool any_media_queries_changed_match_state = false;
for (auto& style_sheet : style_sheets().sheets()) {
if (style_sheet.evaluate_media_queries(window()))
if (style_sheet->evaluate_media_queries(window()))
any_media_queries_changed_match_state = true;
}
@ -1837,4 +1837,11 @@ void Document::set_window(Badge<HTML::BrowsingContext>, HTML::Window& window)
m_window = window;
}
Bindings::WindowObject& Document::preferred_window_object() const
{
if (m_window && m_window->wrapper())
return const_cast<Bindings::WindowObject&>(*m_window->wrapper());
return Bindings::main_thread_internal_window_object();
}
}

View file

@ -58,6 +58,11 @@ public:
static NonnullRefPtr<Document> create_with_global_object(Bindings::WindowObject&);
virtual ~Document() override;
// NOTE: This returns the web-facing window object if there is one,
// otherwise it returns the internal window object.
// FIXME: Remove this when Document is a JS::Object.
Bindings::WindowObject& preferred_window_object() const;
size_t next_layout_node_serial_id(Badge<Layout::Node>) { return m_next_layout_node_serial_id++; }
size_t layout_node_count() const { return m_next_layout_node_serial_id; }