mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 17:49:40 +00:00
LibWeb: Include own shadow root in for_each_shadow_including_descendant
Fixes a crash in wpt.live/css/cssom/CSSStyleSheet-constructable.html
This commit is contained in:
parent
409758f040
commit
d980321a77
Notes:
github-actions[bot]
2025-07-11 14:22:20 +00:00
Author: https://github.com/Calme1709
Commit: d980321a77
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5402
3 changed files with 848 additions and 10 deletions
|
@ -126,6 +126,15 @@ inline TraversalDecision Node::for_each_shadow_including_inclusive_descendant(Ca
|
|||
if (callback(*this) == TraversalDecision::Break)
|
||||
return TraversalDecision::Break;
|
||||
|
||||
if (this->for_each_shadow_including_descendant(callback) == TraversalDecision::Break)
|
||||
return TraversalDecision::Break;
|
||||
|
||||
return TraversalDecision::Continue;
|
||||
}
|
||||
|
||||
template<typename Callback>
|
||||
inline TraversalDecision Node::for_each_shadow_including_descendant(Callback callback)
|
||||
{
|
||||
if (is_element()) {
|
||||
if (auto shadow_root = static_cast<Element*>(this)->shadow_root()) {
|
||||
if (shadow_root->for_each_shadow_including_inclusive_descendant(callback) == TraversalDecision::Break)
|
||||
|
@ -141,14 +150,4 @@ inline TraversalDecision Node::for_each_shadow_including_inclusive_descendant(Ca
|
|||
return TraversalDecision::Continue;
|
||||
}
|
||||
|
||||
template<typename Callback>
|
||||
inline TraversalDecision Node::for_each_shadow_including_descendant(Callback callback)
|
||||
{
|
||||
for (auto* child = first_child(); child; child = child->next_sibling()) {
|
||||
if (child->for_each_shadow_including_inclusive_descendant(callback) == TraversalDecision::Break)
|
||||
return TraversalDecision::Break;
|
||||
}
|
||||
return TraversalDecision::Continue;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue