Bug 231989 - Content offset in this codepen when switching tabs
Summary: Content offset in this codepen when switching tabs
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Scrolling (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Simon Fraser (smfr)
URL: https://codepen.io/isladjan/pen/abdyPBw
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-10-19 15:07 PDT by Simon Fraser (smfr)
Modified: 2021-10-22 20:25 PDT (History)
15 users (show)

See Also:


Attachments
Patch (26.25 KB, patch)
2021-10-20 21:58 PDT, Simon Fraser (smfr)
no flags Details | Formatted Diff | Diff
Patch (28.99 KB, patch)
2021-10-21 11:08 PDT, Simon Fraser (smfr)
no flags Details | Formatted Diff | Diff
Patch (30.65 KB, patch)
2021-10-21 14:11 PDT, Simon Fraser (smfr)
no flags Details | Formatted Diff | Diff
Patch (31.66 KB, patch)
2021-10-21 15:07 PDT, Simon Fraser (smfr)
no flags Details | Formatted Diff | Diff
Patch (32.62 KB, patch)
2021-10-22 13:21 PDT, Simon Fraser (smfr)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Fraser (smfr) 2021-10-19 15:07:09 PDT
Load https://codepen.io/isladjan/pen/abdyPBw and scroll in the lower pane. Now switch to another tab in Safari, and switch back. The bottom content is now entirely or partially missing.
Comment 1 Simon Fraser (smfr) 2021-10-19 15:27:28 PDT
The compositing layers for the RenderSVGRoot and its siblings has different positions after switching tabs
Comment 2 Simon Fraser (smfr) 2021-10-19 20:06:40 PDT
I think this is scrolling tree related. When we rebuild the scrolling tree after the view is reattached on tab switch, the iframe's scrolling tree node has a 0,0 scroll position rather than the correct one, causing the position:fixed to get mis-positioned.
Comment 3 Simon Fraser (smfr) 2021-10-20 21:58:12 PDT
Created attachment 441985 [details]
Patch
Comment 4 Simon Fraser (smfr) 2021-10-21 11:08:54 PDT
Created attachment 442049 [details]
Patch
Comment 5 Simon Fraser (smfr) 2021-10-21 14:11:01 PDT
Created attachment 442063 [details]
Patch
Comment 6 Tim Horton 2021-10-21 14:33:41 PDT
Comment on attachment 442063 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=442063&action=review

> Tools/TestWebKitAPI/Tests/mac/ScrollingCoordinatorTests.mm:39
> +static void synthesizeWheelEvents(NSView *view, CGPoint locationInView, CGSize delta)

Surely not unique to this test, should it be on TestWKWebView?

> Tools/TestWebKitAPI/Tests/mac/ScrollingCoordinatorTests.mm:82
> +        return [obj hasPrefix:@"        (last committed scroll position"];

Somewhat eww

> Tools/TestWebKitAPI/Tests/mac/ScrollingCoordinatorTests.mm:115
> +    NSWindow *hostWindow = [webView window];

Doesn't TestWKWebView have helpers for moving in and out of window too? I guess your test is platform specific so it doesn't really matter.

> Tools/TestWebKitAPI/Tests/mac/ScrollingCoordinatorTests.mm:125
> +    scrollY = waitForScrollEventAndReturnScrollY(webView.get(), [](WKWebView* webView) {

Star's on the wrong side etc.
Comment 7 Simon Fraser (smfr) 2021-10-21 15:07:31 PDT
Created attachment 442070 [details]
Patch
Comment 8 Radar WebKit Bug Importer 2021-10-21 15:14:43 PDT
<rdar://problem/84525145>
Comment 9 EWS 2021-10-21 16:58:43 PDT
Committed r284654 (243374@main): <https://commits.webkit.org/243374@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 442070 [details].
Comment 10 ayumi_kojima 2021-10-22 09:04:41 PDT
Reverted r284654 for reason:

Reverting because this commit caused scrolling tests to fail

Committed r284685 (243405@main): <https://commits.webkit.org/243405@main>
Comment 11 Simon Fraser (smfr) 2021-10-22 13:21:47 PDT
Created attachment 442190 [details]
Patch
Comment 12 EWS 2021-10-22 20:25:30 PDT
Committed r284738 (243447@main): <https://commits.webkit.org/243447@main>

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