mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
dom: Optimize IFrameCollection::validate (#38196)
The `IFrameCollection` was previously rebuilt too often. This PR tries to address the todo, to only rebuild the IFrameCollection when necessary. Testing: `CSS Selector Invalidation: :has() invalidation should not be O(n^2)` wpt-test changed status from timeout to failed. Fixes: #38131 (IFrameCollection::validate accounts for 30% of script time in DOM heavy scenarios) Co-authored-by: sharpshooter_pt <ibluegalaxy_taoj@163.com> Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
This commit is contained in:
parent
03ab419793
commit
97f544aa20
4 changed files with 46 additions and 14 deletions
|
@ -3349,6 +3349,10 @@ impl Document {
|
|||
self.iframes.borrow_mut()
|
||||
}
|
||||
|
||||
pub(crate) fn invalidate_iframes_collection(&self) {
|
||||
self.iframes.borrow_mut().invalidate();
|
||||
}
|
||||
|
||||
pub(crate) fn get_dom_interactive(&self) -> Option<CrossProcessInstant> {
|
||||
self.dom_interactive.get()
|
||||
}
|
||||
|
@ -4145,7 +4149,7 @@ impl Document {
|
|||
scripts: Default::default(),
|
||||
anchors: Default::default(),
|
||||
applets: Default::default(),
|
||||
iframes: Default::default(),
|
||||
iframes: RefCell::new(IFrameCollection::new()),
|
||||
style_shared_lock: {
|
||||
/// Per-process shared lock for author-origin stylesheets
|
||||
///
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue