Bug 185886

Summary: Incorrect window size following window.onresize for WKWebView using Auto Layout
Product: WebKit Reporter: Justin D'Arcangelo <jdarcangelo>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: simon.fraser, thorton, timothy
Priority: P2    
Version: Safari 11   
Hardware: Unspecified   
OS: iOS 11   

Justin D'Arcangelo
Reported 2018-05-22 14:12:10 PDT
On iOS, the `window.onresize` event fires in a WKWebView when the device switches orientation. However, if the WKWebView is positioned WITH Auto Layout, `window.innerWidth` and `window.innerHeight` will report incorrect values from within the `window.onresize` event handler. But, if the WKWebView is positioned manually WITHOUT using Auto Layout, `window.innerWidth` and `window.innerHeight` will report correct values in the event handler. This bug was found in Firefox for iOS when viewing maps.google.com and rotating the device orientation as reported here: https://bugzilla.mozilla.org/show_bug.cgi?id=1463058 I've created the following JSBin for testing the result of observing the `window.onresize` event when rotating the device orientation: http://output.jsbin.com/regipul Then, I tested that JSBin in a minimal WKWebView iOS app both WITH and WITHOUT Auto Layout and observed the following: WKWebView WITH Auto Layout: 1.) Portrait - 375x603 (initial load) 2.) Landscape - 375x343 3.) Portrait - 375x343 WKWebView WITHOUT Auto Layout: 1.) Portrait - 375x603 (initial load) 2.) Landscape - 667x311 3.) Portrait - 375x603 As you can see, in the WKWebView using Auto Layout, the `innerWidth`/`innerHeight` values remain the same following the first `window.onresize` event. However, this problem is not exhibited when positioning the WKWebView manually without Auto Layout. This problem is not seen in Mobile Safari. Presumably, it is not using Auto Layout.
Attachments
Lucas Forschler
Comment 1 2019-02-06 09:18:58 PST
Mass move bugs into the DOM component.
Note You need to log in before you can comment on or make changes to this bug.