- From: Viatcheslav Ostapenko <sl.ostapenko@samsung.com>
- Date: Mon, 03 Mar 2014 17:23:42 -0500
- To: Rossen Atanassov <Rossen.Atanassov@microsoft.com>
- Cc: Corey Ford <corey@coreyford.name>, "www-style@w3.org" <www-style@w3.org>
On Sun, 2014-03-02 at 20:58 +0000, Rossen Atanassov wrote: > In general I agree with your definition. Here's the way I see the algorithm > I just need to formalize it in prose. The following offsets the top position > of a sticky box only and should be extended to all four sides of the sticky > box. > > (assume origin is top left) > ContainingBox is the containing element's content box bounds StickyBox is > the border box of the sticky positioned box computed at its static position > StickyPosition is computed from the nearest scroller box bounds minus top, > right, bottom, left values of the sticky element (these props are used as > additional padding away from the scroller box) ReleasePosition is computed > from ContainingBox.boxx - StickyBox.height + StickyBox.Style.Bottom > > IF ContainingBox.height > StickyBox.height AND ContainingBox.bottom > StickyBox.bottom // don't apply sticky to boxes that overflow their container box > StickyBox.top = min(max(StickyBox.top, StickyPosition), ReleasePosition) > > Here're some additional scenarios in the current spec that should be dealt with. > - When sticky box bounds exceed the containing box bounds due to size or overflow? Above I disallowed such scenario but this could be debated. I think if sticky element overflows the containing box, sticky positioning shouldn't apply and sticky element should stay on its normal flow position. > - Should the ReleasePosition be computed any differently if the ContainingBox is also the ScrollerBox? Does it makes sense to have sticky positioning if container box is itself scroller box? If there is no use case, I would suggest just disallow sticky positioning if container box is scroller box and fall back to normal flow. > - Should the StickyPosition apply if the static StickyBox.top is already above initially? I think yes. For example, table header in the middle of long list. > - Should the StickyPosition apply if the ReleasePosition is above it initially? I think yes, especially for cases when StickyBox is still visible in the scroller box. Slava
Received on Monday, 3 March 2014 22:24:17 UTC