APZC Hit Testing doesn't support 3D transform




Graphics: Layers
5 years ago
5 years ago


(Reporter: BenWa, Unassigned)


Mac OS X
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)




5 years ago
APZC does hit testing using a single point. This wont work with 3D transform where we need to project the point in 3D space. See nsDisplayList hit testing code for the right thing to do:

This gets more complicated with preserve 3D transform where we ignore preserve 3D transforms with hit testing. We should keep the same behavior even if it's incorrect or fix it in both place at once.
I'm not sure if this is still an issue with the patches I have in bug 866232. This is how I think it works with those patches:

1) During APZC tree building, the mViewport of the layer is transformed by the effective transform on the layer, which includes any 3D transforms
2) The 3D-transformed rect (technically this should be a polygon but currently it just uses the bounding rect) is saved to the mVisibleRegion on the APZC
3) During async pan/zoom there is an additional 2D async transform applied to the layer tree

Then during hit testing:
4) The hit testing code undoes the 2D async transform (technically it does a ProjectPoint so even if we change that to a 3D transform it will still work)
5) It then hit tests against the APZC mVisibleRegion, which corresponds to what the user can see on the screen. So it should find the right APZC
6) The APZCTreeManager then delivers the input event to the APZC, which is supposed to return an untransformed version that layout can consume (in the case of one of the ReceiveInputEvent functions)
7) The APZC will return that with the async transform unapplied
8) The regular hit-testing code in nsDisplayList will take that and unapply the additional CSS transforms (2D or 3D) via the code you linked to above
9) Everything works.

I will ensure steps 6 and 7 are correct as part of bug 890280.
Depends on: 866232
I'm closing this as WFM but we can reopen it if my analysis above is incorrect.
Last Resolved: 5 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.