Open Bug 1765638 Opened 3 years ago Updated 3 years ago

Do not destroy display items during display list building

Categories

(Core :: Web Painting, defect, P2)

defect

Tracking

()

People

(Reporter: mikokm, Unassigned)

References

(Blocks 1 open bug)

Details

This is wasteful and makes it difficult to reason about display item lifetimes. In particular this is problematic for retained display lists, because it makes it hard to retain data in frames if their ancestor frames can destroy that data.

Callers of nsDisplayItem::Destroy(): 1, 2
Callers of nsDisplayList::DeleteAll(): 3,4
Callers of nsDisplayListSet::DeleteAll(): 5,6

Bonus: 7 (disabled code), 8 (docshell swap)

Blocks: 1737889

The two callers to nsDisplayItem::Destroy() are text overflow and PresShell::ClipListToRange.

text-overflow could potentially be rewritten to be done at reflow time instead of display list time.

ClipListToRange only seems used by dragging and dropping, perhaps we can implement it differently as well.

ClipListToRange came from https://bugzilla.mozilla.org/show_bug.cgi?id=178513.

WebKit/Chrome implement something like this using paint behaviour flags e.g. https://searchfox.org/wubkat/rev/78bfb4f405f50bd751536c8b9c026455b00ef936/Source/WebCore/rendering/RenderLayer.cpp#3434

i.e. basically only draw what we need to instead of removing things after painting.

You need to log in before you can comment on or make changes to this bug.