<!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>[204088] trunk</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/204088">204088</a></dd>
<dt>Author</dt> <dd>adachan@apple.com</dd>
<dt>Date</dt> <dd>2016-08-03 11:11:50 -0700 (Wed, 03 Aug 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Mac] media/pip-video-going-into-fullscreen.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=160469

Reviewed by Eric Carlson.

Source/WebCore:

When going from picture-in-picture directly to fullscreen, fix the issue where the
presentation mode unexpectedly changes back to inline after changing to fullscreen.

On Mac, standard fullscreen is not handled by WebVideoFullscreenManager.
When going from picture-in-picture directly to fullscreen, we call
WebVideoFullscreenInterfaceMac::exitFullscreenWithoutAnimationToMode().
We should update m_mode to VideoFullscreenModeStandard there to keep it in sync
with the fullscreen mode in HTMLMediaElement. Otherwise, we'll inadvertently
update the mode to inline when we clear the VideoFullscreenModePictureInPicture mode
in -[WebVideoFullscreenInterfaceMacObjC pipDidClose:].

Since standard fullscreen on Mac doesn't make use of the video fullscreen layer,
we need to make sure we return the video layer back to inline when the presentation
mode changes to &quot;fullscreen&quot;. We only do this on Mac because iOS does use
the video fullscreen layer for standard fullscreen.

* Modules/mediacontrols/MediaControlsHost.cpp:
(WebCore::MediaControlsHost::setPreparedToReturnVideoLayerToInline):
Renamed from MediaControlsHost::setPreparedForInline to make it clear this is about
whether the video layer should be inline.
(WebCore::MediaControlsHost::setPreparedForInline): Deleted.
* Modules/mediacontrols/MediaControlsHost.h:
* Modules/mediacontrols/MediaControlsHost.idl:

* Modules/mediacontrols/mediaControlsApple.js:
(Controller.prototype.shouldReturnVideoLayerToInline):
On Mac, the video layer is inline when the presentation mode is &quot;inline&quot; or &quot;fullscreen&quot;.
(Controller.prototype.handlePresentationModeChange):
Call shouldReturnVideoLayerToInline() to determine whether the video layer should be inline.

* Modules/mediacontrols/mediaControlsiOS.js:
(ControllerIOS.prototype.shouldReturnVideoLayerToInline):
Override this method since on iOS, the video layer is only inline when the presentation
mode is &quot;inline&quot;.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer):
(WebCore::HTMLMediaElement::setPreparedToReturnVideoLayerToInline):
(WebCore::HTMLMediaElement::setPreparedForInline): Deleted.
* html/HTMLMediaElement.h:

* platform/mac/WebVideoFullscreenInterfaceMac.mm:
(WebCore::WebVideoFullscreenInterfaceMac::enterFullscreen):
Remove the assertion that the mode must be &quot;picture-in-picture&quot;. I've run into this
assertion in layout tests. Since the EnterFullscreen message is sent in a dispatch_async
block in WebVideoFullscreenManager::didSetupFullscreen(), there's a chance that the
fullscreen mode tracked in WebVideoFullscreenInterfaceMac has already changed to
something else when WebVideoFullscreenInterfaceMac::enterFullscreen() is called.
(WebCore::WebVideoFullscreenInterfaceMac::exitFullscreenWithoutAnimationToMode):
If exiting to standard fullscreen, update m_mode to VideoFullscreenModeStandard.

LayoutTests:

Re-enable media/pip-video-going-into-fullscreen.html on Sierra.

