mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 23:28:11 +00:00
LibWeb: Add DOM::Node::parent_or_shadow_host_element()
This will be used in style computation to inherit style across shadow tree boundaries.
This commit is contained in:
parent
9c46fb7337
commit
87b0ddb354
2 changed files with 16 additions and 0 deletions
|
@ -872,6 +872,19 @@ ParentNode* Node::parent_or_shadow_host()
|
|||
return verify_cast<ParentNode>(parent());
|
||||
}
|
||||
|
||||
Element* Node::parent_or_shadow_host_element()
|
||||
{
|
||||
if (is<ShadowRoot>(*this))
|
||||
return static_cast<ShadowRoot&>(*this).host();
|
||||
if (!parent())
|
||||
return nullptr;
|
||||
if (is<Element>(*parent()))
|
||||
return static_cast<Element*>(parent());
|
||||
if (is<ShadowRoot>(*parent()))
|
||||
return static_cast<ShadowRoot&>(*parent()).host();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
JS::NonnullGCPtr<NodeList> Node::child_nodes()
|
||||
{
|
||||
if (!m_child_nodes) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue