Closed Bug 1377291 Opened 7 years ago Closed 7 years ago

[meta] APZ with layer-free


(Core :: Graphics: WebRender, enhancement)

Not set



Tracking Status
firefox56 --- unaffected
firefox57 --- unaffected


(Reporter: jrmuizel, Unassigned)



(Keywords: meta)

Kats, have you thought much about how this might work.
Flags: needinfo?(bugmail)
I've thought about it a little. I'll try and write something down tomorrow.
Assignee: nobody → bugmail
Ok, so here's a braindump loosely organized:

- APZ mostly requires a few things from the main thread:

(1) ScrollMetadata objects. These should be mostly straightforward to generate from nsDisplayList data using nsLayoutUtils::ComputeScrollMetadata. The function doesn't use the Layer* parameter except for logging, and the only other thing that might be a little hard to hook up is the cumulative resolution which we currently get from a ContainerLayerParameters but can probably compute some other way. So we can generate these ScrollMetadata objects and ship them over to APZ.

(2) Scroll handoff information. Right now APZ uses (IIRC) a combination of the layer tree structure and the scrollParentId field on the ScrollMetadata to build the handoff chains. Since we won't have the layer tree structure we'll just have to make sure the scrollParentId is always populated properly and add some more glue on the APZ side to connect the handoff chains across "reflayer" or process boundaries. This should be fairly easy.

(3) Event region information for hit testing. This is the one that I thought would be trickiest, but it might actually not be that bad. Since we're going to be walking the display list, we could probably just make a copy of all the nsDisplayEventRegions items and ship them over to APZ. The one thing we would need to do is make sure each nsDisplayEventRegions item has a scrollId so that APZ knows what the target is if the hit test matches that item. As an optimization we can probably squash together adjacent region items which the same scrollId. The one caveat here is that if there are nsDisplayTransform items in the display list, we need to make sure that information is also shipped over to APZ, because it is needed both for hit-testing and for unapplying the async transform from input events. nsDisplayTransform items will probably need to be shipped to APZ along with the nsDisplayEventRegions items, and we should not squash together nsDisplayEventRegions that are separated by an nsDisplayTransform.

- The other half of the problem is how we're going to set up the scroll layers and clips in the WR display list (the stuff that ScrollingLayersHelper currently does). I think this should be doable from walking the nsDisplayList because we have scroll frame items that we can use to generate WR scroll layers, and all the display items have clip information that we can use to generate clips. So this shouldn't be too bad either. It's mostly a matter of finding all the relevant information from the nsDisplayList as we walk it and pumping it through the WR API (which is still undergoing evolution). However this is probably the part I'm most unsure about right now as I haven't given this a lot of thought yet.

In terms of immediate action items there's a few things I could probably start tackling right away:
- Make sure the APZ code stops relying on the layer tree structure for scroll handoff, and can instead accept a map of ScrollableLayerGuid -> ScrollMetadata and reconstruct the necessary handoff information from that.
- Modify nsDisplayEventRegions to hold a scrollId
- Once ethan's first set of patches lands and we have the display-list-iteration code in the tree I can try to build on that to extract the nsDisplayEventRegions and nsDisplayTransform information and ship that over to APZ, and see how to turn that into usable hit-testing data structures.
Flags: needinfo?(bugmail)
Blocks: layers-free
Depends on: 1391318
Priority: P3 → P1
Whiteboard: [wr-mvp]
Target Milestone: --- → mozilla57
Depends on: 1402870
Keywords: meta
Summary: APZ with layer-free → [meta] APZ with layer-free
Whiteboard: [wr-mvp]
Assignee: bugmail → nobody
Priority: P1 → --
Going to close this bug, since APZ basically works with layers-free and all dependencies of this bug are closed. The main thing left to do is switch to WR hit-testing, and that's tracked under bug 1421380.
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.