mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +01:00
Keep a list of slot descendants on each shadow root (#35802)
This makes it much faster to traverse over the slot descendants of a shadow root, which is a fairly costly part of "assign slottables to a tree". This reduces the time it takes for the results to load on wpt.fyi from over 3 minutes to about 5 seconds. Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
parent
0419a7818d
commit
fd0e2125c6
3 changed files with 89 additions and 13 deletions
|
@ -1362,7 +1362,11 @@ impl Node {
|
|||
// NOTE: This method traverses all descendants of the node and is potentially very
|
||||
// expensive. If the node is not a shadow root then assigning slottables to it won't
|
||||
// have any effect, so we take a fast path out.
|
||||
if !self.is::<ShadowRoot>() {
|
||||
let Some(shadow_root) = self.downcast::<ShadowRoot>() else {
|
||||
return;
|
||||
};
|
||||
|
||||
if !shadow_root.has_slot_descendants() {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue