Bug 242550

Summary: A vertical scrollbar is shown when none is necessary
Product: WebKit Reporter: Simon Fraser (smfr) <simon.fraser>
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: bfulgham, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: Safari Technology Preview   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=256298
Attachments:
Description Flags
Testcase none

Description Simon Fraser (smfr) 2022-07-08 20:47:32 PDT
Created attachment 460775 [details]
Testcase

When the content size matches the view size (or the iframe size), then we'll create a vertical scrollbar and trigger vertical scrolling when it's not necessary (when scrollbars take space, i.e. non-overlay scrollbars).

Turn on always-on scrollbars.
Load the attached testcase
Size the window so that the gray rectangle just covers the web view.
Reload; note how a vertical scrollbar appears.
Now size the window from the bottom, making it slightly taller then shorter, back to the original size. Note how you can make the scrollbar go away.
Comment 1 Simon Fraser (smfr) 2022-07-08 20:48:27 PDT
This is about code in in `FrameView::adjustScrollbarsForLayout()` that forces on the vertical scrollbar for the first layout, but doesn't compute that it can remove it again and still fit the content.

The state is unstable; some future layout can cause the scrollbar to disappear.
Comment 2 Radar WebKit Bug Importer 2022-07-15 20:48:14 PDT
<rdar://problem/97108398>