Bug 196330 - Overlays on instagram.com are shifted if you click on a photo after scrolling
Summary: Overlays on instagram.com are shifted if you click on a photo after scrolling
Alias: None
Product: WebKit
Classification: Unclassified
Component: Scrolling (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Simon Fraser (smfr)
Keywords: InRadar
Depends on:
Reported: 2019-03-27 17:16 PDT by Simon Fraser (smfr)
Modified: 2019-03-28 09:45 PDT (History)
5 users (show)

See Also:

Reduction (1.57 KB, text/html)
2019-03-27 17:17 PDT, Simon Fraser (smfr)
no flags Details
Patch (8.12 KB, patch)
2019-03-27 21:22 PDT, Simon Fraser (smfr)
koivisto: review+
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) 2019-03-27 17:16:46 PDT
Go to an instagram page with photos. Scroll down. Click on a photo. The fixed overlay that comes up is offset by your scroll position.
Comment 1 Simon Fraser (smfr) 2019-03-27 17:17:42 PDT
Created attachment 366131 [details]
Comment 2 Simon Fraser (smfr) 2019-03-27 17:18:51 PDT
Comment 3 Simon Fraser (smfr) 2019-03-27 17:20:55 PDT
The site basically does:

document.body.style.top = -window.scrollY + 'px';
document.body.style.position = "fixed";
// show fixed overlay

so we get a scrolling tree commit that has a new layout viewport (goes from origin 0,scrollTop to 0,0) and a new scrollPosition.

In this case, we have to clobber the scrolling thread's notion of scroll position because the document suddenly became non-scrollable, so this has to act like a requestedScrollPosition change.
Comment 4 Simon Fraser (smfr) 2019-03-27 20:07:44 PDT
Ah, this is about the race between the scrolling tree commit and calling ScrollingTree::applyLayerPositions() on the main thread. I might have to have the main thread wait on the commit.
Comment 5 Simon Fraser (smfr) 2019-03-27 21:22:21 PDT
Created attachment 366149 [details]
Comment 6 Simon Fraser (smfr) 2019-03-28 08:04:08 PDT
I'll try to make the attachment into a test case.
Comment 7 Simon Fraser (smfr) 2019-03-28 09:45:42 PDT
Landed with test: https://trac.webkit.org/r243607