-
Notifications
You must be signed in to change notification settings - Fork 1
Why aren't scrollframes reference frames
Why does the matrix of a scrolled nsDisplayTransform change during scrolling?
Because the matrix is with respect to the parent reference frame. The reference frame does not move during scrolling.
Why is the scrolled frame not a reference frame?
Matt tried to make them reference frames at some point but it was too hard. The biggest problem are clips: Items inside the scrolled frame can have clips from both inside and outside the scrolled frame. Clips have coordinates which are with respect to some reference frame. The current assumption is that a clip on an item always has coordinates in the space of the reference frame of the item that the clip is applied to.
A particularly hard bit is when we descend from a scrolled frame, into a placeholder for an OOF frame that is outside the scroll frame. We've now changed reference frame, and we need to offset all clips in the current clip chain to move them to the right reference frame (and back again once we're done with this frame). We probably want to track the reference frame on each clip so we know what coordinate space they are in, and add ways to convert them.
The other main hard issue is that we need a ContainerLayer/item to provide the translation between the two coordinate space. Scroll frames aren't containing blocks, so there's no guarantee that all scrolled items will be consecutive in the display list. My prior solution was to create a separate container item around each block of consecutive scrolled items. We don't know what these are until we've done z-index sorting though, so I had post-processing pass when we finished building a stacking context, that looked for scrolled items (nested scrollframes are fun) and wrapped consecutive sets in the scroll offset item. Up until this point we had items that belong to the scroll reference frame, and items that belong to the outer reference frame in the same list, which hits a bunch of assertions. Finding a sane way to represent the intermediate state, while still checking the final lists all belong to the same reference frame was still on my todo list.