Bug 257375

Summary: elem.getBoundingClientRect does not include visualViewport.offsetLeft
Product: WebKit Reporter: Holger Jeromin <bugzillawebkit>
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: bfulgham, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: iPhone / iPad   
OS: iOS 16   
See Also: https://bugs.webkit.org/show_bug.cgi?id=170981
Attachments:
Description Flags
minimal repro of the issue none

Description Holger Jeromin 2023-05-26 05:25:47 PDT
Created attachment 466505 [details]
minimal repro of the issue

When the visual viewport is scaled and moved a getBoundingClientRect does not include visualViewport.offsetLeft.

In my minimal repro (attached and online https://www.katur.de/issues/safari_viewport-scaled_pos-fixed.html ) I check every 
second the BoundingClientRect of a base element and put its top,left value to the position of a position:fixed overlay element. 

This overlay element should cover the base element exactly.
On desktop and mobile Chrome+Firefox this works even with pinch zoom.
With mobile Safari I get an offset in the size of visualViewport.offsetLeft.

The repo has a second overlay which uses the same BoundingClientRect values but add visualViewport.offsetTop/Left value to the position.

With mobile Chrome+Firefox the "BCR overlay" is always over the base element even with pinch zoom.
With mobile Safari the "BCR+offset* overlay" is always over the base element even with pinch zoom.
Comment 1 Radar WebKit Bug Importer 2023-06-02 05:26:16 PDT
<rdar://problem/110164602>