[iOS][WK2] Add device orientation
https://bugs.webkit.org/show_bug.cgi?id=133530
Source/WebCore:
Patch by Benjamin Poulain <bpoulain@apple.com> on 2014-06-05
Reviewed by Tim Horton.
Previously, WebCore was getting the orientation directly from the WebKit layer.
This had to be done during the frame creation and was very fragile.
Frame is changed to pull the value from the chrome client. That way we avoid races
and we can maintain a single value for all frames.
Sending the values to all the subframes is aslo done here so that we do not have to repeat
it in both WebKit layers.
* WebCore.exp.in:
* loader/EmptyClients.h:
* page/ChromeClient.h:
* page/Frame.cpp:
(WebCore::Frame::Frame):
(WebCore::Frame::orientationChanged):
(WebCore::Frame::orientation):
(WebCore::Frame::sendOrientationChangeEvent): Deleted.
* page/Frame.h:
(WebCore::Frame::orientation): Deleted.
Source/WebKit/ios:
Patch by Benjamin Poulain <bpoulain@apple.com> on 2014-06-05
Reviewed by Tim Horton.
Change WebKit1 to provide the deviceOrientation as pull instead of push.
* DefaultDelegates/WebDefaultUIKitDelegate.m:
(-[WebDefaultUIKitDelegate deviceOrientation]):
* WebCoreSupport/WebChromeClientIOS.h:
* WebCoreSupport/WebChromeClientIOS.mm:
(WebChromeClientIOS::deviceOrientation):
* WebView/WebUIKitDelegate.h:
Source/WebKit/mac:
Patch by Benjamin Poulain <bpoulain@apple.com> on 2014-06-05
Reviewed by Tim Horton.
* WebView/WebFrame.mm:
(-[WebFrame deviceOrientationChanged]):
(-[WebFrame sendOrientationChangeEvent:]):
* WebView/WebFramePrivate.h:
Source/WebKit2:
<rdar://problem/
16680041>
Patch by Benjamin Poulain <bpoulain@apple.com> on 2014-06-05
Reviewed by Tim Horton.
Add device orientation for WebKit2.
For the public API, WKWebView get the updates through the notification UIWindowDidRotateNotification.
We do not have any control over how the API is used, but we can expect the size will be updated before
the end of rotation in most cases and the events should be sent in the right order.
For Safari, we use an override to support animated resize (and some tabs corner cases).
On the WebProcess side, we just get the new orientation directly or on DynamicViewportSizeUpdate.
* UIProcess/API/Cocoa/WKWebView.mm:
(deviceOrientationForUIInterfaceOrientation):
(deviceOrientation):
(-[WKWebView initWithFrame:configuration:]):
(-[WKWebView _windowDidRotate:]):
(-[WKWebView _setInterfaceOrientationOverride:]):
(-[WKWebView _interfaceOrientationOverride]):
(-[WKWebView _beginAnimatedResizeWithUpdates:]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy):
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::deviceOrientation):
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::dynamicViewportSizeUpdate):
(WebKit::WebPageProxy::setDeviceOrientation):
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
(WebKit::WebChromeClient::deviceOrientation):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::deviceOrientation):
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::setDeviceOrientation):
(WebKit::WebPage::dynamicViewportSizeUpdate):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@169625
268f45cc-cd09-0410-ab3c-
d52691b4dbfc