<!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>[171345] 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/171345">171345</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-07-22 10:19:21 -0700 (Tue, 22 Jul 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Don't create new UIWindow for video fullscreen.
https://bugs.webkit.org/show_bug.cgi?id=135038

Patch by Jeremy Jones &lt;jeremyj@apple.com&gt; on 2014-07-22
Reviewed by Darin Adler.

Source/WebCore:
* WebCore.exp.in:
* platform/ios/WebVideoFullscreenControllerAVKit.h: use UIView instead of UIScreen.
* platform/ios/WebVideoFullscreenControllerAVKit.mm:
(-[WebVideoFullscreenController enterFullscreen:]): provide parent UIView.
* platform/ios/WebVideoFullscreenInterfaceAVKit.h: remove UIWindow.
* platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
(WebVideoFullscreenInterfaceAVKit::setupFullscreen): ditto
(WebVideoFullscreenInterfaceAVKit::cleanupFullscreen): ditto
(WebVideoFullscreenInterfaceAVKit::invalidate): ditto
(WebVideoFullscreenInterfaceAVKit::requestHideAndExitFullscreen): ditto

Source/WebKit/mac:
Provide UIView to WebVideoFullscreenController

* WebView/WebView.mm:
(-[WebView _enterFullscreenForNode:]): pass UIView instead of nil

Source/WebKit2:
Use root UIView to parent fullscreen interface.

