Bug 223175 - [css-scroll-snap] Properly handle overflowing snap areas
Summary: [css-scroll-snap] Properly handle overflowing snap areas
Status: RESOLVED DUPLICATE of bug 223021
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Martin Robinson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-15 01:17 PDT by Martin Robinson
Modified: 2021-03-17 03:15 PDT (History)
6 users (show)

See Also:


Attachments
Patch (160.12 KB, patch)
2021-03-15 04:53 PDT, Martin Robinson
no flags Details | Formatted Diff | Diff
Patch (77.18 KB, patch)
2021-03-15 06:04 PDT, Martin Robinson
no flags Details | Formatted Diff | Diff
Patch (77.64 KB, patch)
2021-03-15 09:41 PDT, Martin Robinson
no flags Details | Formatted Diff | Diff
Patch (77.97 KB, patch)
2021-03-16 02:41 PDT, Martin Robinson
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Robinson 2021-03-15 01:17:37 PDT
When a snap area overflows the snapper, the specification details some specific handling. From https://www.w3.org/TR/css-scroll-snap-1/#snap-overflow:
  
  If the snap area is larger than the snapport in a particular axis, then any scroll position
  in which the snap area covers the snapport, and the distance between the geometrically
  previous and subsequent snap positions in that axis is larger than size of the snapport in
  that axis, is a valid snap position in that axis. The UA may use the specified alignment as a
  more precise target for certain scroll operations (e.g. explicit paging).

This implies that we keep snap area dimension around when we didn't before.
Comment 1 Martin Robinson 2021-03-15 04:53:12 PDT
Created attachment 423157 [details]
Patch
Comment 2 Martin Robinson 2021-03-15 06:04:41 PDT
Created attachment 423166 [details]
Patch
Comment 3 Martin Robinson 2021-03-15 09:41:56 PDT
Created attachment 423189 [details]
Patch
Comment 4 Martin Robinson 2021-03-16 02:41:50 PDT
Created attachment 423311 [details]
Patch
Comment 5 Martin Robinson 2021-03-16 06:00:08 PDT
Here's some background on these changes as they are a bit larger and more complicated than normal:

Before this change when snap points were calculated after a layout and a ScrollSnapOffsetsInfo was created with both the offsets of the snap points and a set of ranges of offsets where no snapping occurred. These ranges were useful because it made it simple to determine if a particular offset was subject to snapping. With the implementation of this part of the specification, the range-based approach is not as suitable because snap areas (which may overlap) now affect whether or not a scroll will snap to a snap point.

Instead, this change take a lazier approach. During scrolling, we walk through each potential snap offset and look at the associated snap area. This information to determine if the destination scroll offset falls onto a snap area that overflows the snapport or if it is subject to proximity snapping.
Comment 6 Martin Robinson 2021-03-17 03:15:46 PDT

*** This bug has been marked as a duplicate of bug 223021 ***