<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[169625] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/169625">169625</a></dd>
<dt>Author</dt> <dd>benjamin@webkit.org</dd>
<dt>Date</dt> <dd>2014-06-05 14:14:52 -0700 (Thu, 05 Jun 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[iOS][WK2] Add device orientation
https://bugs.webkit.org/show_bug.cgi?id=133530

Source/WebCore: 

Patch by Benjamin Poulain &lt;bpoulain@apple.com&gt; 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 &lt;bpoulain@apple.com&gt; 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 &lt;bpoulain@apple.com&gt; on 2014-06-05
Reviewed by Tim Horton.

* WebView/WebFrame.mm:
(-[WebFrame deviceOrientationChanged]):
(-[WebFrame sendOrientationChangeEvent:]):
* WebView/WebFramePrivate.h:

Source/WebKit2: 
&lt;rdar://problem/16680041&gt;

Patch by Benjamin Poulain &lt;bpoulain@apple.com&gt; 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):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCoreloaderEmptyClientsh">trunk/Source/WebCore/loader/EmptyClients.h</a></li>
<li><a href="#trunkSourceWebCorepageChromeClienth">trunk/Source/WebCore/page/ChromeClient.h</a></li>
<li><a href="#trunkSourceWebCorepageFramecpp">trunk/Source/WebCore/page/Frame.cpp</a></li>
<li><a href="#trunkSourceWebCorepageFrameh">trunk/Source/WebCore/page/Frame.h</a></li>
<li><a href="#trunkSourceWebKitiosChangeLog">trunk/Source/WebKit/ios/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitiosDefaultDelegatesWebDefaultUIKitDelegatem">trunk/Source/WebKit/ios/DefaultDelegates/WebDefaultUIKitDelegate.m</a></li>
<li><a href="#trunkSourceWebKitiosWebCoreSupportWebChromeClientIOSh">trunk/Source/WebKit/ios/WebCoreSupport/WebChromeClientIOS.h</a></li>
<li><a href="#trunkSourceWebKitiosWebCoreSupportWebChromeClientIOSmm">trunk/Source/WebKit/ios/WebCoreSupport/WebChromeClientIOS.mm</a></li>
<li><a href="#trunkSourceWebKitiosWebViewWebUIKitDelegateh">trunk/Source/WebKit/ios/WebView/WebUIKitDelegate.h</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebFramemm">trunk/Source/WebKit/mac/WebView/WebFrame.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebFramePrivateh">trunk/Source/WebKit/mac/WebView/WebFramePrivate.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewPrivateh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxycpp">trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxyh">trunk/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWebPageProxyIOSmm">trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClienth">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportiosWebChromeClientIOSmm">trunk/Source/WebKit2/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagecpp">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPageh">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagemessagesin">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageiosWebPageIOSmm">trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (169624 => 169625)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-06-05 21:10:15 UTC (rev 169624)
+++ trunk/Source/WebCore/ChangeLog        2014-06-05 21:14:52 UTC (rev 169625)
</span><span class="lines">@@ -1,3 +1,30 @@
</span><ins>+2014-06-05  Benjamin Poulain  &lt;bpoulain@apple.com&gt;
+
+        [iOS][WK2] Add device orientation
+        https://bugs.webkit.org/show_bug.cgi?id=133530
+
+        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.
+
</ins><span class="cx"> 2014-06-05  Timothy Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix the !CACHE_SUBIMAGES build
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (169624 => 169625)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-06-05 21:10:15 UTC (rev 169624)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-06-05 21:14:52 UTC (rev 169625)
</span><span class="lines">@@ -3218,7 +3218,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(ORIENTATION_EVENTS)
</span><del>-__ZN7WebCore5Frame26sendOrientationChangeEventEi
</del><ins>+__ZN7WebCore5Frame18orientationChangedEv
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if USE(PLUGIN_HOST_PROCESS)
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderEmptyClientsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/EmptyClients.h (169624 => 169625)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/EmptyClients.h        2014-06-05 21:10:15 UTC (rev 169624)
+++ trunk/Source/WebCore/loader/EmptyClients.h        2014-06-05 21:14:52 UTC (rev 169625)
</span><span class="lines">@@ -214,6 +214,10 @@
</span><span class="cx">     virtual void showPlaybackTargetPicker(bool) override { };
</span><span class="cx"> #endif // PLATFORM(IOS)
</span><span class="cx"> 
</span><ins>+#if ENABLE(ORIENTATION_EVENTS)
+    virtual int deviceOrientation() const override { return 0; }
+#endif
+
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     virtual bool isStopping() override { return false; }
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCorepageChromeClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/ChromeClient.h (169624 => 169625)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/ChromeClient.h        2014-06-05 21:10:15 UTC (rev 169624)
+++ trunk/Source/WebCore/page/ChromeClient.h        2014-06-05 21:14:52 UTC (rev 169625)
</span><span class="lines">@@ -266,6 +266,10 @@
</span><span class="cx">     virtual void showPlaybackTargetPicker(bool hasVideo) = 0;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(ORIENTATION_EVENTS)
+    virtual int deviceOrientation() const = 0;
+#endif
+
</ins><span class="cx"> #if ENABLE(INPUT_TYPE_COLOR)
</span><span class="cx">     virtual PassOwnPtr&lt;ColorChooser&gt; createColorChooser(ColorChooserClient*, const Color&amp;) = 0;
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCorepageFramecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Frame.cpp (169624 => 169625)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Frame.cpp        2014-06-05 21:10:15 UTC (rev 169624)
+++ trunk/Source/WebCore/page/Frame.cpp        2014-06-05 21:14:52 UTC (rev 169625)
</span><span class="lines">@@ -167,9 +167,6 @@
</span><span class="cx"> #endif
</span><span class="cx">     , m_pageZoomFactor(parentPageZoomFactor(this))
</span><span class="cx">     , m_textZoomFactor(parentTextZoomFactor(this))
</span><del>-#if ENABLE(ORIENTATION_EVENTS)
-    , m_orientation(0)
-#endif
</del><span class="cx">     , m_activeDOMObjectsAndAnimationsSuspendedCount(0)
</span><span class="cx"> {
</span><span class="cx">     AtomicString::init();
</span><span class="lines">@@ -288,12 +285,24 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(ORIENTATION_EVENTS)
</span><del>-void Frame::sendOrientationChangeEvent(int orientation)
</del><ins>+void Frame::orientationChanged()
</ins><span class="cx"> {
</span><del>-    m_orientation = orientation;
-    if (Document* doc = document())
-        doc-&gt;dispatchWindowEvent(Event::create(eventNames().orientationchangeEvent, false, false));
</del><ins>+    Vector&lt;Ref&lt;Frame&gt;&gt; frames;
+    for (Frame* frame = this; frame; frame = frame-&gt;tree().traverseNext())
+        frames.append(*frame);
+
+    for (unsigned i = 0; i &lt; frames.size(); i++) {
+        if (Document* doc = frames[i]-&gt;document())
+            doc-&gt;dispatchWindowEvent(Event::create(eventNames().orientationchangeEvent, false, false));
+    }
</ins><span class="cx"> }
</span><ins>+
+int Frame::orientation() const
+{
+    if (m_page)
+        return m_page-&gt;chrome().client().deviceOrientation();
+    return 0;
+}
</ins><span class="cx"> #endif // ENABLE(ORIENTATION_EVENTS)
</span><span class="cx"> 
</span><span class="cx"> static JSC::Yarr::RegularExpression createRegExpForLabels(const Vector&lt;String&gt;&amp; labels)
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Frame.h (169624 => 169625)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Frame.h        2014-06-05 21:10:15 UTC (rev 169624)
+++ trunk/Source/WebCore/page/Frame.h        2014-06-05 21:14:52 UTC (rev 169625)
</span><span class="lines">@@ -214,8 +214,8 @@
</span><span class="cx">         // Orientation is the interface orientation in degrees. Some examples are:
</span><span class="cx">         //  0 is straight up; -90 is when the device is rotated 90 clockwise;
</span><span class="cx">         //  90 is when rotated counter clockwise.
</span><del>-        void sendOrientationChangeEvent(int orientation);
-        int orientation() const { return m_orientation; }
</del><ins>+        void orientationChanged();
+        int orientation() const;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">         void clearTimers();
</span><span class="lines">@@ -314,10 +314,6 @@
</span><span class="cx">         float m_pageZoomFactor;
</span><span class="cx">         float m_textZoomFactor;
</span><span class="cx"> 
</span><del>-#if ENABLE(ORIENTATION_EVENTS)
-        int m_orientation;
-#endif
-
</del><span class="cx">         int m_activeDOMObjectsAndAnimationsSuspendedCount;
</span><span class="cx">     };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitiosChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ios/ChangeLog (169624 => 169625)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ios/ChangeLog        2014-06-05 21:10:15 UTC (rev 169624)
+++ trunk/Source/WebKit/ios/ChangeLog        2014-06-05 21:14:52 UTC (rev 169625)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2014-06-05  Benjamin Poulain  &lt;bpoulain@apple.com&gt;
+
+        [iOS][WK2] Add device orientation
+        https://bugs.webkit.org/show_bug.cgi?id=133530
+
+        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:
+
</ins><span class="cx"> 2014-05-09  Benjamin Poulain  &lt;benjamin@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         [iOS] Switch geolocation to an explicit authorization query model
</span></span></pre></div>
<a id="trunkSourceWebKitiosDefaultDelegatesWebDefaultUIKitDelegatem"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ios/DefaultDelegates/WebDefaultUIKitDelegate.m (169624 => 169625)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ios/DefaultDelegates/WebDefaultUIKitDelegate.m        2014-06-05 21:10:15 UTC (rev 169624)
+++ trunk/Source/WebKit/ios/DefaultDelegates/WebDefaultUIKitDelegate.m        2014-06-05 21:14:52 UTC (rev 169625)
</span><span class="lines">@@ -245,6 +245,13 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(ORIENTATION_EVENTS)
+- (int)deviceOrientation
+{
+    return 0;
+}
+#endif
+
</ins><span class="cx"> - (BOOL)hasRichlyEditableSelection
</span><span class="cx"> {
</span><span class="cx">     return NO;
</span></span></pre></div>
<a id="trunkSourceWebKitiosWebCoreSupportWebChromeClientIOSh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ios/WebCoreSupport/WebChromeClientIOS.h (169624 => 169625)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ios/WebCoreSupport/WebChromeClientIOS.h        2014-06-05 21:10:15 UTC (rev 169624)
+++ trunk/Source/WebKit/ios/WebCoreSupport/WebChromeClientIOS.h        2014-06-05 21:14:52 UTC (rev 169625)
</span><span class="lines">@@ -86,6 +86,10 @@
</span><span class="cx">     virtual void focusedElementChanged(WebCore::Element*) override;
</span><span class="cx">     virtual void showPlaybackTargetPicker(bool hasVideo) override;
</span><span class="cx"> 
</span><ins>+#if ENABLE(ORIENTATION_EVENTS)
+    virtual int deviceOrientation() const override;
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx">     int m_formNotificationSuppressions;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebKitiosWebCoreSupportWebChromeClientIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ios/WebCoreSupport/WebChromeClientIOS.mm (169624 => 169625)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ios/WebCoreSupport/WebChromeClientIOS.mm        2014-06-05 21:10:15 UTC (rev 169624)
+++ trunk/Source/WebKit/ios/WebCoreSupport/WebChromeClientIOS.mm        2014-06-05 21:14:52 UTC (rev 169625)
</span><span class="lines">@@ -328,4 +328,11 @@
</span><span class="cx">     [[webView() _UIKitDelegateForwarder] showPlaybackTargetPicker:hasVideo fromRect:elementRect];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(ORIENTATION_EVENTS)
+int WebChromeClientIOS::deviceOrientation() const
+{
+    return [[webView() _UIKitDelegateForwarder] deviceOrientation];
+}
+#endif
+
</ins><span class="cx"> #endif // PLATFORM(IOS)
</span></span></pre></div>
<a id="trunkSourceWebKitiosWebViewWebUIKitDelegateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ios/WebView/WebUIKitDelegate.h (169624 => 169625)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ios/WebView/WebUIKitDelegate.h        2014-06-05 21:10:15 UTC (rev 169624)
+++ trunk/Source/WebKit/ios/WebView/WebUIKitDelegate.h        2014-06-05 21:14:52 UTC (rev 169625)
</span><span class="lines">@@ -111,6 +111,10 @@
</span><span class="cx"> - (CGPoint)interactionLocation;
</span><span class="cx"> - (void)showPlaybackTargetPicker:(BOOL)hasVideo fromRect:(CGRect)elementRect;
</span><span class="cx"> 
</span><ins>+#if ENABLE(ORIENTATION_EVENTS)
+- (int)deviceOrientation;
+#endif
+
</ins><span class="cx"> - (BOOL)isUnperturbedDictationResultMarker:(id)metadataForMarker;
</span><span class="cx"> - (void)webView:(WebView *)webView addMessageToConsole:(NSDictionary *)message withSource:(NSString *)source;
</span><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (169624 => 169625)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2014-06-05 21:10:15 UTC (rev 169624)
+++ trunk/Source/WebKit/mac/ChangeLog        2014-06-05 21:14:52 UTC (rev 169625)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2014-06-05  Benjamin Poulain  &lt;bpoulain@apple.com&gt;
+
+        [iOS][WK2] Add device orientation
+        https://bugs.webkit.org/show_bug.cgi?id=133530
+
+        Reviewed by Tim Horton.
+
+        * WebView/WebFrame.mm:
+        (-[WebFrame deviceOrientationChanged]):
+        (-[WebFrame sendOrientationChangeEvent:]):
+        * WebView/WebFramePrivate.h:
+
</ins><span class="cx"> 2014-05-31  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Change DeferrableOneShotTimer to use std::function instead of being a class template
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebFramemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebFrame.mm (169624 => 169625)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebFrame.mm        2014-06-05 21:10:15 UTC (rev 169624)
+++ trunk/Source/WebKit/mac/WebView/WebFrame.mm        2014-06-05 21:14:52 UTC (rev 169625)
</span><span class="lines">@@ -1267,15 +1267,19 @@
</span><span class="cx">     frameLoader.client().saveViewStateToItem(frameLoader.history().currentItem());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)sendOrientationChangeEvent:(int)newOrientation
</del><ins>+- (void)deviceOrientationChanged
</ins><span class="cx"> {
</span><span class="cx">     WebThreadRun(^{
</span><del>-        WebCore::Frame *frame = core(self);
-        if (frame)
-            frame-&gt;sendOrientationChangeEvent(newOrientation);
</del><ins>+        if (WebCore::Frame* frame = core(self))
+            frame-&gt;orientationChanged();
</ins><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)sendOrientationChangeEvent:(int)newOrientation
+{
+    [self deviceOrientationChanged];
+}
+
</ins><span class="cx"> - (void)setNeedsLayout
</span><span class="cx"> {
</span><span class="cx">     WebCore::Frame *frame = core(self);
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebFramePrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebFramePrivate.h (169624 => 169625)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebFramePrivate.h        2014-06-05 21:10:15 UTC (rev 169624)
+++ trunk/Source/WebKit/mac/WebView/WebFramePrivate.h        2014-06-05 21:14:52 UTC (rev 169625)
</span><span class="lines">@@ -118,7 +118,11 @@
</span><span class="cx"> - (void)_setSelectionFromNone;
</span><span class="cx"> - (void)_saveViewState;
</span><span class="cx"> - (void)_restoreViewState;
</span><ins>+
+- (void)deviceOrientationChanged;
+// FIXME: deprecated, to be removed after the call sites are updated.
</ins><span class="cx"> - (void)sendOrientationChangeEvent:(int)newOrientation;
</span><ins>+
</ins><span class="cx"> - (void)setNeedsLayout;
</span><span class="cx"> - (CGSize)renderedSizeOfNode:(DOMNode *)node constrainedToWidth:(float)width;
</span><span class="cx"> - (DOMNode *)deepestNodeAtViewportLocation:(CGPoint)aViewportLocation;
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (169624 => 169625)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-06-05 21:10:15 UTC (rev 169624)
+++ trunk/Source/WebKit2/ChangeLog        2014-06-05 21:14:52 UTC (rev 169625)
</span><span class="lines">@@ -1,3 +1,49 @@
</span><ins>+2014-06-05  Benjamin Poulain  &lt;bpoulain@apple.com&gt;
+
+        [iOS][WK2] Add device orientation
+        https://bugs.webkit.org/show_bug.cgi?id=133530
+        &lt;rdar://problem/16680041&gt;
+
+        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):
+
</ins><span class="cx"> 2014-06-05  Oliver Hunt  &lt;oliver@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Enable SANDBOX_EXTENSIONS build flag universally on cocoa
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (169624 => 169625)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2014-06-05 21:10:15 UTC (rev 169624)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2014-06-05 21:14:52 UTC (rev 169625)
</span><span class="lines">@@ -81,6 +81,7 @@
</span><span class="cx"> #import &lt;CoreGraphics/CGPDFDocumentPrivate.h&gt;
</span><span class="cx"> #import &lt;UIKit/UIApplication.h&gt;
</span><span class="cx"> #import &lt;UIKit/UIPeripheralHost_Private.h&gt;
</span><ins>+#import &lt;UIKit/UIWindow_Private.h&gt;
</ins><span class="cx"> #import &lt;QuartzCore/CARenderServer.h&gt;
</span><span class="cx"> #import &lt;QuartzCore/QuartzCorePrivate.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -150,6 +151,9 @@
</span><span class="cx">     UIEdgeInsets _obscuredInsets;
</span><span class="cx">     bool _isChangingObscuredInsetsInteractively;
</span><span class="cx"> 
</span><ins>+    UIInterfaceOrientation _interfaceOrientationOverride;
+    BOOL _overridesInterfaceOrientation;
+
</ins><span class="cx">     BOOL _needsResetViewStateAfterCommitLoadForMainFrame;
</span><span class="cx">     BOOL _isAnimatingResize;
</span><span class="cx">     CATransform3D _resizeAnimationTransformAdjustments;
</span><span class="lines">@@ -180,6 +184,28 @@
</span><span class="cx">     return [self initWithFrame:frame configuration:adoptNS([[WKWebViewConfiguration alloc] init]).get()];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+static int32_t deviceOrientationForUIInterfaceOrientation(UIInterfaceOrientation orientation)
+{
+    switch (orientation) {
+    case UIInterfaceOrientationUnknown:
+    case UIInterfaceOrientationPortrait:
+        return 0;
+    case UIInterfaceOrientationPortraitUpsideDown:
+        return 180;
+    case UIInterfaceOrientationLandscapeLeft:
+        return -90;
+    case UIInterfaceOrientationLandscapeRight:
+        return 90;
+    }
+}
+
+static int32_t deviceOrientation()
+{
+    return deviceOrientationForUIInterfaceOrientation([[UIApplication sharedApplication] statusBarOrientation]);
+}
+#endif
+
</ins><span class="cx"> - (instancetype)initWithFrame:(CGRect)frame configuration:(WKWebViewConfiguration *)configuration
</span><span class="cx"> {
</span><span class="cx">     if (!(self = [super initWithFrame:frame]))
</span><span class="lines">@@ -228,6 +254,9 @@
</span><span class="cx"> 
</span><span class="cx">     _contentView = adoptNS([[WKContentView alloc] initWithFrame:bounds context:context configuration:std::move(webPageConfiguration) webView:self]);
</span><span class="cx">     _page = [_contentView page];
</span><ins>+
+    _page-&gt;setDeviceOrientation(deviceOrientation());
+
</ins><span class="cx">     [_contentView layer].anchorPoint = CGPointZero;
</span><span class="cx">     [_contentView setFrame:bounds];
</span><span class="cx">     [_scrollView addSubview:_contentView.get()];
</span><span class="lines">@@ -240,6 +269,7 @@
</span><span class="cx">     [center addObserver:self selector:@selector(_keyboardDidChangeFrame:) name:UIKeyboardDidChangeFrameNotification object:nil];
</span><span class="cx">     [center addObserver:self selector:@selector(_keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
</span><span class="cx">     [center addObserver:self selector:@selector(_keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
</span><ins>+    [center addObserver:self selector:@selector(_windowDidRotate:) name:UIWindowDidRotateNotification object:nil];
</ins><span class="cx">     [center addObserver:self selector:@selector(_contentSizeCategoryDidChange:) name:UIContentSizeCategoryDidChangeNotification object:nil];
</span><span class="cx">     _page-&gt;contentSizeCategoryDidChange([self _contentSizeCategory]);
</span><span class="cx"> 
</span><span class="lines">@@ -1136,6 +1166,12 @@
</span><span class="cx">     [self _keyboardChangedWithInfo:notification.userInfo adjustScrollView:YES];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)_windowDidRotate:(NSNotification *)notification
+{
+    if (!_overridesInterfaceOrientation)
+        _page-&gt;setDeviceOrientation(deviceOrientation());
+}
+
</ins><span class="cx"> - (void)_contentSizeCategoryDidChange:(NSNotification *)notification
</span><span class="cx"> {
</span><span class="cx">     _page-&gt;contentSizeCategoryDidChange([self _contentSizeCategory]);
</span><span class="lines">@@ -1686,6 +1722,28 @@
</span><span class="cx">     [_customContentView web_setObscuredInsets:obscuredInsets];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)_setInterfaceOrientationOverride:(UIInterfaceOrientation)interfaceOrientation
+{
+    if (!_overridesInterfaceOrientation)
+        [[NSNotificationCenter defaultCenter] removeObserver:self name:UIWindowDidRotateNotification object:nil];
+
+    _overridesInterfaceOrientation = YES;
+
+    if (interfaceOrientation == _interfaceOrientationOverride)
+        return;
+
+    _interfaceOrientationOverride = interfaceOrientation;
+
+    if (!_isAnimatingResize)
+        _page-&gt;setDeviceOrientation(deviceOrientationForUIInterfaceOrientation(_interfaceOrientationOverride));
+}
+
+- (UIInterfaceOrientation)_interfaceOrientationOverride
+{
+    ASSERT(_overridesInterfaceOrientation);
+    return _interfaceOrientationOverride;
+}
+
</ins><span class="cx"> - (CGSize)_maximumUnobscuredSizeOverride
</span><span class="cx"> {
</span><span class="cx">     ASSERT(_overridesMaximumUnobscuredSize);
</span><span class="lines">@@ -1806,7 +1864,13 @@
</span><span class="cx">     if (_overridesMaximumUnobscuredSize)
</span><span class="cx">         maximumUnobscuredSize = _maximumUnobscuredSizeOverride;
</span><span class="cx"> 
</span><del>-    _page-&gt;dynamicViewportSizeUpdate(WebCore::FloatSize(minimumLayoutSize), WebCore::FloatSize(minimumLayoutSizeForMinimalUI), WebCore::FloatSize(maximumUnobscuredSize), visibleRectInContentCoordinates, unobscuredRectInContentCoordinates, futureUnobscuredRectInSelfCoordinates, targetScale);
</del><ins>+    int32_t orientation;
+    if (_overridesInterfaceOrientation)
+        orientation = deviceOrientationForUIInterfaceOrientation(_interfaceOrientationOverride);
+    else
+        orientation = _page-&gt;deviceOrientation();
+
+    _page-&gt;dynamicViewportSizeUpdate(WebCore::FloatSize(minimumLayoutSize), WebCore::FloatSize(minimumLayoutSizeForMinimalUI), WebCore::FloatSize(maximumUnobscuredSize), visibleRectInContentCoordinates, unobscuredRectInContentCoordinates, futureUnobscuredRectInSelfCoordinates, targetScale, orientation);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)_endAnimatedResize
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h (169624 => 169625)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h        2014-06-05 21:10:15 UTC (rev 169624)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h        2014-06-05 21:14:52 UTC (rev 169625)
</span><span class="lines">@@ -108,6 +108,10 @@
</span><span class="cx"> // Define the inset of the scrollview unusable by the web page.
</span><span class="cx"> @property (nonatomic, setter=_setObscuredInsets:) UIEdgeInsets _obscuredInsets;
</span><span class="cx"> 
</span><ins>+// Override the interface orientation. Clients using _beginAnimatedResizeWithUpdates: must update the interface orientation
+// in the update block.
+@property (nonatomic, setter=_setInterfaceOrientationOverride:) UIInterfaceOrientation _interfaceOrientationOverride;
+
</ins><span class="cx"> @property (nonatomic, setter=_setBackgroundExtendsBeyondPage:) BOOL _backgroundExtendsBeyondPage;
</span><span class="cx"> 
</span><span class="cx"> // FIXME: Remove these three properties once we expose WKWebViewContentProvider as API.
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (169624 => 169625)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-06-05 21:10:15 UTC (rev 169624)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-06-05 21:14:52 UTC (rev 169625)
</span><span class="lines">@@ -273,6 +273,7 @@
</span><span class="cx">     , m_mainFrame(nullptr)
</span><span class="cx">     , m_userAgent(standardUserAgent())
</span><span class="cx"> #if PLATFORM(IOS)
</span><ins>+    , m_deviceOrientation(0)
</ins><span class="cx">     , m_dynamicViewportSizeUpdateInProgress(false)
</span><span class="cx"> #endif
</span><span class="cx">     , m_geolocationPermissionRequestManager(*this)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (169624 => 169625)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-06-05 21:10:15 UTC (rev 169624)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-06-05 21:14:52 UTC (rev 169625)
</span><span class="lines">@@ -595,12 +595,14 @@
</span><span class="cx">     enum class UnobscuredRectConstraint { ConstrainedToDocumentRect, Unconstrained };
</span><span class="cx">     WebCore::FloatRect computeCustomFixedPositionRect(const WebCore::FloatRect&amp; unobscuredContentRect, double displayedContentScale, UnobscuredRectConstraint = UnobscuredRectConstraint::Unconstrained) const;
</span><span class="cx"> 
</span><del>-    void dynamicViewportSizeUpdate(const WebCore::FloatSize&amp; minimumLayoutSize, const WebCore::FloatSize&amp; minimumLayoutSizeForMinimalUI, const WebCore::FloatSize&amp; maximumUnobscuredSize, const WebCore::FloatRect&amp; targetExposedContentRect, const WebCore::FloatRect&amp; targetUnobscuredRect, const WebCore::FloatRect&amp; targetUnobscuredRectInScrollViewCoordinates, double targetScale);
</del><ins>+    void dynamicViewportSizeUpdate(const WebCore::FloatSize&amp; minimumLayoutSize, const WebCore::FloatSize&amp; minimumLayoutSizeForMinimalUI, const WebCore::FloatSize&amp; maximumUnobscuredSize, const WebCore::FloatRect&amp; targetExposedContentRect, const WebCore::FloatRect&amp; targetUnobscuredRect, const WebCore::FloatRect&amp; targetUnobscuredRectInScrollViewCoordinates, double targetScale, int32_t deviceOrientation);
</ins><span class="cx">     void synchronizeDynamicViewportUpdate();
</span><span class="cx"> 
</span><span class="cx">     void setViewportConfigurationMinimumLayoutSize(const WebCore::FloatSize&amp;);
</span><span class="cx">     void setViewportConfigurationMinimumLayoutSizeForMinimalUI(const WebCore::FloatSize&amp;);
</span><span class="cx">     void setMaximumUnobscuredSize(const WebCore::FloatSize&amp;);
</span><ins>+    void setDeviceOrientation(int32_t);
+    int32_t deviceOrientation() const { return m_deviceOrientation; }
</ins><span class="cx">     void didCommitLayerTree(const WebKit::RemoteLayerTreeTransaction&amp;);
</span><span class="cx"> 
</span><span class="cx">     void selectWithGesture(const WebCore::IntPoint, WebCore::TextGranularity, uint32_t gestureType, uint32_t gestureState, PassRefPtr&lt;GestureCallback&gt;);
</span><span class="lines">@@ -1490,6 +1492,7 @@
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     RefPtr&lt;WebVideoFullscreenManagerProxy&gt; m_videoFullscreenManager;
</span><span class="cx">     VisibleContentRectUpdateInfo m_lastVisibleContentRectUpdate;
</span><ins>+    int32_t m_deviceOrientation;
</ins><span class="cx">     bool m_dynamicViewportSizeUpdateInProgress;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWebPageProxyIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm (169624 => 169625)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm        2014-06-05 21:10:15 UTC (rev 169624)
+++ trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm        2014-06-05 21:14:52 UTC (rev 169625)
</span><span class="lines">@@ -236,10 +236,10 @@
</span><span class="cx">     return FrameView::rectForViewportConstrainedObjects(enclosingLayoutRect(constrainedUnobscuredRect), roundedLayoutSize(contentsSize), displayedContentScale, false, StickToViewportBounds);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPageProxy::dynamicViewportSizeUpdate(const FloatSize&amp; minimumLayoutSize, const WebCore::FloatSize&amp; minimumLayoutSizeForMinimalUI, const WebCore::FloatSize&amp; maximumUnobscuredSize, const FloatRect&amp; targetExposedContentRect, const FloatRect&amp; targetUnobscuredRect, const FloatRect&amp; targetUnobscuredRectInScrollViewCoordinates,  double targetScale)
</del><ins>+void WebPageProxy::dynamicViewportSizeUpdate(const FloatSize&amp; minimumLayoutSize, const WebCore::FloatSize&amp; minimumLayoutSizeForMinimalUI, const WebCore::FloatSize&amp; maximumUnobscuredSize, const FloatRect&amp; targetExposedContentRect, const FloatRect&amp; targetUnobscuredRect, const FloatRect&amp; targetUnobscuredRectInScrollViewCoordinates,  double targetScale, int32_t deviceOrientation)
</ins><span class="cx"> {
</span><span class="cx">     m_dynamicViewportSizeUpdateInProgress = true;
</span><del>-    m_process-&gt;send(Messages::WebPage::DynamicViewportSizeUpdate(minimumLayoutSize, minimumLayoutSizeForMinimalUI, maximumUnobscuredSize, targetExposedContentRect, targetUnobscuredRect, targetUnobscuredRectInScrollViewCoordinates, targetScale), m_pageID);
</del><ins>+    m_process-&gt;send(Messages::WebPage::DynamicViewportSizeUpdate(minimumLayoutSize, minimumLayoutSizeForMinimalUI, maximumUnobscuredSize, targetExposedContentRect, targetUnobscuredRect, targetUnobscuredRectInScrollViewCoordinates, targetScale, deviceOrientation), m_pageID);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPageProxy::synchronizeDynamicViewportUpdate()
</span><span class="lines">@@ -282,6 +282,15 @@
</span><span class="cx">     m_process-&gt;send(Messages::WebPage::SetMaximumUnobscuredSize(size), m_pageID);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebPageProxy::setDeviceOrientation(int32_t deviceOrientation)
+{
+    if (deviceOrientation != m_deviceOrientation) {
+        m_deviceOrientation = deviceOrientation;
+        if (isValid())
+            m_process-&gt;send(Messages::WebPage::SetDeviceOrientation(deviceOrientation), m_pageID);
+    }
+}
+
</ins><span class="cx"> void WebPageProxy::didCommitLayerTree(const WebKit::RemoteLayerTreeTransaction&amp; layerTreeTransaction)
</span><span class="cx"> {
</span><span class="cx">     m_pageExtendedBackgroundColor = layerTreeTransaction.pageExtendedBackgroundColor();
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h (169624 => 169625)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h        2014-06-05 21:10:15 UTC (rev 169624)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h        2014-06-05 21:14:52 UTC (rev 169625)
</span><span class="lines">@@ -182,6 +182,10 @@
</span><span class="cx">     virtual void showPlaybackTargetPicker(bool hasVideo) override;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(ORIENTATION_EVENTS)
+    virtual int deviceOrientation() const override;
+#endif
+
</ins><span class="cx">     virtual void runOpenPanel(WebCore::Frame*, PassRefPtr&lt;WebCore::FileChooser&gt;) override;
</span><span class="cx">     virtual void loadIconForFiles(const Vector&lt;String&gt;&amp;, WebCore::FileIconLoader*) override;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportiosWebChromeClientIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm (169624 => 169625)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm        2014-06-05 21:10:15 UTC (rev 169624)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm        2014-06-05 21:14:52 UTC (rev 169625)
</span><span class="lines">@@ -129,6 +129,11 @@
</span><span class="cx">     m_page-&gt;send(Messages::WebPageProxy::ShowPlaybackTargetPicker(hasVideo, m_page-&gt;rectForElementAtInteractionLocation()));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+int WebChromeClient::deviceOrientation() const
+{
+    return m_page-&gt;deviceOrientation();
+}
+
</ins><span class="cx"> } // namespace WebKit
</span><span class="cx"> 
</span><span class="cx"> #endif // PLATFORM(IOS)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (169624 => 169625)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-06-05 21:10:15 UTC (rev 169624)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-06-05 21:14:52 UTC (rev 169625)
</span><span class="lines">@@ -301,6 +301,7 @@
</span><span class="cx">     , m_hasPendingBlurNotification(false)
</span><span class="cx">     , m_screenSize(parameters.screenSize)
</span><span class="cx">     , m_availableScreenSize(parameters.availableScreenSize)
</span><ins>+    , m_deviceOrientation(0)
</ins><span class="cx">     , m_inDynamicSizeUpdate(false)
</span><span class="cx"> #endif
</span><span class="cx">     , m_inspectorClient(0)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (169624 => 169625)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-06-05 21:10:15 UTC (rev 169624)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-06-05 21:14:52 UTC (rev 169625)
</span><span class="lines">@@ -451,6 +451,7 @@
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     WebCore::FloatSize screenSize() const;
</span><span class="cx">     WebCore::FloatSize availableScreenSize() const;
</span><ins>+    int32_t deviceOrientation() const { return m_deviceOrientation; }
</ins><span class="cx">     void viewportPropertiesDidChange(const WebCore::ViewportArguments&amp;);
</span><span class="cx">     void didReceiveMobileDocType(bool);
</span><span class="cx">     void restorePageState(double scale, bool userHasChangedPageScaleFactor, const WebCore::IntPoint&amp; exposedOrigin);
</span><span class="lines">@@ -724,7 +725,8 @@
</span><span class="cx">     void setViewportConfigurationMinimumLayoutSize(const WebCore::FloatSize&amp;);
</span><span class="cx">     void setViewportConfigurationMinimumLayoutSizeForMinimalUI(const WebCore::FloatSize&amp;);
</span><span class="cx">     void setMaximumUnobscuredSize(const WebCore::FloatSize&amp;);
</span><del>-    void dynamicViewportSizeUpdate(const WebCore::FloatSize&amp; minimumLayoutSize, const WebCore::FloatSize&amp; minimumLayoutSizeForMinimalUI, const WebCore::FloatSize&amp; maximumUnobscuredSize, const WebCore::FloatRect&amp; targetExposedContentRect, const WebCore::FloatRect&amp; targetUnobscuredRect, const WebCore::FloatRect&amp; targetUnobscuredRectInScrollViewCoordinates, double scale);
</del><ins>+    void setDeviceOrientation(int32_t);
+    void dynamicViewportSizeUpdate(const WebCore::FloatSize&amp; minimumLayoutSize, const WebCore::FloatSize&amp; minimumLayoutSizeForMinimalUI, const WebCore::FloatSize&amp; maximumUnobscuredSize, const WebCore::FloatRect&amp; targetExposedContentRect, const WebCore::FloatRect&amp; targetUnobscuredRect, const WebCore::FloatRect&amp; targetUnobscuredRectInScrollViewCoordinates, double scale, int32_t deviceOrientation);
</ins><span class="cx">     void synchronizeDynamicViewportUpdate(double&amp; newTargetScale, WebCore::FloatPoint&amp; newScrollPosition);
</span><span class="cx">     void updateVisibleContentRects(const VisibleContentRectUpdateInfo&amp;);
</span><span class="cx">     bool scaleWasSetByUIProcess() const { return m_scaleWasSetByUIProcess; }
</span><span class="lines">@@ -1218,6 +1220,7 @@
</span><span class="cx">     RefPtr&lt;WebCore::Range&gt; m_currentBlockSelection;
</span><span class="cx">     WebCore::IntSize m_blockSelectionDesiredSize;
</span><span class="cx">     WebCore::FloatSize m_maximumUnobscuredSize;
</span><ins>+    int32_t m_deviceOrientation;
</ins><span class="cx">     bool m_inDynamicSizeUpdate;
</span><span class="cx">     HashMap&lt;std::pair&lt;WebCore::IntSize, double&gt;, WebCore::IntPoint&gt; m_dynamicSizeUpdateHistory;
</span><span class="cx">     RefPtr&lt;WebCore::Node&gt; m_pendingSyntheticClickNode;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagemessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (169624 => 169625)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in        2014-06-05 21:10:15 UTC (rev 169624)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in        2014-06-05 21:14:52 UTC (rev 169625)
</span><span class="lines">@@ -46,7 +46,8 @@
</span><span class="cx">     SetViewportConfigurationMinimumLayoutSize(WebCore::FloatSize size)
</span><span class="cx">     SetViewportConfigurationMinimumLayoutSizeForMinimalUI(WebCore::FloatSize size)
</span><span class="cx">     SetMaximumUnobscuredSize(WebCore::FloatSize size)
</span><del>-    DynamicViewportSizeUpdate(WebCore::FloatSize minimumLayoutSize, WebCore::FloatSize minimumLayoutSizeForMinimalUI,  WebCore::FloatSize maximumUnobscuredSize, WebCore::FloatRect targetExposedContentRect, WebCore::FloatRect targetUnobscuredRect, WebCore::FloatRect targetUnobscuredRectInScrollViewCoordinates, double scale)
</del><ins>+    SetDeviceOrientation(int32_t deviceOrientation)
+    DynamicViewportSizeUpdate(WebCore::FloatSize minimumLayoutSize, WebCore::FloatSize minimumLayoutSizeForMinimalUI,  WebCore::FloatSize maximumUnobscuredSize, WebCore::FloatRect targetExposedContentRect, WebCore::FloatRect targetUnobscuredRect, WebCore::FloatRect targetUnobscuredRectInScrollViewCoordinates, double scale, int32_t deviceOrientation)
</ins><span class="cx">     SynchronizeDynamicViewportUpdate() -&gt; (double newTargetScale, WebCore::FloatPoint newScrollPosition)
</span><span class="cx"> 
</span><span class="cx">     HandleTap(WebCore::IntPoint point)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageiosWebPageIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (169624 => 169625)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm        2014-06-05 21:10:15 UTC (rev 169624)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm        2014-06-05 21:14:52 UTC (rev 169625)
</span><span class="lines">@@ -1957,6 +1957,14 @@
</span><span class="cx">     updateViewportSizeForCSSViewportUnits();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebPage::setDeviceOrientation(int32_t deviceOrientation)
+{
+    if (deviceOrientation == m_deviceOrientation)
+        return;
+    m_deviceOrientation = deviceOrientation;
+    m_page-&gt;mainFrame().orientationChanged();
+}
+
</ins><span class="cx"> static inline bool withinEpsilon(float a, float b)
</span><span class="cx"> {
</span><span class="cx">     return fabs(a - b) &lt; std::numeric_limits&lt;float&gt;::epsilon();
</span><span class="lines">@@ -1975,7 +1983,7 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPage::dynamicViewportSizeUpdate(const FloatSize&amp; minimumLayoutSize, const FloatSize&amp; minimumLayoutSizeForMinimalUI, const WebCore::FloatSize&amp; maximumUnobscuredSize, const FloatRect&amp; targetExposedContentRect, const FloatRect&amp; targetUnobscuredRect, const WebCore::FloatRect&amp; targetUnobscuredRectInScrollViewCoordinates, double targetScale)
</del><ins>+void WebPage::dynamicViewportSizeUpdate(const FloatSize&amp; minimumLayoutSize, const FloatSize&amp; minimumLayoutSizeForMinimalUI, const WebCore::FloatSize&amp; maximumUnobscuredSize, const FloatRect&amp; targetExposedContentRect, const FloatRect&amp; targetUnobscuredRect, const WebCore::FloatRect&amp; targetUnobscuredRectInScrollViewCoordinates, double targetScale, int32_t deviceOrientation)
</ins><span class="cx"> {
</span><span class="cx">     TemporaryChange&lt;bool&gt; dynamicSizeUpdateGuard(m_inDynamicSizeUpdate, true);
</span><span class="cx">     // FIXME: this does not handle the cases where the content would change the content size or scroll position from JavaScript.
</span><span class="lines">@@ -2157,6 +2165,7 @@
</span><span class="cx">     FloatSize unobscuredContentRectSizeInContentCoordinates = newUnobscuredContentRect.size();
</span><span class="cx">     unobscuredContentRectSizeInContentCoordinates.scale(scale);
</span><span class="cx">     frameView.setCustomSizeForResizeEvent(expandedIntSize(unobscuredContentRectSizeInContentCoordinates));
</span><ins>+    setDeviceOrientation(deviceOrientation);
</ins><span class="cx">     frameView.setScrollOffset(roundedUnobscuredContentRect.location());
</span><span class="cx"> 
</span><span class="cx">     send(Messages::WebPageProxy::DynamicViewportUpdateChangedTarget(pageScaleFactor(), frameView.scrollPosition()));
</span></span></pre>
</div>
</div>

</body>
</html>