* UIProcess/ios/WebVideoFullscreenManagerProxy.mm:
(WebKit::WebVideoFullscreenManagerProxy::setupFullscreenWithID): pass parent UIView
* WebProcess/ios/WebVideoFullscreenManager.mm:
(WebKit::screenRectForNode): Use client rect instead of screen rect.</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="#trunkSourceWebCoreplatformiosWebVideoFullscreenControllerAVKith">trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.h</a></li>
<li><a href="#trunkSourceWebCoreplatformiosWebVideoFullscreenControllerAVKitmm">trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformiosWebVideoFullscreenInterfaceAVKith">trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h</a></li>
<li><a href="#trunkSourceWebCoreplatformiosWebVideoFullscreenInterfaceAVKitmm">trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewmm">trunk/Source/WebKit/mac/WebView/WebView.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWebVideoFullscreenManagerProxymm">trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessiosWebVideoFullscreenManagermm">trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (171344 => 171345)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-07-22 16:38:48 UTC (rev 171344)
+++ trunk/Source/WebCore/ChangeLog        2014-07-22 17:19:21 UTC (rev 171345)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2014-07-22  Jeremy Jones  &lt;jeremyj@apple.com&gt;
+
+        Don't create new UIWindow for video fullscreen.
+        https://bugs.webkit.org/show_bug.cgi?id=135038
+
+        Reviewed by Darin Adler.
+
+        * WebCore.exp.in:
+        * platform/ios/WebVideoFullscreenControllerAVKit.h: use UIView instead of UIScreen.
+        * platform/ios/WebVideoFullscreenControllerAVKit.mm:
+        (-[WebVideoFullscreenController enterFullscreen:]): provide parent UIView.
+        * platform/ios/WebVideoFullscreenInterfaceAVKit.h: remove UIWindow.
+        * platform/ios/WebVideoFullscreenInterfaceAVKit.mm: 
+        (WebVideoFullscreenInterfaceAVKit::setupFullscreen): ditto 
+        (WebVideoFullscreenInterfaceAVKit::cleanupFullscreen): ditto
+        (WebVideoFullscreenInterfaceAVKit::invalidate): ditto
+        (WebVideoFullscreenInterfaceAVKit::requestHideAndExitFullscreen): ditto
+
</ins><span class="cx"> 2014-07-22  Carlos Alberto Lopez Perez  &lt;clopez@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] Rollout r170529 due to ~10% performance regression on the
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (171344 => 171345)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-07-22 16:38:48 UTC (rev 171344)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-07-22 17:19:21 UTC (rev 171345)
</span><span class="lines">@@ -3442,7 +3442,7 @@
</span><span class="cx"> __ZN7WebCore32WebVideoFullscreenInterfaceAVKit14exitFullscreenENS_7IntRectE
</span><span class="cx"> __ZN7WebCore32WebVideoFullscreenInterfaceAVKit14setCurrentTimeEdd
</span><span class="cx"> __ZN7WebCore32WebVideoFullscreenInterfaceAVKit15enterFullscreenEv
</span><del>-__ZN7WebCore32WebVideoFullscreenInterfaceAVKit15setupFullscreenER7CALayerNS_7IntRectE
</del><ins>+__ZN7WebCore32WebVideoFullscreenInterfaceAVKit15setupFullscreenER7CALayerNS_7IntRectEP6UIView
</ins><span class="cx"> __ZN7WebCore32WebVideoFullscreenInterfaceAVKit17cleanupFullscreenEv
</span><span class="cx"> __ZN7WebCore32WebVideoFullscreenInterfaceAVKit17setSeekableRangesERKNS_10TimeRangesE
</span><span class="cx"> __ZN7WebCore32WebVideoFullscreenInterfaceAVKit18setVideoDimensionsEbff
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformiosWebVideoFullscreenControllerAVKith"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.h (171344 => 171345)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.h        2014-07-22 16:38:48 UTC (rev 171344)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.h        2014-07-22 17:19:21 UTC (rev 171345)
</span><span class="lines">@@ -30,12 +30,12 @@
</span><span class="cx"> 
</span><span class="cx"> #import &lt;WebCore/HTMLMediaElement.h&gt;
</span><span class="cx"> 
</span><del>-OBJC_CLASS UIScreen;
</del><ins>+OBJC_CLASS UIView;
</ins><span class="cx"> 
</span><span class="cx"> @interface WebVideoFullscreenController : NSObject
</span><span class="cx"> - (void)setMediaElement:(WebCore::HTMLMediaElement*)mediaElement;
</span><span class="cx"> - (WebCore::HTMLMediaElement*)mediaElement;
</span><del>-- (void)enterFullscreen:(UIScreen *)screen;
</del><ins>+- (void)enterFullscreen:(UIView *)view;
</ins><span class="cx"> - (void)exitFullscreen;
</span><span class="cx"> - (void)requestHideAndExitFullscreen;
</span><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformiosWebVideoFullscreenControllerAVKitmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm (171344 => 171345)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm        2014-07-22 16:38:48 UTC (rev 171344)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm        2014-07-22 17:19:21 UTC (rev 171345)
</span><span class="lines">@@ -50,9 +50,9 @@
</span><span class="cx">     return nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)enterFullscreen:(UIScreen *)screen
</del><ins>+- (void)enterFullscreen:(UIView *)view
</ins><span class="cx"> {
</span><del>-    UNUSED_PARAM(screen);
</del><ins>+    UNUSED_PARAM(view);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)exitFullscreen
</span><span class="lines">@@ -114,11 +114,10 @@
</span><span class="cx">     return _mediaElement.get();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)enterFullscreen:(UIScreen *)screen
</del><ins>+- (void)enterFullscreen:(UIView *)view
</ins><span class="cx"> {
</span><span class="cx">     [self retain]; // Balanced by -release in didExitFullscreen:
</span><span class="cx">     
</span><del>-    UNUSED_PARAM(screen);
</del><span class="cx">     _interface = adoptRef(new WebVideoFullscreenInterfaceAVKit);
</span><span class="cx">     _interface-&gt;setWebVideoFullscreenChangeObserver(&amp;_changeObserver);
</span><span class="cx">     _model = adoptRef(new WebVideoFullscreenModelMediaElement);
</span><span class="lines">@@ -126,7 +125,7 @@
</span><span class="cx">     _interface-&gt;setWebVideoFullscreenModel(_model.get());
</span><span class="cx">     _model-&gt;setMediaElement(_mediaElement.get());
</span><span class="cx">     _videoFullscreenLayer = [CALayer layer];
</span><del>-    _interface-&gt;setupFullscreen(*_videoFullscreenLayer.get(), _mediaElement-&gt;screenRect());
</del><ins>+    _interface-&gt;setupFullscreen(*_videoFullscreenLayer.get(), _mediaElement-&gt;screenRect(), view);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)exitFullscreen
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformiosWebVideoFullscreenInterfaceAVKith"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h (171344 => 171345)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h        2014-07-22 16:38:48 UTC (rev 171344)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h        2014-07-22 17:19:21 UTC (rev 171345)
</span><span class="lines">@@ -40,6 +40,7 @@
</span><span class="cx"> OBJC_CLASS AVPlayerViewController;
</span><span class="cx"> OBJC_CLASS UIViewController;
</span><span class="cx"> OBJC_CLASS UIWindow;
</span><ins>+OBJC_CLASS UIView;
</ins><span class="cx"> OBJC_CLASS CALayer;
</span><span class="cx"> OBJC_CLASS WebAVVideoLayer;
</span><span class="cx"> 
</span><span class="lines">@@ -62,7 +63,6 @@
</span><span class="cx">     RetainPtr&lt;WebAVPlayerController&gt; m_playerController;
</span><span class="cx">     RetainPtr&lt;AVPlayerViewController&gt; m_playerViewController;
</span><span class="cx">     RetainPtr&lt;UIViewController&gt; m_viewController;
</span><del>-    RetainPtr&lt;UIWindow&gt; m_window;
</del><span class="cx">     RetainPtr&lt;CALayer&gt; m_videoLayer;
</span><span class="cx">     RetainPtr&lt;WebAVVideoLayer&gt; m_videoLayerContainer;
</span><span class="cx">     WebVideoFullscreenModel* m_videoFullscreenModel;
</span><span class="lines">@@ -88,7 +88,7 @@
</span><span class="cx">     virtual void setLegibleMediaSelectionOptions(const Vector&lt;String&gt;&amp; options, uint64_t selectedIndex) override;
</span><span class="cx">     virtual void setExternalPlayback(bool enabled, ExternalPlaybackTargetType, String localizedDeviceName) override;
</span><span class="cx"> 
</span><del>-    virtual void setupFullscreen(PlatformLayer&amp;, WebCore::IntRect initialRect);
</del><ins>+    virtual void setupFullscreen(PlatformLayer&amp;, WebCore::IntRect initialRect, UIView *);
</ins><span class="cx">     virtual void enterFullscreen();
</span><span class="cx">     virtual void exitFullscreen(WebCore::IntRect finalRect);
</span><span class="cx">     virtual void cleanupFullscreen();
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformiosWebVideoFullscreenInterfaceAVKitmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm (171344 => 171345)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm        2014-07-22 16:38:48 UTC (rev 171344)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm        2014-07-22 17:19:21 UTC (rev 171345)
</span><span class="lines">@@ -605,7 +605,7 @@
</span><span class="cx">         playerController.minTime = 0;
</span><span class="cx">         playerController.status = AVPlayerControllerStatusReadyToPlay;
</span><span class="cx">         
</span><del>-        protect.clear();
</del><ins>+        protect = nullptr;
</ins><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -619,7 +619,7 @@
</span><span class="cx">             anchorTimeStamp:anchorTimeStamp rate:0];
</span><span class="cx">         playerController().timing = timing;
</span><span class="cx">         
</span><del>-        protect.clear();
</del><ins>+        protect = nullptr;
</ins><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -630,7 +630,7 @@
</span><span class="cx">     dispatch_async(dispatch_get_main_queue(), ^{
</span><span class="cx">         playerController().rate = isPlaying ? playbackRate : 0.;
</span><span class="cx">         
</span><del>-        protect.clear();
</del><ins>+        protect = nullptr;
</ins><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -642,7 +642,7 @@
</span><span class="cx">         playerController().hasEnabledVideo = hasVideo;
</span><span class="cx">         playerController().contentDimensions = CGSizeMake(width, height);
</span><span class="cx">         
</span><del>-        protect.clear();
</del><ins>+        protect = nullptr;
</ins><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -664,7 +664,7 @@
</span><span class="cx">     dispatch_async(dispatch_get_main_queue(), ^{
</span><span class="cx">         playerController().seekableTimeRanges = seekableRanges;
</span><span class="cx">         
</span><del>-        protect.clear();
</del><ins>+        protect = nullptr;
</ins><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -694,7 +694,7 @@
</span><span class="cx">         if (selectedIndex &lt; webOptions.count)
</span><span class="cx">             playerController().currentAudioMediaSelectionOption = webOptions[(size_t)selectedIndex];
</span><span class="cx">         
</span><del>-        protect.clear();
</del><ins>+        protect = nullptr;
</ins><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -708,7 +708,7 @@
</span><span class="cx">         if (selectedIndex &lt; webOptions.count)
</span><span class="cx">             playerController().currentLegibleMediaSelectionOption = webOptions[(size_t)selectedIndex];
</span><span class="cx">         
</span><del>-        protect.clear();
</del><ins>+        protect = nullptr;
</ins><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -728,11 +728,11 @@
</span><span class="cx">         playerController().externalPlaybackActive = enabled;
</span><span class="cx">         [m_videoLayerContainer.get() setHidden:enabled];
</span><span class="cx">         
</span><del>-        protect.clear();
</del><ins>+        protect = nullptr;
</ins><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebVideoFullscreenInterfaceAVKit::setupFullscreen(PlatformLayer&amp; videoLayer, WebCore::IntRect initialRect)
</del><ins>+void WebVideoFullscreenInterfaceAVKit::setupFullscreen(PlatformLayer&amp; videoLayer, WebCore::IntRect initialRect, UIView* parentView)
</ins><span class="cx"> {
</span><span class="cx">     __block RefPtr&lt;WebVideoFullscreenInterfaceAVKit&gt; protect(this);
</span><span class="cx">     
</span><span class="lines">@@ -743,6 +743,10 @@
</span><span class="cx">         [CATransaction begin];
</span><span class="cx">         [CATransaction setDisableActions:YES];
</span><span class="cx"> 
</span><ins>+        m_viewController = adoptNS([[getUIViewControllerClass() alloc] init]);
+        [[m_viewController view] setFrame:parentView.bounds];
+        [parentView addSubview:[m_viewController view]];
+        
</ins><span class="cx">         [m_videoLayer removeFromSuperlayer];
</span><span class="cx">         
</span><span class="cx">         m_videoLayerContainer = [WebAVVideoLayer videoLayer];
</span><span class="lines">@@ -758,19 +762,11 @@
</span><span class="cx">         [m_playerViewController setPlayerController:(AVPlayerController *)playerController()];
</span><span class="cx">         [m_playerViewController setDelegate:playerController()];
</span><span class="cx">         [m_videoLayerContainer setPlayerViewController:m_playerViewController.get()];
</span><del>-        
-        m_viewController = adoptNS([[getUIViewControllerClass() alloc] init]);
</del><span class="cx"> 
</span><del>-        m_window = adoptNS([[getUIWindowClass() alloc] initWithFrame:[[getUIScreenClass() mainScreen] bounds]]);
-        [m_window setBackgroundColor:[getUIColorClass() clearColor]];
-        [m_window setRootViewController:m_viewController.get()];
-        [m_window makeKeyAndVisible];
-
</del><span class="cx">         [m_viewController addChildViewController:m_playerViewController.get()];
</span><span class="cx">         [[m_viewController view] addSubview:[m_playerViewController view]];
</span><span class="cx">         [m_playerViewController view].frame = initialRect;
</span><span class="cx">         [[m_playerViewController view] setBackgroundColor:[getUIColorClass() clearColor]];
</span><del>-        [m_playerViewController didMoveToParentViewController:m_viewController.get()];
</del><span class="cx">         [[m_playerViewController view] layoutIfNeeded];
</span><span class="cx"> 
</span><span class="cx">         [CATransaction commit];
</span><span class="lines">@@ -779,7 +775,7 @@
</span><span class="cx">             if (m_fullscreenChangeObserver)
</span><span class="cx">                 m_fullscreenChangeObserver-&gt;didSetupFullscreen();
</span><span class="cx">             
</span><del>-            protect.clear();
</del><ins>+            protect = nullptr;
</ins><span class="cx">         });
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="lines">@@ -794,7 +790,7 @@
</span><span class="cx">             [m_playerViewController setShowsPlaybackControls:YES];
</span><span class="cx">             if (m_fullscreenChangeObserver)
</span><span class="cx">                 m_fullscreenChangeObserver-&gt;didEnterFullscreen();
</span><del>-            protect.clear();
</del><ins>+            protect = nullptr;
</ins><span class="cx">         }];
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="lines">@@ -803,7 +799,7 @@
</span><span class="cx"> {
</span><span class="cx">     __block RefPtr&lt;WebVideoFullscreenInterfaceAVKit&gt; protect(this);
</span><span class="cx">     
</span><del>-    m_playerController.clear();
</del><ins>+    m_playerController = nil;
</ins><span class="cx">     
</span><span class="cx">     dispatch_async(dispatch_get_main_queue(), ^{
</span><span class="cx">         [m_playerViewController setShowsPlaybackControls:NO];
</span><span class="lines">@@ -811,59 +807,67 @@
</span><span class="cx">         if ([m_videoLayerContainer videoLayerGravity] != AVVideoLayerGravityResizeAspect)
</span><span class="cx">             [m_videoLayerContainer setVideoLayerGravity:AVVideoLayerGravityResizeAspect];
</span><span class="cx">         [[m_playerViewController view] layoutIfNeeded];
</span><del>-        [m_playerViewController exitFullScreenWithCompletionHandler:^(BOOL, NSError*)
-        {
</del><ins>+        [m_playerViewController exitFullScreenWithCompletionHandler:^(BOOL, NSError*) {
</ins><span class="cx">             [[m_playerViewController view] setBackgroundColor:[getUIColorClass() clearColor]];
</span><span class="cx">             if (m_fullscreenChangeObserver)
</span><span class="cx">                 m_fullscreenChangeObserver-&gt;didExitFullscreen();
</span><del>-            protect.clear();
</del><ins>+            protect = nullptr;
</ins><span class="cx">         }];
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebVideoFullscreenInterfaceAVKit::cleanupFullscreen()
</span><span class="cx"> {
</span><ins>+    // Retain this to extend object life until async block completes.
</ins><span class="cx">     __block RefPtr&lt;WebVideoFullscreenInterfaceAVKit&gt; protect(this);
</span><span class="cx">     
</span><span class="cx">     dispatch_async(dispatch_get_main_queue(), ^{
</span><del>-        [m_window setHidden:YES];
-        [m_window setRootViewController:nil];
</del><span class="cx">         [m_playerViewController setDelegate:nil];
</span><ins>+        [[m_playerViewController view] removeFromSuperview];
+        [m_playerViewController removeFromParentViewController];
</ins><span class="cx">         [m_playerViewController setPlayerController:nil];
</span><span class="cx">         m_playerViewController = nil;
</span><del>-        m_viewController = nil;
-        m_window = nil;
</del><span class="cx">         [m_videoLayer removeFromSuperlayer];
</span><span class="cx">         m_videoLayer = nil;
</span><span class="cx">         [m_videoLayerContainer removeFromSuperlayer];
</span><span class="cx">         [m_videoLayerContainer setPlayerViewController:nil];
</span><span class="cx">         m_videoLayerContainer = nil;
</span><ins>+        [[m_viewController view] removeFromSuperview];
+        m_viewController = nil;
</ins><span class="cx">         
</span><span class="cx">         if (m_fullscreenChangeObserver)
</span><span class="cx">             m_fullscreenChangeObserver-&gt;didCleanupFullscreen();
</span><del>-        protect.clear();
</del><ins>+        protect = nullptr;
</ins><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebVideoFullscreenInterfaceAVKit::invalidate()
</span><span class="cx"> {
</span><del>-    m_playerController.clear();
-    [m_window setHidden:YES];
-    [m_window setRootViewController:nil];
</del><ins>+    m_playerController = nil;
</ins><span class="cx">     [m_playerViewController setDelegate:nil];
</span><ins>+    [[m_playerViewController view] removeFromSuperview];
+    [m_playerViewController removeFromParentViewController];
</ins><span class="cx">     [m_playerViewController setPlayerController:nil];
</span><span class="cx">     m_playerViewController = nil;
</span><del>-    m_viewController = nil;
-    m_window = nil;
</del><span class="cx">     [m_videoLayer removeFromSuperlayer];
</span><span class="cx">     m_videoLayer = nil;
</span><span class="cx">     [m_videoLayerContainer removeFromSuperlayer];
</span><ins>+    [m_videoLayerContainer setPlayerViewController:nil];
</ins><span class="cx">     m_videoLayerContainer = nil;
</span><ins>+    [[m_viewController view] removeFromSuperview];
+    m_viewController = nil;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebVideoFullscreenInterfaceAVKit::requestHideAndExitFullscreen()
</span><span class="cx"> {
</span><del>-    [m_window setHidden:YES];
</del><ins>+    __block RefPtr&lt;WebVideoFullscreenInterfaceAVKit&gt; protect(this);
+
+    dispatch_async(dispatch_get_main_queue(), ^{
+        [m_playerViewController exitFullScreenWithCompletionHandler:^(BOOL, NSError*) {
+            protect = nullptr;
+        }];
+    });
+
</ins><span class="cx">     if (m_videoFullscreenModel)
</span><span class="cx">         m_videoFullscreenModel-&gt;requestExitFullscreen();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (171344 => 171345)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2014-07-22 16:38:48 UTC (rev 171344)
+++ trunk/Source/WebKit/mac/ChangeLog        2014-07-22 17:19:21 UTC (rev 171345)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2014-07-22  Jeremy Jones  &lt;jeremyj@apple.com&gt;
+
+        Don't create new UIWindow for video fullscreen.
+        https://bugs.webkit.org/show_bug.cgi?id=135038
+
+        Reviewed by Darin Adler.
+
+        Provide UIView to WebVideoFullscreenController
+
+        * WebView/WebView.mm:
+        (-[WebView _enterFullscreenForNode:]): pass UIView instead of nil
+
</ins><span class="cx"> 2014-07-21  Pratik Solanki  &lt;psolanki@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed iOS build fix after r171321.
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (171344 => 171345)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebView.mm        2014-07-22 16:38:48 UTC (rev 171344)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm        2014-07-22 17:19:21 UTC (rev 171345)
</span><span class="lines">@@ -8429,7 +8429,7 @@
</span><span class="cx">         _private-&gt;fullscreenController = [[WebVideoFullscreenController alloc] init];
</span><span class="cx">         [_private-&gt;fullscreenController setMediaElement:videoElement];
</span><span class="cx"> #if PLATFORM(IOS)
</span><del>-        [_private-&gt;fullscreenController enterFullscreen:nil];
</del><ins>+        [_private-&gt;fullscreenController enterFullscreen:(UIView *)[[[self window] hostLayer] delegate]];
</ins><span class="cx"> #else
</span><span class="cx">         [_private-&gt;fullscreenController enterFullscreen:[[self window] screen]];
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (171344 => 171345)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-07-22 16:38:48 UTC (rev 171344)
+++ trunk/Source/WebKit2/ChangeLog        2014-07-22 17:19:21 UTC (rev 171345)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2014-07-22  Jeremy Jones  &lt;jeremyj@apple.com&gt;
+
+        Don't create new UIWindow for video fullscreen.
+        https://bugs.webkit.org/show_bug.cgi?id=135038
+
+        Reviewed by Darin Adler.
+
+        Use root UIView to parent fullscreen interface.
+
+        * UIProcess/ios/WebVideoFullscreenManagerProxy.mm:
+        (WebKit::WebVideoFullscreenManagerProxy::setupFullscreenWithID): pass parent UIView
+        * WebProcess/ios/WebVideoFullscreenManager.mm:
+        (WebKit::screenRectForNode): Use client rect instead of screen rect.
+
</ins><span class="cx"> 2014-07-21  Ryuan Choi  &lt;ryuan.choi@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [EFL] Add Ewk prefix to enums of ewk_navigation_policy
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWebVideoFullscreenManagerProxymm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm (171344 => 171345)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm        2014-07-22 16:38:48 UTC (rev 171344)
+++ trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm        2014-07-22 17:19:21 UTC (rev 171345)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> 
</span><ins>+#include &quot;RemoteLayerTreeDrawingAreaProxy.h&quot;
</ins><span class="cx"> #include &quot;WebPageProxy.h&quot;
</span><span class="cx"> #include &quot;WebProcessProxy.h&quot;
</span><span class="cx"> #include &quot;WebVideoFullscreenManagerMessages.h&quot;
</span><span class="lines">@@ -75,7 +76,8 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(videoLayerID);
</span><span class="cx">     m_layerHost = WKMakeRenderLayer(videoLayerID);
</span><del>-    setupFullscreen(*m_layerHost.get(), initialRect);
</del><ins>+    UIView *parentView = toRemoteLayerTreeDrawingAreaProxy(m_page-&gt;drawingArea())-&gt;remoteLayerTreeHost().rootLayer();
+    setupFullscreen(*m_layerHost.get(), initialRect, parentView);
</ins><span class="cx"> }
</span><span class="cx">     
</span><span class="cx"> void WebVideoFullscreenManagerProxy::setSeekableRangesVector(Vector&lt;std::pair&lt;double, double&gt;&gt;&amp; ranges)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessiosWebVideoFullscreenManagermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm (171344 => 171345)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm        2014-07-22 16:38:48 UTC (rev 171344)
+++ trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm        2014-07-22 17:19:21 UTC (rev 171345)
</span><span class="lines">@@ -50,12 +50,12 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><del>-static IntRect screenRectForNode(Node* node)
</del><ins>+static IntRect clientRectForNode(Node* node)
</ins><span class="cx"> {
</span><span class="cx">     if (!node || !node-&gt;isElementNode())
</span><span class="cx">         return IntRect();
</span><span class="cx"> 
</span><del>-    return toElement(node)-&gt;screenRect();
</del><ins>+    return toElement(node)-&gt;clientRect();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> PassRefPtr&lt;WebVideoFullscreenManager&gt; WebVideoFullscreenManager::create(PassRefPtr&lt;WebPage&gt; page)
</span><span class="lines">@@ -97,7 +97,7 @@
</span><span class="cx"> 
</span><span class="cx">     m_layerHostingContext = LayerHostingContext::createForExternalHostingProcess();
</span><span class="cx">     
</span><del>-    m_page-&gt;send(Messages::WebVideoFullscreenManagerProxy::SetupFullscreenWithID(m_layerHostingContext-&gt;contextID(), screenRectForNode(node)), m_page-&gt;pageID());
</del><ins>+    m_page-&gt;send(Messages::WebVideoFullscreenManagerProxy::SetupFullscreenWithID(m_layerHostingContext-&gt;contextID(), clientRectForNode(node)), m_page-&gt;pageID());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebVideoFullscreenManager::exitFullscreenForNode(Node* node)
</span><span class="lines">@@ -109,7 +109,7 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     m_isAnimating = true;
</span><del>-    m_page-&gt;send(Messages::WebVideoFullscreenManagerProxy::ExitFullscreen(screenRectForNode(node)), m_page-&gt;pageID());
</del><ins>+    m_page-&gt;send(Messages::WebVideoFullscreenManagerProxy::ExitFullscreen(clientRectForNode(node)), m_page-&gt;pageID());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebVideoFullscreenManager::setDuration(double duration)
</span></span></pre>
</div>
</div>

</body>
</html>