Closed Bug 1503046 Opened 3 years ago Closed 3 years ago

Carry hit test information in stacking context container items


(Core :: Web Painting, enhancement, P1)




Tracking Status
firefox65 --- fixed


(Reporter: miko, Assigned: miko)


(Blocks 2 open bugs)



(3 files)

Creating a lot of nsDisplayCompositorHitTestInfo items is expensive, and currently we always create one for stacking contexts. These patches carry the hit test information in stacking context container items instead.
These patches introduce HitTestInfo struct, which contains the information needed to accumulate hit test area and flags into PaintedLayerData, and nsDisplayHitTestInfoItem, which is a base class for display items that can carry compositor hit test info. The new base class is introduced to avoid increasing memory footprint of all display items, and to avoid duplicating code.

The basic idea is the following:
- When building a display list for a stacking context, a HitTestInfo struct is created with the same information that nsDisplayCompositorHitTestInfo would have been created with.
- This HitTestInfo is added to the innermost container item that was created for the stacking context frame. If no container item was created, a nsDisplayCompositorHitTestInfo item is created instead.
- When FLBDisplayItemIterator processed a container item, DisplayItemEntry with a type HIT_TEST_INFO is emitted with the item set to the container item. Extra care is needed here because of the different flattening methods: for opacity and transforms we need to place the HIT_TEST_INFO marker in between the flattened effect markers, and for other container items before any other child items.
Pushed by
Part 1: Add simple hit test info diagnostics r=mattwoodrow
Part 2: Introduce HitTestInfo and nsDisplayHitTestInfoItem, and make container items and nsDisplayCompositorHitTestInfo use them r=mattwoodrow
Part 3: Generalize FrameLayerBuilder hit test info handling r=mattwoodrow
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla65
Depends on: 1504233
performance improvements:
== Change summary for alert #17337 (as of Fri, 02 Nov 2018 06:23:36 GMT) ==


 11%  displaylist_mutate windows7-32 pgo e10s stylo      2,130.61 -> 1,898.68
 11%  displaylist_mutate windows10-64 pgo e10s stylo     2,048.11 -> 1,827.78
 10%  displaylist_mutate linux64 opt e10s stylo          2,037.21 -> 1,826.33
 10%  displaylist_mutate windows7-32 opt e10s stylo      2,240.34 -> 2,021.39
  9%  displaylist_mutate linux64 pgo e10s stylo          1,884.15 -> 1,708.80
  9%  displaylist_mutate windows10-64 opt e10s stylo     2,156.55 -> 1,956.80
  9%  displaylist_mutate osx-10-10 opt e10s stylo        5,280.09 -> 4,805.19

For up to date results, see:
Blocks: 1527026
Blocks: 1527756
No longer regressions: 1534549
You need to log in before you can comment on or make changes to this bug.