Bug 236142 - Adding padding on a horizontal scroller prevents last item from being fully viewable
Summary: Adding padding on a horizontal scroller prevents last item from being fully v...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: Safari Technology Preview
Hardware: All All
: P2 Normal
Assignee: zalan
URL:
Keywords: BrowserCompat, InRadar
Depends on: 241689
Blocks:
  Show dependency treegraph
 
Reported: 2022-02-04 09:53 PST by Charlie Croom
Modified: 2022-06-22 19:54 PDT (History)
10 users (show)

See Also:


Attachments
Test case (1.18 KB, text/html)
2022-02-25 15:05 PST, Simon Fraser (smfr)
no flags Details
Patch (3.95 KB, patch)
2022-06-16 21:24 PDT, zalan
no flags Details | Formatted Diff | Diff
Patch (5.43 KB, patch)
2022-06-17 11:49 PDT, zalan
no flags Details | Formatted Diff | Diff
Patch (8.86 KB, patch)
2022-06-18 07:06 PDT, zalan
no flags Details | Formatted Diff | Diff
Test reduction (471 bytes, text/html)
2022-06-21 16:57 PDT, zalan
no flags Details
Patch (3.21 KB, patch)
2022-06-22 11:56 PDT, zalan
no flags Details | Formatted Diff | Diff
Patch (4.17 KB, patch)
2022-06-22 13:24 PDT, zalan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Charlie Croom 2022-02-04 09:53:32 PST
When a scrollable element has padding added to it, the last item can never be scrolled into view. This appears to be because there's not enough scrollable area added. Potentially related: the `scrollWidth` property appears to be smaller than that of Chrome and Firefox.

Reduced repro (see Firefox/Chrome handling):
https://jsfiddle.net/comp615/Lf15jkgp/15/

The example kind of illustrates Twitter's use case. We want to show a preview/peek of the next item, or to overflow the parent, while still aligning the scroller to the parent layout).

Potentially related bugs:
#95032
#201453
Comment 1 Simon Fraser (smfr) 2022-02-04 10:03:06 PST
This does indeed look like a rather serious bug.
Comment 2 Radar WebKit Bug Importer 2022-02-04 10:03:20 PST
<rdar://problem/88495053>
Comment 3 Simon Fraser (smfr) 2022-02-25 15:05:05 PST
Created attachment 453268 [details]
Test case
Comment 4 Simon Fraser (smfr) 2022-02-25 15:30:34 PST
This works for vertical scrollers, but not horizontal scrollers. For vertical scrollers, the padding is taken into account by the `oldClientAfterEdge` value passed in to `computeOverflow()`, which comes from clientLogicalBottom(). But there is no equivalent logic for horizontal padding.
Comment 5 Simon Fraser (smfr) 2022-02-25 15:30:54 PST
This is about the computation of layout overflow.
Comment 6 zalan 2022-06-16 21:24:56 PDT
Created attachment 460292 [details]
Patch
Comment 7 zalan 2022-06-17 11:49:42 PDT
Created attachment 460305 [details]
Patch
Comment 8 zalan 2022-06-18 07:06:01 PDT
Created attachment 460330 [details]
Patch
Comment 10 Simon Fraser (smfr) 2022-06-20 11:06:12 PDT Comment hidden (obsolete)
Comment 11 zalan 2022-06-21 16:57:39 PDT
Created attachment 460392 [details]
Test reduction
Comment 12 zalan 2022-06-22 11:56:02 PDT
Created attachment 460424 [details]
Patch
Comment 13 zalan 2022-06-22 13:24:22 PDT
Created attachment 460426 [details]
Patch
Comment 14 EWS 2022-06-22 19:54:56 PDT
Committed r295765 (251770@main): <https://commits.webkit.org/251770@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 460426 [details].