Bug 207089

Summary: Fixed elements should stay fixed with pinch-to-zoom
Product: WebKit Reporter: cc.glows
Component: ScrollingAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: brian, kyle.bavender, simon.fraser, thorton, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 13   
Hardware: Mac   
OS: macOS 10.15   
Attachments:
Description Flags
Video demonstration of the reproduction
none
Test HTML none

Description cc.glows 2020-02-01 01:38:12 PST
When pinch-to-zooming, `fixed` elements don't stay fixed for a period and can be scrolled, but elements positioned relative to it with `fixed` get positioned incorrectly when using `getBoundingClientRect()`. This doesn't occur when zoomed out normally (0:00 - 0:05).

When pinch to zooming as well, fixed elements can suddenly disappear after zooming in with pinch-to-zoom. Scroll down to the bottom right of the page in the repro and zoom in.

Minimal reproduction:

<!DOCTYPE html> <title>Basic Visual Test</title>

<style>
  body {
    height: 3000px;
    width: 3000px;
  }

  #reference {
    position: fixed;
    top: 150px;
    left: 150px;
    width: 200px;
    height: 200px;
    background-color: red;
    box-shadow: inset 0 0 0 1px black;
  }

  #popper {
    width: 100px;
    height: 100px;
    background-color: rebeccapurple;
    box-shadow: inset 0 0 0 1px black;
  }
</style>

<div id="reference">Reference Box</div>
<div id="popper">Popper Box</div>

<script>
  popper.style.position = 'fixed';

  function update() {
    const refRect = reference.getBoundingClientRect();
    const popRect = popper.getBoundingClientRect();

    popper.style.left = `${refRect.right}px`;
    popper.style.top = `${refRect.top + popRect.height / 2}px`;
  }

  window.addEventListener('scroll', update);
  update();
</script>
Comment 1 cc.glows 2020-02-01 01:48:10 PST
Created attachment 389456 [details]
Video demonstration of the reproduction

Attached a video that was missing in the original post. Apologies for the redundant wording in it — I can't edit it.
Comment 2 Radar WebKit Bug Importer 2020-02-02 13:13:49 PST
<rdar://problem/59097233>
Comment 3 Simon Fraser (smfr) 2020-02-03 10:39:03 PST
Created attachment 389537 [details]
Test HTML