WKWebView embedded in CollectionView ignores frame manually set and take visible bounds to layout HTML Content (Video)

Originator:biard.romain
Number:rdar://34175587 Date Originated:August 31 2017
Status:open Resolved:
Product:iOS Product Version:11.0 Beta 8
Classification:UIKit Reproducible:always
 
Summary:
We have an HTML5 player (like youtube has). If we embed this player in an WKWebView to be displayed in a UICollectionView with autoplay, we are experiencing an unexpected behaviour (please see the video attached). In a nutshell, on iOS 10.3.3 everything looks fine, but on iOS 11 Beta (15A5368a) and the simulator, if the user stop scrolling in the middle of the cell, and even if we set manually the frame of the WKWebView, it doesn't take it in account and give to our HTML5 player as Container dimensions the visible portion of the UICollectionViewCell.

Steps to Reproduce:
Launch the app on iOS 11.0.
Scroll down through blue, white, red cells.
Until you reached a black cell, a video player should start into it.
Scroll down to hide the player cell.
Scroll up and stop scrolling in the middle of the player cell.

Expected Results:
WKWebView's height should be equal to the manually setup frame

Observed Results:
Depending where the scroll is stopped, WKWebView's frame manually setup is ignored and only visible portion of the cell is taken for layer rendering.(i.e the HTML5 player is then reduced based on this wrong frame)

Version:
iOS 11.0 Developer Preview (Beta) / 15A5368a

Notes:
Please see the video attached for side by side demo iOS 10 vs 11
Sample project also attached for debugging purpose.

Thank you

Configuration:
Does not occur on iOS 10.3.3
Occurs on iOS 11.0

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!