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

LibWeb: Maintain list of allocated shadow roots in Document

Doing that will allow us to get a list of style sheets for each shadow
root from StyleComputer without having to traverse the entire tree in
upcoming changes.
This commit is contained in:
Aliaksandr Kalenik 2024-03-09 00:19:05 +01:00 committed by Andreas Kling
parent c6e69d501f
commit 91ec1d6f95
4 changed files with 36 additions and 0 deletions

View file

@ -604,6 +604,10 @@ public:
JS::NonnullGCPtr<WebIDL::ObservableArray> adopted_style_sheets() const;
WebIDL::ExceptionOr<void> set_adopted_style_sheets(JS::Value);
void register_shadow_root(Badge<DOM::ShadowRoot>, DOM::ShadowRoot&);
void unregister_shadow_root(Badge<DOM::ShadowRoot>, DOM::ShadowRoot&);
void for_each_shadow_root(Function<void(DOM::ShadowRoot&)>&& callback);
protected:
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
@ -840,6 +844,8 @@ private:
bool m_needs_to_resolve_paint_only_properties { true };
mutable JS::GCPtr<WebIDL::ObservableArray> m_adopted_style_sheets;
Vector<JS::NonnullGCPtr<DOM::ShadowRoot>> m_shadow_roots;
};
template<>