Open Bug 1245883 Opened 8 years ago Updated 2 years ago

Stop cloning the Selection in nsHTMLCopyEncoder for better performance

Categories

(Core :: DOM: Serializers, defect)

defect

Tracking

()

Tracking Status
firefox47 --- affected

People

(Reporter: MatsPalmgren_bugz, Unassigned)

References

Details

(Keywords: perf, Whiteboard: dom-triaged)

We should try to avoid creating new Selection objects and cloning ranges into it
because it can be expensive with a large number of ranges.  We register all ranges
in all Selections in the DOM tree to track what is selected and these are used
during painting.

http://hg.mozilla.org/mozilla-central/annotate/f53533d9eb77/dom/base/nsDocumentEncoder.cpp#l1500

It seems unnecessary to use a Selection here.  Maybe we can use nsTArray<nsRange>
instead?  Unless we can simply use a RefPtr to the given aSelection?

We hit this code when doing CTRL+A on Linux.  Furthermore, holding down CTRL+A
creates a lot of these Selections and they linger until the next CC.  I can easily
create a hundred Selection objects in a few seconds...
Whiteboard: dom-triaged
Blocks: 1258476
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.