[Webkit-unassigned] [Bug 185886] New: Incorrect window size following window.onresize for WKWebView using Auto Layout

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue May 22 14:12:10 PDT 2018


https://bugs.webkit.org/show_bug.cgi?id=185886

            Bug ID: 185886
           Summary: Incorrect window size following window.onresize for
                    WKWebView using Auto Layout
           Product: WebKit
           Version: Safari 11
          Hardware: Unspecified
                OS: iOS 11
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: HTML Events
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: jdarcangelo at mozilla.com

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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20180522/0a6f6c07/attachment.html>


More information about the webkit-unassigned mailing list