Implement WebPageProxy::windowAndViewFramesChanged.
Created attachment 233656 [details] patch
Comment on attachment 233656 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=233656&action=review > Source/WebKit2/UIProcess/ios/WKContentView.mm:260 > + [self.window addObserver:self forKeyPath:@"frame" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionInitial context:nullptr]; I don't think this works, did you test this?
Comment on attachment 233656 [details] patch lgtm. What was the initial size bug?
Comment on attachment 233656 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=233656&action=review > Source/WebKit2/UIProcess/ios/WKContentView.mm:253 > + // All observations are for bounds changes. > + _page->windowAndViewFramesChanged(self.window.bounds, self.window.bounds.origin); It would be best to assert the keyPath. You may want to call self.window.bounds only once since obj-c dispatch is not cheap.
Why do web pages care about the window frame? Could we give them the WKWebView size instead?
(In reply to comment #5) > Why do web pages care about the window frame? Could we give them the WKWebView size instead? There is no clear specification of what window.outerWidth/height should be on mobile. This matches the usage. One of the problem with reporting WKWebView's size is that some people use outerWidth/height to detect the screen orientation.