script: Cache the <iframe> list per-Document (#34702)

This change creates a new struct `IFrameCollection` that is used to
cache the list of `<iframe>`s in a `Document` as long as the
`Document`'s DOM has not changed. This prevent constantly iterating the
entire DOM during *update the rendering*, which runs up to 60 times per
second as well as for other operations.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson 2024-12-20 12:46:46 +01:00 committed by GitHub
parent adfee3daa5
commit a5c461146f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 225 additions and 107 deletions

View file

@ -804,7 +804,7 @@ impl VirtualMethods for HTMLIFrameElement {
);
let exited_window = exited_document.window();
exited_window.discard_browsing_context();
for exited_iframe in exited_document.iter_iframes() {
for exited_iframe in exited_document.iframes().iter() {
debug!("Discarding nested browsing context");
exited_iframe.destroy_nested_browsing_context();
}