Bug 1622322 Comment 0 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

When we print, a static clone of the document is created to act as a snapshot for what should be printed.

During this process, we may end up creating clones of multiple shadow roots that may be sharing the same adopted style sheets with the document itself and potentially other shadow roots. 

Right now, if we had 10 shadow roots that all adopted the same 10 style sheets, we would end up creating 100 total cloned style sheets, 10 for each cloned root. 

Unfortunately, we do have to clone the sheets themselves, otherwise there would be mutable references to the sheets outside of our "static" snapshot.

However; we can improve the performance by using a hash map during the cloning process, such that if a cloned sheet has already been created, the cloned shadow roots can find it and share the same clone.

This will reduce the number style sheet clones from 1:N, where N is the number of adopters of the sheet, to 1:1.
When we print, a static clone of the document is created to act as a snapshot for what should be printed.

During this process, we may end up creating clones of multiple shadow roots that may be sharing the same adopted style sheets with the document itself and potentially other shadow roots. 

Right now, if we had 10 shadow roots that all adopted the same 10 style sheets, we would end up creating 100 total cloned style sheets, 10 for each cloned root. 

Unfortunately, we do have to clone the sheets themselves, otherwise there would be mutable references to the sheets outside of our "static" snapshot.

However; we can improve the performance by using a hash map during the cloning process, such that if a cloned sheet has already been created, the cloned shadow roots can find it and share the same cloned sheet.

This will reduce the number style sheet clones from 1:N, where N is the number of adopters of the sheet, to 1:1.

Back to Bug 1622322 Comment 0