Re: [csswg-drafts] [css-anchor-1] Issues with position fallback (#8059)

Talked to @tabatkins offline. Here's the stuff we agreed to add to the spec:

* Define scroll-adjusted IMCB as the output of the IMCB algorithm with scroll-adjusted insets (same as before), but **without the final clamp-negative-size-to-0 step**
* A fallback style is valid if after applying its application, the result margin box, shifted by the snapshotted scroll offset if any, is fully contained within the SAIMCB. Note that the SAIMCB may have negative size on one or both axes, in which case it's considered to not contain any point/box.
* We choose the first valid fallback style; or if all are invalid, choose the last one
* Each fallback style has a **non-overflowing range**, which is a closed 2D range (i.e., Cartesian product of two closed intervals), such that the fallback style is valid if and only if the snapshotted scroll offset falls in the range. The range is calculated as follows (with `left` as an example)
  * If the `left` property value is not `auto`, then the left edge of the SAIMCB has form `L - scroll_offset.x`, where `L` is constant to the scroll offset. Then:
    * If `margin_box.left >= L`, then the scroll-shifted margin box is always on the right side of the left edge of the SAIMCB, and the left edge of the SAIMCB does not impose any constraint
    * Otherwise, the SAIMCB never fully contains the scroll-shfited margin box, and the non-overflowing range is empty
  * If the `left` property value is `auto`, then the left edge of the SAIMCB is a value constant to the scroll offset; denote that constant with `L`. Then the left edge of the SAIMCB imposes a constraint `scroll_offset.x <= margin_box.left - L`
  * Similarly, from each other edge of the SAIMCB, we can either conclude that the non-overflowing range is empty, or possibly get a constraint
  * Finally, the non-overflowing range is either empty, or the conjunction of all the constraints we got above
* UA should not recalculate layout on every scroll change, but only when the snapshotted scroll offset has moved across the boundary of a non-overflowing range

-- 
GitHub Notification of comment by xiaochengh
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8059#issuecomment-1444616906 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 24 February 2023 22:54:16 UTC