Bug 217949
| Summary: | resize event is not fired while the page is still loading | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Maxim Tsoy <muodov> |
| Component: | Layout and Rendering | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW | ||
| Severity: | Normal | CC: | ahmad.saleem792, ap, bfulgham, cdumez, dbates, muodov, rniwa, simon.fraser, smoley, thorton, webkit-bug-importer, wenson_hsieh, zalan |
| Priority: | P2 | Keywords: | InRadar |
| Version: | Safari 14 | ||
| Hardware: | iPhone / iPad | ||
| OS: | Unspecified | ||
| URL: | http://x.zok.pw/ios-iframe-resize/parent.html | ||
Maxim Tsoy
It seems like Safari on iOS/iPadOS does not trigger resize events until all the page resources are loaded.
Steps to reproduce:
1. Open http://x.zok.pw/ios-iframe-resize/parent.html
2. Press the "open slowchild" button
3. Observe that there is no messages about resize events inside the iframe
Expected behaviour: there should be a resize event detected at step 3.
The test page contains the second button "open child", which opens a similar frame without slow resources. In this case, `onload` event is fired before the resize, and resize event is correctly fired inside the frame.
Notes:
I could reproduce this bug only on iOS. Desktop Safari, Chrome and Firefox trigger the resize vent as expected.
According to the HTML spec (Step 4 of https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering), user agent can decide to skip the resize steps, but in this case the viewport has actually changed. This is also detected in the test page.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Maxim Tsoy
After some more testing, I could reproduce the issue even after the iframe reached the `complete` document state, so I'm not sure if it's related to the DOM ready state.
It seems to reproduce reliably on the provided test page, so hopefully it will be helpful to find the root cause.
Alexey Proskuryakov
I can reproduce. The resize event also fails to trigger when rotating.
See this code in FrameView.cpp:
#if PLATFORM(IOS_FAMILY)
// Don't send the resize event if the document is loading. Some pages automatically reload
// when the window is resized; Safari on iOS often resizes the window while setting up its
// viewport. This obviously can cause problems.
if (DocumentLoader* documentLoader = frame().loader().documentLoader()) {
if (documentLoader->isLoadingInAPISense())
return;
}
#endif
Radar WebKit Bug Importer
<rdar://problem/70579052>
Simon Fraser (smfr)
That's on old change from iOS WebKit upstreaming. Could potentially be re-visited.
Ahmad Saleem
I am able to reproduce this on iOS 16 (Safari 16) as well.
>> Safari Desktop:
I'm a slow child window
Mon Sep 12 2022 22:41:23 GMT+0100 (British Summer Time) resize event fired
Broken Image icon
>> Safari iOS:
I'm a slow child window
Broken Image icon