* platform/mac-wk2/TestExpectations:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk2TestExpectations">trunk/LayoutTests/platform/mac-wk2/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesmediacontrolsMediaControlsHostcpp">trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesmediacontrolsMediaControlsHosth">trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.h</a></li>
<li><a href="#trunkSourceWebCoreModulesmediacontrolsMediaControlsHostidl">trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.idl</a></li>
<li><a href="#trunkSourceWebCoreModulesmediacontrolsmediaControlsApplejs">trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js</a></li>
<li><a href="#trunkSourceWebCoreModulesmediacontrolsmediaControlsiOSjs">trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLMediaElementcpp">trunk/Source/WebCore/html/HTMLMediaElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLMediaElementh">trunk/Source/WebCore/html/HTMLMediaElement.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmacWebVideoFullscreenInterfaceMacmm">trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (204087 => 204088)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-08-03 18:05:50 UTC (rev 204087)
+++ trunk/LayoutTests/ChangeLog        2016-08-03 18:11:50 UTC (rev 204088)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2016-08-02  Ada Chan  &lt;adachan@apple.com&gt;
+
+        [Mac] media/pip-video-going-into-fullscreen.html is a flaky failure
+        https://bugs.webkit.org/show_bug.cgi?id=160469
+
+        Reviewed by Eric Carlson.
+
+        Re-enable media/pip-video-going-into-fullscreen.html on Sierra.
+
+        * platform/mac-wk2/TestExpectations:
+
</ins><span class="cx"> 2016-08-03  Youenn Fablet  &lt;youenn@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         http/tests/fetch/fetch-in-worker-crash.html is sometimes crashing
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk2TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (204087 => 204088)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk2/TestExpectations        2016-08-03 18:05:50 UTC (rev 204087)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations        2016-08-03 18:11:50 UTC (rev 204088)
</span><span class="lines">@@ -473,6 +473,7 @@
</span><span class="cx"> [ Sierra+ ] media/fullscreen-api-enabled-media-with-presentation-mode.html [ Pass ]
</span><span class="cx"> [ Sierra+ ] media/fullscreen-video-going-into-pip.html [ Pass ]
</span><span class="cx"> [ Sierra+ ] media/navigate-with-pip-should-not-crash.html [ Pass ]
</span><ins>+[ Sierra+ ] media/pip-video-going-into-fullscreen.html [ Pass ]
</ins><span class="cx"> [ Sierra+ ] media/video-contained-in-fullscreen-element-going-into-pip.html [ Pass ]
</span><span class="cx"> 
</span><span class="cx"> # rdar://problem/26885345
</span><span class="lines">@@ -479,9 +480,6 @@
</span><span class="cx"> [ Release Sierra+ ] media/click-placeholder-not-pausing.html [ Pass ]
</span><span class="cx"> [ Debug Sierra+ ] media/click-placeholder-not-pausing.html [ Skip ]
</span><span class="cx"> 
</span><del>-# rdar://problem/26901714
-[ Sierra+ ] media/pip-video-going-into-fullscreen.html [ Pass Failure ]
-
</del><span class="cx"> # RTL Scrollbars are enabled on Sierra WebKit2.
</span><span class="cx"> [ Sierra+ ] fast/scrolling/rtl-scrollbars.html [ Pass ]
</span><span class="cx"> [ Sierra+ ] fast/scrolling/rtl-scrollbars-simple.html [ Pass ]
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (204087 => 204088)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-08-03 18:05:50 UTC (rev 204087)
+++ trunk/Source/WebCore/ChangeLog        2016-08-03 18:11:50 UTC (rev 204088)
</span><span class="lines">@@ -1,3 +1,61 @@
</span><ins>+2016-08-02  Ada Chan  &lt;adachan@apple.com&gt;
+
+        [Mac] media/pip-video-going-into-fullscreen.html is a flaky failure
+        https://bugs.webkit.org/show_bug.cgi?id=160469
+
+        Reviewed by Eric Carlson.
+
+        When going from picture-in-picture directly to fullscreen, fix the issue where the
+        presentation mode unexpectedly changes back to inline after changing to fullscreen.
+
+        On Mac, standard fullscreen is not handled by WebVideoFullscreenManager.
+        When going from picture-in-picture directly to fullscreen, we call
+        WebVideoFullscreenInterfaceMac::exitFullscreenWithoutAnimationToMode().
+        We should update m_mode to VideoFullscreenModeStandard there to keep it in sync
+        with the fullscreen mode in HTMLMediaElement. Otherwise, we'll inadvertently
+        update the mode to inline when we clear the VideoFullscreenModePictureInPicture mode
+        in -[WebVideoFullscreenInterfaceMacObjC pipDidClose:].
+
+        Since standard fullscreen on Mac doesn't make use of the video fullscreen layer,
+        we need to make sure we return the video layer back to inline when the presentation
+        mode changes to &quot;fullscreen&quot;. We only do this on Mac because iOS does use
+        the video fullscreen layer for standard fullscreen.
+
+        * Modules/mediacontrols/MediaControlsHost.cpp:
+        (WebCore::MediaControlsHost::setPreparedToReturnVideoLayerToInline):
+        Renamed from MediaControlsHost::setPreparedForInline to make it clear this is about
+        whether the video layer should be inline.
+        (WebCore::MediaControlsHost::setPreparedForInline): Deleted.
+        * Modules/mediacontrols/MediaControlsHost.h:
+        * Modules/mediacontrols/MediaControlsHost.idl:
+
+        * Modules/mediacontrols/mediaControlsApple.js:
+        (Controller.prototype.shouldReturnVideoLayerToInline):
+        On Mac, the video layer is inline when the presentation mode is &quot;inline&quot; or &quot;fullscreen&quot;.
+        (Controller.prototype.handlePresentationModeChange):
+        Call shouldReturnVideoLayerToInline() to determine whether the video layer should be inline.
+
+        * Modules/mediacontrols/mediaControlsiOS.js:
+        (ControllerIOS.prototype.shouldReturnVideoLayerToInline):
+        Override this method since on iOS, the video layer is only inline when the presentation
+        mode is &quot;inline&quot;.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer):
+        (WebCore::HTMLMediaElement::setPreparedToReturnVideoLayerToInline):
+        (WebCore::HTMLMediaElement::setPreparedForInline): Deleted.
+        * html/HTMLMediaElement.h:
+
+        * platform/mac/WebVideoFullscreenInterfaceMac.mm:
+        (WebCore::WebVideoFullscreenInterfaceMac::enterFullscreen):
+        Remove the assertion that the mode must be &quot;picture-in-picture&quot;. I've run into this
+        assertion in layout tests. Since the EnterFullscreen message is sent in a dispatch_async
+        block in WebVideoFullscreenManager::didSetupFullscreen(), there's a chance that the
+        fullscreen mode tracked in WebVideoFullscreenInterfaceMac has already changed to
+        something else when WebVideoFullscreenInterfaceMac::enterFullscreen() is called.
+        (WebCore::WebVideoFullscreenInterfaceMac::exitFullscreenWithoutAnimationToMode):
+        If exiting to standard fullscreen, update m_mode to VideoFullscreenModeStandard.
+
</ins><span class="cx"> 2016-08-03  Youenn Fablet  &lt;youenn@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         http/tests/fetch/fetch-in-worker-crash.html is sometimes crashing
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediacontrolsMediaControlsHostcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp (204087 => 204088)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp        2016-08-03 18:05:50 UTC (rev 204087)
+++ trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp        2016-08-03 18:11:50 UTC (rev 204088)
</span><span class="lines">@@ -215,9 +215,9 @@
</span><span class="cx">     return m_mediaElement-&gt;isVideoLayerInline();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MediaControlsHost::setPreparedForInline(bool value)
</del><ins>+void MediaControlsHost::setPreparedToReturnVideoLayerToInline(bool value)
</ins><span class="cx"> {
</span><del>-    m_mediaElement-&gt;setPreparedForInline(value);
</del><ins>+    m_mediaElement-&gt;setPreparedToReturnVideoLayerToInline(value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool MediaControlsHost::userGestureRequired() const
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediacontrolsMediaControlsHosth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.h (204087 => 204088)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.h        2016-08-03 18:05:50 UTC (rev 204087)
+++ trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.h        2016-08-03 18:11:50 UTC (rev 204088)
</span><span class="lines">@@ -66,7 +66,7 @@
</span><span class="cx">     bool supportsFullscreen();
</span><span class="cx">     bool isVideoLayerInline();
</span><span class="cx">     bool userGestureRequired() const;
</span><del>-    void setPreparedForInline(bool);
</del><ins>+    void setPreparedToReturnVideoLayerToInline(bool);
</ins><span class="cx"> 
</span><span class="cx">     void updateCaptionDisplaySizes();
</span><span class="cx">     void enteredFullscreen();
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediacontrolsMediaControlsHostidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.idl (204087 => 204088)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.idl        2016-08-03 18:05:50 UTC (rev 204087)
+++ trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.idl        2016-08-03 18:11:50 UTC (rev 204088)
</span><span class="lines">@@ -42,7 +42,7 @@
</span><span class="cx">     readonly attribute TextTrack captionMenuAutomaticItem;
</span><span class="cx">     readonly attribute DOMString captionDisplayMode;
</span><span class="cx">     void setSelectedTextTrack(TextTrack? track);
</span><del>-    void setPreparedForInline(boolean prepared);
</del><ins>+    void setPreparedToReturnVideoLayerToInline(boolean prepared);
</ins><span class="cx">     readonly attribute HTMLElement textTrackContainer;
</span><span class="cx">     readonly attribute boolean allowsInlineMediaPlayback;
</span><span class="cx">     readonly attribute boolean supportsFullscreen;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediacontrolsmediaControlsApplejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js (204087 => 204088)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js        2016-08-03 18:05:50 UTC (rev 204087)
+++ trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js        2016-08-03 18:11:50 UTC (rev 204088)
</span><span class="lines">@@ -909,6 +909,12 @@
</span><span class="cx">             setTimeout(this.showInlinePlaybackPlaceholderWhenSafe.bind(this), this.PlaceholderPollingDelay);
</span><span class="cx">     },
</span><span class="cx"> 
</span><ins>+    shouldReturnVideoLayerToInline: function()
+    {
+        var presentationMode = this.presentationMode();
+        return presentationMode === 'inline' || presentationMode === 'fullscreen';
+    },
+
</ins><span class="cx">     handlePresentationModeChange: function(event)
</span><span class="cx">     {
</span><span class="cx">         var presentationMode = this.presentationMode();
</span><span class="lines">@@ -951,7 +957,7 @@
</span><span class="cx">         this.resetHideControlsTimer();
</span><span class="cx">         if (presentationMode != 'fullscreen' &amp;&amp; this.video.paused &amp;&amp; this.controlsAreHidden())
</span><span class="cx">             this.showControls();
</span><del>-        this.host.setPreparedForInline(presentationMode === 'inline')
</del><ins>+        this.host.setPreparedToReturnVideoLayerToInline(this.shouldReturnVideoLayerToInline());
</ins><span class="cx">     },
</span><span class="cx"> 
</span><span class="cx">     handleFullscreenChange: function(event)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediacontrolsmediaControlsiOSjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js (204087 => 204088)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js        2016-08-03 18:05:50 UTC (rev 204087)
+++ trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js        2016-08-03 18:11:50 UTC (rev 204088)
</span><span class="lines">@@ -536,6 +536,11 @@
</span><span class="cx">         Controller.prototype.setShouldListenForPlaybackTargetAvailabilityEvent.call(this, shouldListen);
</span><span class="cx">     },
</span><span class="cx"> 
</span><ins>+    shouldReturnVideoLayerToInline: function()
+    {
+        return this.presentationMode() === 'inline';
+    },
+
</ins><span class="cx">     handlePresentationModeChange: function(event)
</span><span class="cx">     {
</span><span class="cx">         var presentationMode = this.presentationMode();
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (204087 => 204088)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaElement.cpp        2016-08-03 18:05:50 UTC (rev 204087)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp        2016-08-03 18:11:50 UTC (rev 204088)
</span><span class="lines">@@ -5079,7 +5079,7 @@
</span><span class="cx">     if (m_videoFullscreenMode != VideoFullscreenModeNone)
</span><span class="cx">         exitFullscreen();
</span><span class="cx"> 
</span><del>-    setPreparedForInline(true);
</del><ins>+    setPreparedToReturnVideoLayerToInline(true);
</ins><span class="cx"> 
</span><span class="cx">     updatePlaybackControlsManager();
</span><span class="cx">     m_inActiveDocument = false;
</span><span class="lines">@@ -5529,7 +5529,7 @@
</span><span class="cx">     return m_player ? m_player-&gt;platformLayer() : nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void HTMLMediaElement::setPreparedForInline(bool value)
</del><ins>+void HTMLMediaElement::setPreparedToReturnVideoLayerToInline(bool value)
</ins><span class="cx"> {
</span><span class="cx">     m_preparedForInline = value;
</span><span class="cx">     if (m_preparedForInline &amp;&amp; m_preparedForInlineCompletionHandler) {
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (204087 => 204088)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaElement.h        2016-08-03 18:05:50 UTC (rev 204087)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h        2016-08-03 18:11:50 UTC (rev 204088)
</span><span class="lines">@@ -130,7 +130,7 @@
</span><span class="cx">     WEBCORE_EXPORT PlatformMedia platformMedia() const;
</span><span class="cx">     PlatformLayer* platformLayer() const;
</span><span class="cx">     bool isVideoLayerInline();
</span><del>-    void setPreparedForInline(bool);
</del><ins>+    void setPreparedToReturnVideoLayerToInline(bool);
</ins><span class="cx">     void waitForPreparedForInlineThen(std::function&lt;void()&gt; completionHandler = [] { });
</span><span class="cx"> #if PLATFORM(IOS) || (PLATFORM(MAC) &amp;&amp; ENABLE(VIDEO_PRESENTATION_MODE))
</span><span class="cx">     void setVideoFullscreenLayer(PlatformLayer*, std::function&lt;void()&gt; completionHandler = [] { });
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmacWebVideoFullscreenInterfaceMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm (204087 => 204088)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm        2016-08-03 18:05:50 UTC (rev 204087)
+++ trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm        2016-08-03 18:11:50 UTC (rev 204088)
</span><span class="lines">@@ -467,8 +467,7 @@
</span><span class="cx"> 
</span><span class="cx">         if (m_fullscreenChangeObserver)
</span><span class="cx">             m_fullscreenChangeObserver-&gt;didEnterFullscreen();
</span><del>-    } else
-        ASSERT_NOT_REACHED();
</del><ins>+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebVideoFullscreenInterfaceMac::exitFullscreen(const IntRect&amp; finalRect, NSWindow *parentWindow)
</span><span class="lines">@@ -491,7 +490,14 @@
</span><span class="cx">     if ([m_webVideoFullscreenInterfaceObjC didRequestExitingPIP])
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    [m_webVideoFullscreenInterfaceObjC setExitingToStandardFullscreen:mode == HTMLMediaElementEnums::VideoFullscreenModeStandard];
</del><ins>+    bool isExitingToStandardFullscreen = mode == HTMLMediaElementEnums::VideoFullscreenModeStandard;
+    // On Mac, standard fullscreen is handled by the Fullscreen API and not by WebVideoFullscreenManager.
+    // Just update m_mode directly to HTMLMediaElementEnums::VideoFullscreenModeStandard in that case to keep
+    // m_mode in sync with the fullscreen mode in HTMLMediaElement.
+    if (isExitingToStandardFullscreen)
+        m_mode = HTMLMediaElementEnums::VideoFullscreenModeStandard;
+
+    [m_webVideoFullscreenInterfaceObjC setExitingToStandardFullscreen:isExitingToStandardFullscreen];
</ins><span class="cx">     [m_webVideoFullscreenInterfaceObjC exitPIP];
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>