mirror of
https://github.com/servo/servo.git
synced 2025-06-11 01:50:10 +00:00
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:
parent
adfee3daa5
commit
a5c461146f
7 changed files with 225 additions and 107 deletions
|
@ -2988,15 +2988,15 @@ impl ScriptThread {
|
|||
browsing_context_id: BrowsingContextId,
|
||||
can_gc: CanGc,
|
||||
) {
|
||||
let doc = self
|
||||
let document = self
|
||||
.documents
|
||||
.borrow()
|
||||
.find_document(parent_pipeline_id)
|
||||
.unwrap();
|
||||
let frame_element = doc.find_iframe(browsing_context_id);
|
||||
|
||||
if let Some(ref frame_element) = frame_element {
|
||||
doc.request_focus(Some(frame_element.upcast()), FocusType::Parent, can_gc);
|
||||
let iframes = document.iframes();
|
||||
if let Some(iframe) = iframes.get(browsing_context_id) {
|
||||
document.request_focus(Some(iframe.element.upcast()), FocusType::Parent, can_gc);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue