Bug 236142

Summary: Adding padding on a horizontal scroller prevents last item from being fully viewable
Product: WebKit Reporter: Charlie Croom <charlie.croom>
Component: Layout and RenderingAssignee: zalan <zalan>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, changseok, esprehn+autocc, ews-watchlist, glenn, kondapallykalyan, pdr, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: BrowserCompat, InRadar
Version: Safari Technology Preview   
Hardware: All   
OS: All   
See Also: https://bugs.webkit.org/show_bug.cgi?id=95032
https://bugs.webkit.org/show_bug.cgi?id=201453
https://bugs.webkit.org/show_bug.cgi?id=241461
Bug Depends on: 241689    
Bug Blocks:    
Attachments:
Description Flags
Test case
none
Patch
none
Patch
none
Patch
none
Test reduction
none
Patch
none
Patch none

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].