1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:37:35 +00:00

LibWeb: Allow SVG painting to escape out of a shadow tree

The spec for the `<use>` element requires a shadow tree for the
rendered content, so we need to be able to escape shadow trees when
rendering svg content.
This commit is contained in:
PrestonLTaylor 2023-05-28 18:27:35 +01:00 committed by Andreas Kling
parent fd360ba171
commit 31d536912c
5 changed files with 24 additions and 5 deletions

View file

@ -55,6 +55,16 @@ private:
template<>
inline bool Node::fast_is<ParentNode>() const { return is_parent_node(); }
template<typename U>
inline U* Node::shadow_including_first_ancestor_of_type()
{
for (auto* ancestor = parent_or_shadow_host(); ancestor; ancestor = ancestor->parent_or_shadow_host()) {
if (is<U>(*ancestor))
return &verify_cast<U>(*ancestor);
}
return nullptr;
}
template<typename Callback>
inline void ParentNode::for_each_child(Callback callback) const
{