mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 03:37:34 +00:00
LibWeb: Add style sheets to the shadow root if applicable
If a style element belongs to a shadow tree, its CSSStyleSheet is now added to the corresponding ShadowRoot instead of the document. Co-authored-by: Simon Wanner <simon+git@skyrising.xyz>
This commit is contained in:
parent
8ce8697a66
commit
c6e69d501f
7 changed files with 45 additions and 13 deletions
|
@ -2380,4 +2380,13 @@ auto Element::ensure_custom_element_reaction_queue() -> CustomElementReactionQue
|
|||
return *m_custom_element_reaction_queue;
|
||||
}
|
||||
|
||||
CSS::StyleSheetList& Element::document_or_shadow_root_style_sheets()
|
||||
{
|
||||
auto& root_node = root();
|
||||
if (is<DOM::ShadowRoot>(root_node))
|
||||
return static_cast<DOM::ShadowRoot&>(root_node).style_sheets();
|
||||
|
||||
return document().style_sheets();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue