Bug 134228 - Implement WebPageProxy::windowAndViewFramesChanged
Summary: Implement WebPageProxy::windowAndViewFramesChanged
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: iPhone / iPad Unspecified
: P2 Normal
Assignee: Martin Hock
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-23 17:03 PDT by Martin Hock
Modified: 2014-06-23 18:39 PDT (History)
4 users (show)

See Also:


Attachments
patch (3.69 KB, patch)
2014-06-23 17:12 PDT, Martin Hock
benjamin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Hock 2014-06-23 17:03:45 PDT
Implement WebPageProxy::windowAndViewFramesChanged.
Comment 1 Martin Hock 2014-06-23 17:12:50 PDT
Created attachment 233656 [details]
patch
Comment 2 Tim Horton 2014-06-23 17:23:55 PDT
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 3 Benjamin Poulain 2014-06-23 17:27:14 PDT
Comment on attachment 233656 [details]
patch

lgtm. What was the initial size bug?
Comment 4 Benjamin Poulain 2014-06-23 17:28:29 PDT
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.
Comment 5 Ian Henderson 2014-06-23 17:32:02 PDT
Why do web pages care about the window frame?  Could we give them the WKWebView size instead?
Comment 6 Benjamin Poulain 2014-06-23 17:57:03 PDT
(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.