<!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>[197478] 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/197478">197478</a></dd>
<dt>Author</dt> <dd>adachan@apple.com</dd>
<dt>Date</dt> <dd>2016-03-02 16:34:19 -0800 (Wed, 02 Mar 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Update the media element's presentation mode properly after going in and out of full screen via the Full Screen API
https://bugs.webkit.org/show_bug.cgi?id=154834
Reviewed by Simon Fraser.
Source/WebCore:
* dom/Document.cpp:
(WebCore::Document::webkitWillEnterFullScreenForElement):
* dom/Element.cpp:
(WebCore::Element::willBecomeFullscreenElement):
* dom/Element.h:
(WebCore::Element::ancestorWillEnterFullscreen):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::enterFullscreen):
If the Full Screen API is enabled and this media element is entering a mode other than standard
full screen, see if it's currently contained in a full screen element. If so, exit full screen.
(WebCore::HTMLMediaElement::willBecomeFullscreenElement):
If this media element is going to standard full screen, update its presentation mode. If
this media element also supports presentation mode and it currently has a presentation mode
that's not standard full screen, exit that presentation mode directly without animation.
(WebCore::HTMLMediaElement::willStopBeingFullscreenElement):
Set the presentation mode back to inline unless it's already changed to a different
presentation mode.
* html/HTMLMediaElement.h:
* html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::ancestorWillEnterFullscreen):
Reset this video element's presentation state to inline if its ancestor is going to full screen.
(WebCore::HTMLVideoElement::exitToFullscreenModeWithoutAnimationIfPossible):
If the fullscreen mode the video element is exiting from is supported, exit that mode to the new mode.
* html/HTMLVideoElement.h:
* page/ChromeClient.h:
* platform/mac/WebVideoFullscreenInterfaceMac.h:
* platform/mac/WebVideoFullscreenInterfaceMac.mm:
(WebCore::WebVideoFullscreenInterfaceMac::exitFullscreenWithoutAnimationToMode):
Source/WebKit2:
* UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h:
* UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in:
* UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
(WebKit::WebVideoFullscreenManagerProxy::exitFullscreenWithoutAnimationToMode):
Call the new exitFullscreenWithoutAnimationToMode() method on WebVideoFullscreenInterfaceMac.
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::exitVideoFullscreenToModeWithoutAnimation):
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/cocoa/WebVideoFullscreenManager.h:
* WebProcess/cocoa/WebVideoFullscreenManager.mm:
(WebKit::WebVideoFullscreenManager::exitVideoFullscreenToModeWithoutAnimation):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoredomDocumentcpp">trunk/Source/WebCore/dom/Document.cpp</a></li>
<li><a href="#trunkSourceWebCoredomElementcpp">trunk/Source/WebCore/dom/Element.cpp</a></li>
<li><a href="#trunkSourceWebCoredomElementh">trunk/Source/WebCore/dom/Element.h</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="#trunkSourceWebCorehtmlHTMLVideoElementcpp">trunk/Source/WebCore/html/HTMLVideoElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLVideoElementh">trunk/Source/WebCore/html/HTMLVideoElement.h</a></li>
<li><a href="#trunkSourceWebCorepageChromeClienth">trunk/Source/WebCore/page/ChromeClient.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmacWebVideoFullscreenInterfaceMach">trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmacWebVideoFullscreenInterfaceMacmm">trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaWebVideoFullscreenManagerProxyh">trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaWebVideoFullscreenManagerProxymessagesin">trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaWebVideoFullscreenManagerProxymm">trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClientcpp">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClienth">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcesscocoaWebVideoFullscreenManagerh">trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcesscocoaWebVideoFullscreenManagermm">trunk/Source/WebKit2/WebProcess/cocoa/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 (197477 => 197478)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-03-03 00:29:01 UTC (rev 197477)
+++ trunk/Source/WebCore/ChangeLog        2016-03-03 00:34:19 UTC (rev 197478)
</span><span class="lines">@@ -1,3 +1,39 @@
</span><ins>+2016-03-01 Ada Chan <adachan@apple.com>
+
+ Update the media element's presentation mode properly after going in and out of full screen via the Full Screen API
+ https://bugs.webkit.org/show_bug.cgi?id=154834
+
+ Reviewed by Simon Fraser.
+
+ * dom/Document.cpp:
+ (WebCore::Document::webkitWillEnterFullScreenForElement):
+ * dom/Element.cpp:
+ (WebCore::Element::willBecomeFullscreenElement):
+ * dom/Element.h:
+ (WebCore::Element::ancestorWillEnterFullscreen):
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::enterFullscreen):
+ If the Full Screen API is enabled and this media element is entering a mode other than standard
+ full screen, see if it's currently contained in a full screen element. If so, exit full screen.
+ (WebCore::HTMLMediaElement::willBecomeFullscreenElement):
+ If this media element is going to standard full screen, update its presentation mode. If
+ this media element also supports presentation mode and it currently has a presentation mode
+ that's not standard full screen, exit that presentation mode directly without animation.
+ (WebCore::HTMLMediaElement::willStopBeingFullscreenElement):
+ Set the presentation mode back to inline unless it's already changed to a different
+ presentation mode.
+ * html/HTMLMediaElement.h:
+ * html/HTMLVideoElement.cpp:
+ (WebCore::HTMLVideoElement::ancestorWillEnterFullscreen):
+ Reset this video element's presentation state to inline if its ancestor is going to full screen.
+ (WebCore::HTMLVideoElement::exitToFullscreenModeWithoutAnimationIfPossible):
+ If the fullscreen mode the video element is exiting from is supported, exit that mode to the new mode.
+ * html/HTMLVideoElement.h:
+ * page/ChromeClient.h:
+ * platform/mac/WebVideoFullscreenInterfaceMac.h:
+ * platform/mac/WebVideoFullscreenInterfaceMac.mm:
+ (WebCore::WebVideoFullscreenInterfaceMac::exitFullscreenWithoutAnimationToMode):
+
</ins><span class="cx"> 2016-03-02 Brady Eidson <beidson@apple.com>
</span><span class="cx">
</span><span class="cx"> Modern IDB: Close UniqueIDBDatabases once they become unused.
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (197477 => 197478)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp        2016-03-03 00:29:01 UTC (rev 197477)
+++ trunk/Source/WebCore/dom/Document.cpp        2016-03-03 00:34:19 UTC (rev 197478)
</span><span class="lines">@@ -5802,6 +5802,9 @@
</span><span class="cx">
</span><span class="cx"> unwrapFullScreenRenderer(m_fullScreenRenderer, m_fullScreenElement.get());
</span><span class="cx">
</span><ins>+ if (element)
+ element->willBecomeFullscreenElement();
+
</ins><span class="cx"> m_fullScreenElement = element;
</span><span class="cx">
</span><span class="cx"> #if USE(NATIVE_FULLSCREEN_VIDEO)
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.cpp (197477 => 197478)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.cpp        2016-03-03 00:29:01 UTC (rev 197477)
+++ trunk/Source/WebCore/dom/Element.cpp        2016-03-03 00:34:19 UTC (rev 197478)
</span><span class="lines">@@ -2419,6 +2419,12 @@
</span><span class="cx"> ensureElementRareData().setMinimumSizeForResizing(size);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void Element::willBecomeFullscreenElement()
+{
+ for (auto& child : descendantsOfType<Element>(*this))
+ child.ancestorWillEnterFullscreen();
+}
+
</ins><span class="cx"> static PseudoElement* beforeOrAfterPseudoElement(Element& host, PseudoId pseudoElementSpecifier)
</span><span class="cx"> {
</span><span class="cx"> switch (pseudoElementSpecifier) {
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.h (197477 => 197478)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.h        2016-03-03 00:29:01 UTC (rev 197477)
+++ trunk/Source/WebCore/dom/Element.h        2016-03-03 00:34:19 UTC (rev 197478)
</span><span class="lines">@@ -358,6 +358,8 @@
</span><span class="cx"> // Use Document::registerForPrivateBrowsingStateChangedCallbacks() to subscribe to this.
</span><span class="cx"> virtual void privateBrowsingStateDidChange() { }
</span><span class="cx">
</span><ins>+ virtual void willBecomeFullscreenElement();
+ virtual void ancestorWillEnterFullscreen() { }
</ins><span class="cx"> virtual void didBecomeFullscreenElement() { }
</span><span class="cx"> virtual void willStopBeingFullscreenElement() { }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (197477 => 197478)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaElement.cpp        2016-03-03 00:29:01 UTC (rev 197477)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp        2016-03-03 00:34:19 UTC (rev 197478)
</span><span class="lines">@@ -5277,9 +5277,19 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> #if ENABLE(FULLSCREEN_API)
</span><del>- if (mode == VideoFullscreenModeStandard && document().settings() && document().settings()->fullScreenEnabled()) {
- document().requestFullScreenForElement(this, 0, Document::ExemptIFrameAllowFullScreenRequirement);
- return;
</del><ins>+ if (document().settings()->fullScreenEnabled()) {
+ if (mode == VideoFullscreenModeStandard) {
+ document().requestFullScreenForElement(this, 0, Document::ExemptIFrameAllowFullScreenRequirement);
+ return;
+ }
+
+ // If this media element is not going to standard fullscreen mode but there's
+ // an element that's currently in full screen in the document, exit full screen
+ // if it contains this media element.
+ if (Element* fullscreenElement = document().webkitCurrentFullScreenElement()) {
+ if (fullscreenElement->contains(this))
+ document().webkitCancelFullScreen();
+ }
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="lines">@@ -5328,6 +5338,31 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void HTMLMediaElement::willBecomeFullscreenElement()
+{
+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+ HTMLMediaElementEnums::VideoFullscreenMode oldVideoFullscreenMode = m_videoFullscreenMode;
+#endif
+
+ fullscreenModeChanged(VideoFullscreenModeStandard);
+
+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+ switch (oldVideoFullscreenMode) {
+ case VideoFullscreenModeNone:
+ case VideoFullscreenModeStandard:
+ // Don't need to do anything if we are not in any special fullscreen mode or it's already
+ // in standard fullscreen mode.
+ break;
+ case VideoFullscreenModePictureInPicture:
+ if (is<HTMLVideoElement>(*this))
+ downcast<HTMLVideoElement>(this)->exitToFullscreenModeWithoutAnimationIfPossible(oldVideoFullscreenMode, VideoFullscreenModeStandard);
+ break;
+ }
+#endif
+
+ Element::willBecomeFullscreenElement();
+}
+
</ins><span class="cx"> void HTMLMediaElement::didBecomeFullscreenElement()
</span><span class="cx"> {
</span><span class="cx"> if (hasMediaControls())
</span><span class="lines">@@ -5338,6 +5373,9 @@
</span><span class="cx"> {
</span><span class="cx"> if (hasMediaControls())
</span><span class="cx"> mediaControls()->exitedFullscreen();
</span><ins>+
+ if (fullscreenMode() == VideoFullscreenModeStandard)
+ fullscreenModeChanged(VideoFullscreenModeNone);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> PlatformMedia HTMLMediaElement::platformMedia() const
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (197477 => 197478)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaElement.h        2016-03-03 00:29:01 UTC (rev 197477)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h        2016-03-03 00:34:19 UTC (rev 197478)
</span><span class="lines">@@ -505,6 +505,7 @@
</span><span class="cx"> virtual void removedFrom(ContainerNode&) override;
</span><span class="cx"> virtual void didRecalcStyle(Style::Change) override;
</span><span class="cx">
</span><ins>+ virtual void willBecomeFullscreenElement() override;
</ins><span class="cx"> virtual void didBecomeFullscreenElement() override;
</span><span class="cx"> virtual void willStopBeingFullscreenElement() override;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLVideoElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLVideoElement.cpp (197477 => 197478)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLVideoElement.cpp        2016-03-03 00:29:01 UTC (rev 197477)
+++ trunk/Source/WebCore/html/HTMLVideoElement.cpp        2016-03-03 00:34:19 UTC (rev 197478)
</span><span class="lines">@@ -318,6 +318,18 @@
</span><span class="cx"> return isFullscreen();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void HTMLVideoElement::ancestorWillEnterFullscreen()
+{
+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+ if (fullscreenMode() == VideoFullscreenModeNone)
+ return;
+
+ // If this video element's presentation mode is not inline, but its ancestor
+ // is entering fullscreen, exit its current fullscreen mode.
+ exitToFullscreenModeWithoutAnimationIfPossible(fullscreenMode(), VideoFullscreenModeNone);
+#endif
+}
+
</ins><span class="cx"> #if ENABLE(WIRELESS_PLAYBACK_TARGET)
</span><span class="cx"> bool HTMLVideoElement::webkitWirelessVideoPlaybackDisabled() const
</span><span class="cx"> {
</span><span class="lines">@@ -477,6 +489,14 @@
</span><span class="cx">
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+void HTMLVideoElement::exitToFullscreenModeWithoutAnimationIfPossible(HTMLMediaElementEnums::VideoFullscreenMode fromMode, HTMLMediaElementEnums::VideoFullscreenMode toMode)
+{
+ if (document().page()->chrome().client().supportsVideoFullscreen(fromMode))
+ document().page()->chrome().client().exitVideoFullscreenToModeWithoutAnimation(*this, toMode);
</ins><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><ins>+}
+
</ins><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLVideoElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLVideoElement.h (197477 => 197478)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLVideoElement.h        2016-03-03 00:29:01 UTC (rev 197477)
+++ trunk/Source/WebCore/html/HTMLVideoElement.h        2016-03-03 00:34:19 UTC (rev 197478)
</span><span class="lines">@@ -48,6 +48,8 @@
</span><span class="cx"> bool webkitSupportsFullscreen();
</span><span class="cx"> bool webkitDisplayingFullscreen();
</span><span class="cx">
</span><ins>+ virtual void ancestorWillEnterFullscreen() override;
+
</ins><span class="cx"> // FIXME: Maintain "FullScreen" capitalization scheme for backwards compatibility.
</span><span class="cx"> // https://bugs.webkit.org/show_bug.cgi?id=36081
</span><span class="cx"> void webkitEnterFullScreen(ExceptionCode& ec) { webkitEnterFullscreen(ec); }
</span><span class="lines">@@ -86,6 +88,10 @@
</span><span class="cx"> virtual void fullscreenModeChanged(VideoFullscreenMode) override;
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+ void exitToFullscreenModeWithoutAnimationIfPossible(HTMLMediaElementEnums::VideoFullscreenMode fromMode, HTMLMediaElementEnums::VideoFullscreenMode toMode);
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx"> HTMLVideoElement(const QualifiedName&, Document&, bool);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorepageChromeClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/ChromeClient.h (197477 => 197478)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/ChromeClient.h        2016-03-03 00:29:01 UTC (rev 197477)
+++ trunk/Source/WebCore/page/ChromeClient.h        2016-03-03 00:34:19 UTC (rev 197478)
</span><span class="lines">@@ -344,6 +344,7 @@
</span><span class="cx"> virtual void setUpVideoControlsManager(HTMLVideoElement&) { }
</span><span class="cx"> #endif
</span><span class="cx"> virtual void exitVideoFullscreenForVideoElement(WebCore::HTMLVideoElement&) { }
</span><ins>+ virtual void exitVideoFullscreenToModeWithoutAnimation(WebCore::HTMLVideoElement&, HTMLMediaElementEnums::VideoFullscreenMode /*targetMode*/) { }
</ins><span class="cx"> virtual bool requiresFullscreenForVideoPlayback() { return false; }
</span><span class="cx">
</span><span class="cx"> #if ENABLE(FULLSCREEN_API)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmacWebVideoFullscreenInterfaceMach"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.h (197477 => 197478)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.h        2016-03-03 00:29:01 UTC (rev 197477)
+++ trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.h        2016-03-03 00:34:19 UTC (rev 197478)
</span><span class="lines">@@ -77,6 +77,7 @@
</span><span class="cx"> WEBCORE_EXPORT void setupFullscreen(NSView& layerHostedView, const IntRect& initialRect, NSWindow *parentWindow, HTMLMediaElementEnums::VideoFullscreenMode, bool allowsPictureInPicturePlayback);
</span><span class="cx"> WEBCORE_EXPORT void enterFullscreen();
</span><span class="cx"> WEBCORE_EXPORT void exitFullscreen(const IntRect& finalRect, NSWindow *parentWindow);
</span><ins>+ WEBCORE_EXPORT void exitFullscreenWithoutAnimationToMode(HTMLMediaElementEnums::VideoFullscreenMode);
</ins><span class="cx"> WEBCORE_EXPORT void cleanupFullscreen();
</span><span class="cx"> WEBCORE_EXPORT void invalidate();
</span><span class="cx"> WEBCORE_EXPORT void requestHideAndExitFullscreen() { }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmacWebVideoFullscreenInterfaceMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm (197477 => 197478)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm        2016-03-03 00:29:01 UTC (rev 197477)
+++ trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm        2016-03-03 00:34:19 UTC (rev 197478)
</span><span class="lines">@@ -261,6 +261,10 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void WebVideoFullscreenInterfaceMac::exitFullscreenWithoutAnimationToMode(HTMLMediaElementEnums::VideoFullscreenMode)
+{
+}
+
</ins><span class="cx"> void WebVideoFullscreenInterfaceMac::cleanupFullscreen()
</span><span class="cx"> {
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (197477 => 197478)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-03-03 00:29:01 UTC (rev 197477)
+++ trunk/Source/WebKit2/ChangeLog        2016-03-03 00:34:19 UTC (rev 197478)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2016-03-01 Ada Chan <adachan@apple.com>
+
+ Update the media element's presentation mode properly after going in and out of full screen via the Full Screen API
+ https://bugs.webkit.org/show_bug.cgi?id=154834
+
+ Reviewed by Simon Fraser.
+
+ * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h:
+ * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in:
+ * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
+ (WebKit::WebVideoFullscreenManagerProxy::exitFullscreenWithoutAnimationToMode):
+ Call the new exitFullscreenWithoutAnimationToMode() method on WebVideoFullscreenInterfaceMac.
+ * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+ (WebKit::WebChromeClient::exitVideoFullscreenToModeWithoutAnimation):
+ * WebProcess/WebCoreSupport/WebChromeClient.h:
+ * WebProcess/cocoa/WebVideoFullscreenManager.h:
+ * WebProcess/cocoa/WebVideoFullscreenManager.mm:
+ (WebKit::WebVideoFullscreenManager::exitVideoFullscreenToModeWithoutAnimation):
+
</ins><span class="cx"> 2016-03-02 Beth Dakin <bdakin@apple.com>
</span><span class="cx">
</span><span class="cx"> Crashes in media tests after http://trac.webkit.org/changeset/197461
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaWebVideoFullscreenManagerProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h (197477 => 197478)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h        2016-03-03 00:29:01 UTC (rev 197477)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h        2016-03-03 00:34:19 UTC (rev 197478)
</span><span class="lines">@@ -152,6 +152,9 @@
</span><span class="cx"> void exitFullscreen(uint64_t contextId, WebCore::IntRect finalRect);
</span><span class="cx"> void cleanupFullscreen(uint64_t contextId);
</span><span class="cx"> void preparedToReturnToInline(uint64_t contextId, bool visible, WebCore::IntRect inlineRect);
</span><ins>+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+ void exitFullscreenWithoutAnimationToMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode);
+#endif
</ins><span class="cx">
</span><span class="cx"> // Messages to WebVideoFullscreenManager
</span><span class="cx"> void play(uint64_t contextId);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaWebVideoFullscreenManagerProxymessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in (197477 => 197478)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in        2016-03-03 00:29:01 UTC (rev 197477)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in        2016-03-03 00:34:19 UTC (rev 197478)
</span><span class="lines">@@ -40,5 +40,8 @@
</span><span class="cx"> CleanupFullscreen(uint64_t contextId)
</span><span class="cx"> PreparedToReturnToInline(uint64_t contextId, bool visible, WebCore::IntRect inlineRect)
</span><span class="cx"> SetUpVideoControlsManagerWithID(uint64_t contextId)
</span><ins>+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+ ExitFullscreenWithoutAnimationToMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode videoFullscreenMode)
+#endif
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaWebVideoFullscreenManagerProxymm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm (197477 => 197478)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm        2016-03-03 00:29:01 UTC (rev 197477)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm        2016-03-03 00:34:19 UTC (rev 197478)
</span><span class="lines">@@ -491,6 +491,13 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+void WebVideoFullscreenManagerProxy::exitFullscreenWithoutAnimationToMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode targetMode)
+{
+ ensureInterface(contextId).exitFullscreenWithoutAnimationToMode(targetMode);
+}
+#endif
+
</ins><span class="cx"> void WebVideoFullscreenManagerProxy::cleanupFullscreen(uint64_t contextId)
</span><span class="cx"> {
</span><span class="cx"> ensureInterface(contextId).cleanupFullscreen();
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (197477 => 197478)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp        2016-03-03 00:29:01 UTC (rev 197477)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp        2016-03-03 00:34:19 UTC (rev 197478)
</span><span class="lines">@@ -870,7 +870,15 @@
</span><span class="cx"> {
</span><span class="cx"> m_page->videoFullscreenManager()->exitVideoFullscreenForVideoElement(videoElement);
</span><span class="cx"> }
</span><ins>+
+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+void WebChromeClient::exitVideoFullscreenToModeWithoutAnimation(WebCore::HTMLVideoElement& videoElement, HTMLMediaElementEnums::VideoFullscreenMode targetMode)
+{
+ m_page->videoFullscreenManager()->exitVideoFullscreenToModeWithoutAnimation(videoElement, targetMode);
+}
</ins><span class="cx"> #endif
</span><ins>+
+#endif
</ins><span class="cx">
</span><span class="cx"> #if ENABLE(FULLSCREEN_API)
</span><span class="cx"> bool WebChromeClient::supportsFullScreenForElement(const WebCore::Element*, bool withKeyboard)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h (197477 => 197478)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h        2016-03-03 00:29:01 UTC (rev 197477)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h        2016-03-03 00:34:19 UTC (rev 197478)
</span><span class="lines">@@ -247,7 +247,10 @@
</span><span class="cx"> virtual void setUpVideoControlsManager(WebCore::HTMLVideoElement&) override;
</span><span class="cx"> virtual void enterVideoFullscreenForVideoElement(WebCore::HTMLVideoElement&, WebCore::HTMLMediaElementEnums::VideoFullscreenMode) override;
</span><span class="cx"> virtual void exitVideoFullscreenForVideoElement(WebCore::HTMLVideoElement&) override;
</span><ins>+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+ virtual void exitVideoFullscreenToModeWithoutAnimation(WebCore::HTMLVideoElement&, WebCore::HTMLMediaElementEnums::VideoFullscreenMode) override;
</ins><span class="cx"> #endif
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> #if ENABLE(FULLSCREEN_API)
</span><span class="cx"> virtual bool supportsFullScreenForElement(const WebCore::Element*, bool withKeyboard) override;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcesscocoaWebVideoFullscreenManagerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.h (197477 => 197478)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.h        2016-03-03 00:29:01 UTC (rev 197477)
+++ trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.h        2016-03-03 00:34:19 UTC (rev 197478)
</span><span class="lines">@@ -116,6 +116,7 @@
</span><span class="cx"> bool supportsVideoFullscreen(WebCore::HTMLMediaElementEnums::VideoFullscreenMode) const;
</span><span class="cx"> void enterVideoFullscreenForVideoElement(WebCore::HTMLVideoElement&, WebCore::HTMLMediaElementEnums::VideoFullscreenMode);
</span><span class="cx"> void exitVideoFullscreenForVideoElement(WebCore::HTMLVideoElement&);
</span><ins>+ void exitVideoFullscreenToModeWithoutAnimation(WebCore::HTMLVideoElement&, WebCore::HTMLMediaElementEnums::VideoFullscreenMode);
</ins><span class="cx"> void setUpVideoControlsManager(WebCore::HTMLVideoElement&);
</span><span class="cx">
</span><span class="cx"> protected:
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcesscocoaWebVideoFullscreenManagermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm (197477 => 197478)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm        2016-03-03 00:29:01 UTC (rev 197477)
+++ trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm        2016-03-03 00:34:19 UTC (rev 197478)
</span><span class="lines">@@ -307,6 +307,23 @@
</span><span class="cx"> m_page->send(Messages::WebVideoFullscreenManagerProxy::SetUpVideoControlsManagerWithID(contextId), m_page->pageID());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void WebVideoFullscreenManager::exitVideoFullscreenToModeWithoutAnimation(WebCore::HTMLVideoElement& videoElement, WebCore::HTMLMediaElementEnums::VideoFullscreenMode targetMode)
+{
+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+ ASSERT(m_videoElements.contains(&videoElement));
+
+ uint64_t contextId = m_videoElements.get(&videoElement);
+ auto& interface = ensureInterface(contextId);
+
+ interface.setTargetIsFullscreen(false);
+
+ m_page->send(Messages::WebVideoFullscreenManagerProxy::ExitFullscreenWithoutAnimationToMode(contextId, targetMode), m_page->pageID());
+#else
+ UNUSED_PARAM(videoElement);
+ UNUSED_PARAM(targetMode);
+#endif
+}
+
</ins><span class="cx"> #pragma mark Interface to WebVideoFullscreenInterfaceContext:
</span><span class="cx">
</span><span class="cx"> void WebVideoFullscreenManager::resetMediaState(uint64_t contextId)
</span></span></pre>
</div>
</div>
</body>
</html>