<!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>[187251] 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/187251">187251</a></dd>
<dt>Author</dt> <dd>jer.noble@apple.com</dd>
<dt>Date</dt> <dd>2015-07-23 14:15:28 -0700 (Thu, 23 Jul 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>[iOS] Add an explicit API to allow media documents to (temporarily) play inline
https://bugs.webkit.org/show_bug.cgi?id=147181

Reviewed by Beth Dakin.

Source/WebCore:

Add listeners for the new allowsMediaDocumentInlinePlayback API. When this value becomes
NO, force any playing MediaDocuments to enter fullscreen mode.

* dom/Document.cpp:
(WebCore::Document::registerForAllowsMediaDocumentInlinePlaybackChangedCallbacks): Added registration method.
(WebCore::Document::unregisterForAllowsMediaDocumentInlinePlaybackChangedCallbacks): Added deregistration method.
(WebCore::Document::allowsMediaDocumentInlinePlaybackChanged): Notify all listeners.
* dom/Document.h:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::registerWithDocument): Listen for allowsMediaDocumentInlinePlayback changes.
(WebCore::HTMLMediaElement::unregisterWithDocument): Stop listening to same.
(WebCore::HTMLMediaElement::allowsMediaDocumentInlinePlaybackChanged): Enter fullscreen mode if the value
    changes to false during playback.
* html/HTMLMediaElement.h:
* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::requiresFullscreenForVideoPlayback): Early true if the override value is set.
* page/Page.cpp:
(WebCore::Page::setAllowsMediaDocumentInlinePlayback): Notify all documents of the changed value.
* page/Page.h:
(WebCore::Page::allowsMediaDocumentInlinePlayback): Simple getter.

Source/WebKit2:

Add a WKWebView(Private) API which allows MediaDocuments loaded by the view to play their contents inline, regardless
of whether inline playback is restricted on the current device.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _setRequiresUserActionForMediaPlayback:]): Added. Pass through to WebPageProxy.
(-[WKWebView _allowsMediaDocumentInlinePlayback]): Ditto.
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::allowsMediaDocumentInlinePlayback): Simple getter.
(WebKit::WebPageProxy::setAllowsMediaDocumentInlinePlayback): Set, and conditionally pass the new value to WebPage.
* UIProcess/WebPageProxy.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setAllowsMediaDocumentInlinePlayback): Set, and conditionally notify WebCore page of the change.
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::allowsMediaDocumentInlinePlayback): Simple getter.
* WebProcess/WebPage/WebPage.messages.in: Add new messages.</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="#trunkSourceWebCoredomDocumenth">trunk/Source/WebCore/dom/Document.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="#trunkSourceWebCorehtmlMediaElementSessioncpp">trunk/Source/WebCore/html/MediaElementSession.cpp</a></li>
<li><a href="#trunkSourceWebCorepagePagecpp">trunk/Source/WebCore/page/Page.cpp</a></li>
<li><a href="#trunkSourceWebCorepagePageh">trunk/Source/WebCore/page/Page.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewPrivateh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxycpp">trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxyh">trunk/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagecpp">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPageh">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagemessagesin">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (187250 => 187251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-07-23 20:53:47 UTC (rev 187250)
+++ trunk/Source/WebCore/ChangeLog        2015-07-23 21:15:28 UTC (rev 187251)
</span><span class="lines">@@ -1,3 +1,31 @@
</span><ins>+2015-07-21  Jer Noble  &lt;jer.noble@apple.com&gt;
+
+        [iOS] Add an explicit API to allow media documents to (temporarily) play inline
+        https://bugs.webkit.org/show_bug.cgi?id=147181
+
+        Reviewed by Beth Dakin.
+
+        Add listeners for the new allowsMediaDocumentInlinePlayback API. When this value becomes
+        NO, force any playing MediaDocuments to enter fullscreen mode.
+
+        * dom/Document.cpp:
+        (WebCore::Document::registerForAllowsMediaDocumentInlinePlaybackChangedCallbacks): Added registration method.
+        (WebCore::Document::unregisterForAllowsMediaDocumentInlinePlaybackChangedCallbacks): Added deregistration method.
+        (WebCore::Document::allowsMediaDocumentInlinePlaybackChanged): Notify all listeners.
+        * dom/Document.h:
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::registerWithDocument): Listen for allowsMediaDocumentInlinePlayback changes.
+        (WebCore::HTMLMediaElement::unregisterWithDocument): Stop listening to same.
+        (WebCore::HTMLMediaElement::allowsMediaDocumentInlinePlaybackChanged): Enter fullscreen mode if the value
+            changes to false during playback.
+        * html/HTMLMediaElement.h:
+        * html/MediaElementSession.cpp:
+        (WebCore::MediaElementSession::requiresFullscreenForVideoPlayback): Early true if the override value is set.
+        * page/Page.cpp:
+        (WebCore::Page::setAllowsMediaDocumentInlinePlayback): Notify all documents of the changed value.
+        * page/Page.h:
+        (WebCore::Page::allowsMediaDocumentInlinePlayback): Simple getter.
+
</ins><span class="cx"> 2015-07-23  Devin Rousso  &lt;drousso@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Add a function to CSSCompletions to get a list of supported system fonts
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (187250 => 187251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp        2015-07-23 20:53:47 UTC (rev 187250)
+++ trunk/Source/WebCore/dom/Document.cpp        2015-07-23 21:15:28 UTC (rev 187251)
</span><span class="lines">@@ -1614,6 +1614,25 @@
</span><span class="cx">     return pageVisibilityState() != PageVisibilityStateVisible;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+
+#if ENABLE(VIDEO)
+void Document::registerForAllowsMediaDocumentInlinePlaybackChangedCallbacks(HTMLMediaElement&amp; element)
+{
+    m_allowsMediaDocumentInlinePlaybackElements.add(&amp;element);
+}
+
+void Document::unregisterForAllowsMediaDocumentInlinePlaybackChangedCallbacks(HTMLMediaElement&amp; element)
+{
+    m_allowsMediaDocumentInlinePlaybackElements.remove(&amp;element);
+}
+
+void Document::allowsMediaDocumentInlinePlaybackChanged()
+{
+    for (auto* element : m_allowsMediaDocumentInlinePlaybackElements)
+        element-&gt;allowsMediaDocumentInlinePlaybackChanged();
+}
+#endif
+
</ins><span class="cx"> #if ENABLE(CSP_NEXT)
</span><span class="cx"> DOMSecurityPolicy&amp; Document::securityPolicy()
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.h (187250 => 187251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.h        2015-07-23 20:53:47 UTC (rev 187250)
+++ trunk/Source/WebCore/dom/Document.h        2015-07-23 21:15:28 UTC (rev 187251)
</span><span class="lines">@@ -1014,6 +1014,12 @@
</span><span class="cx">     void registerForVisibilityStateChangedCallbacks(Element*);
</span><span class="cx">     void unregisterForVisibilityStateChangedCallbacks(Element*);
</span><span class="cx"> 
</span><ins>+#if ENABLE(VIDEO)
+    void registerForAllowsMediaDocumentInlinePlaybackChangedCallbacks(HTMLMediaElement&amp;);
+    void unregisterForAllowsMediaDocumentInlinePlaybackChangedCallbacks(HTMLMediaElement&amp;);
+    void allowsMediaDocumentInlinePlaybackChanged();
+#endif
+
</ins><span class="cx">     WEBCORE_EXPORT void setShouldCreateRenderers(bool);
</span><span class="cx">     bool shouldCreateRenderers();
</span><span class="cx"> 
</span><span class="lines">@@ -1550,6 +1556,9 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     HashSet&lt;Element*&gt; m_visibilityStateCallbackElements;
</span><ins>+#if ENABLE(VIDEO)
+    HashSet&lt;HTMLMediaElement*&gt; m_allowsMediaDocumentInlinePlaybackElements;
+#endif
</ins><span class="cx"> 
</span><span class="cx">     HashMap&lt;StringImpl*, Element*, CaseFoldingHash&gt; m_elementsByAccessKey;
</span><span class="cx">     bool m_accessKeyMapValid;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (187250 => 187251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaElement.cpp        2015-07-23 20:53:47 UTC (rev 187250)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp        2015-07-23 21:15:28 UTC (rev 187251)
</span><span class="lines">@@ -518,6 +518,8 @@
</span><span class="cx">     document.registerForPageCacheSuspensionCallbacks(this);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    document.registerForAllowsMediaDocumentInlinePlaybackChangedCallbacks(*this);
+
</ins><span class="cx">     document.addAudioProducer(this);
</span><span class="cx">     addElementToDocumentMap(*this, document);
</span><span class="cx"> }
</span><span class="lines">@@ -550,6 +552,8 @@
</span><span class="cx">     document.unregisterForPageCacheSuspensionCallbacks(this);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    document.unregisterForAllowsMediaDocumentInlinePlaybackChangedCallbacks(*this);
+
</ins><span class="cx">     document.removeAudioProducer(this);
</span><span class="cx">     removeElementFromDocumentMap(*this, document);
</span><span class="cx"> }
</span><span class="lines">@@ -3882,7 +3886,7 @@
</span><span class="cx">     m_resizeTaskQueue.enqueueTask(task);
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><del>-    
</del><ins>+
</ins><span class="cx"> void HTMLMediaElement::setSelectedTextTrack(TextTrack* trackToSelect)
</span><span class="cx"> {
</span><span class="cx">     TextTrackList* trackList = textTracks();
</span><span class="lines">@@ -6528,6 +6532,12 @@
</span><span class="cx"> 
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+void HTMLMediaElement::allowsMediaDocumentInlinePlaybackChanged()
+{
+    if (potentiallyPlaying() &amp;&amp; m_mediaSession-&gt;requiresFullscreenForVideoPlayback(*this) &amp;&amp; !isFullscreen())
+        enterFullscreen();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+}
+
</ins><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (187250 => 187251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaElement.h        2015-07-23 20:53:47 UTC (rev 187250)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h        2015-07-23 21:15:28 UTC (rev 187251)
</span><span class="lines">@@ -448,6 +448,8 @@
</span><span class="cx"> 
</span><span class="cx">     void layoutSizeChanged();
</span><span class="cx"> 
</span><ins>+    void allowsMediaDocumentInlinePlaybackChanged();
+
</ins><span class="cx"> protected:
</span><span class="cx">     HTMLMediaElement(const QualifiedName&amp;, Document&amp;, bool);
</span><span class="cx">     virtual ~HTMLMediaElement();
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlMediaElementSessioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/MediaElementSession.cpp (187250 => 187251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/MediaElementSession.cpp        2015-07-23 20:53:47 UTC (rev 187250)
+++ trunk/Source/WebCore/html/MediaElementSession.cpp        2015-07-23 21:15:28 UTC (rev 187251)
</span><span class="lines">@@ -344,6 +344,10 @@
</span><span class="cx"> 
</span><span class="cx"> bool MediaElementSession::requiresFullscreenForVideoPlayback(const HTMLMediaElement&amp; element) const
</span><span class="cx"> {
</span><ins>+    Page* page = element.document().page();
+    if (element.document().isMediaDocument() &amp;&amp; !element.document().ownerElement() &amp;&amp; page &amp;&amp; page-&gt;allowsMediaDocumentInlinePlayback())
+        return false;
+
</ins><span class="cx">     if (!PlatformMediaSessionManager::sharedManager().sessionRestrictsInlineVideoPlayback(*this))
</span><span class="cx">         return false;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepagePagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Page.cpp (187250 => 187251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Page.cpp        2015-07-23 20:53:47 UTC (rev 187250)
+++ trunk/Source/WebCore/page/Page.cpp        2015-07-23 21:15:28 UTC (rev 187251)
</span><span class="lines">@@ -1736,4 +1736,20 @@
</span><span class="cx">     return *m_testTrigger;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(VIDEO)
+void Page::setAllowsMediaDocumentInlinePlayback(bool flag)
+{
+    if (m_allowsMediaDocumentInlinePlayback == flag)
+        return;
+    m_allowsMediaDocumentInlinePlayback = flag;
+
+    Vector&lt;Ref&lt;Document&gt;&gt; documents;
+    for (Frame* frame = m_mainFrame.get(); frame; frame = frame-&gt;tree().traverseNext())
+        documents.append(*frame-&gt;document());
+
+    for (auto&amp; document : documents)
+        document-&gt;allowsMediaDocumentInlinePlaybackChanged();
+}
+#endif
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorepagePageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Page.h (187250 => 187251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Page.h        2015-07-23 20:53:47 UTC (rev 187250)
+++ trunk/Source/WebCore/page/Page.h        2015-07-23 21:15:28 UTC (rev 187251)
</span><span class="lines">@@ -460,6 +460,11 @@
</span><span class="cx">     void clearTrigger() { m_testTrigger = nullptr; }
</span><span class="cx">     bool expectsWheelEventTriggers() const { return !!m_testTrigger; }
</span><span class="cx"> 
</span><ins>+#if ENABLE(VIDEO)
+    WEBCORE_EXPORT bool allowsMediaDocumentInlinePlayback() const { return m_allowsMediaDocumentInlinePlayback; }
+    WEBCORE_EXPORT void setAllowsMediaDocumentInlinePlayback(bool);
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx">     WEBCORE_EXPORT void initGroup();
</span><span class="cx"> 
</span><span class="lines">@@ -619,6 +624,7 @@
</span><span class="cx">     MediaProducer::MediaStateFlags m_mediaState { MediaProducer::IsNotPlaying };
</span><span class="cx">     
</span><span class="cx">     bool m_userContentExtensionsEnabled { true };
</span><ins>+    bool m_allowsMediaDocumentInlinePlayback { false };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> inline PageGroup&amp; Page::group()
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (187250 => 187251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-07-23 20:53:47 UTC (rev 187250)
+++ trunk/Source/WebKit2/ChangeLog        2015-07-23 21:15:28 UTC (rev 187251)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2015-07-21  Jer Noble  &lt;jer.noble@apple.com&gt;
+
+        [iOS] Add an explicit API to allow media documents to (temporarily) play inline
+        https://bugs.webkit.org/show_bug.cgi?id=147181
+
+        Reviewed by Beth Dakin.
+
+        Add a WKWebView(Private) API which allows MediaDocuments loaded by the view to play their contents inline, regardless
+        of whether inline playback is restricted on the current device.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _setRequiresUserActionForMediaPlayback:]): Added. Pass through to WebPageProxy.
+        (-[WKWebView _allowsMediaDocumentInlinePlayback]): Ditto.
+        * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::allowsMediaDocumentInlinePlayback): Simple getter.
+        (WebKit::WebPageProxy::setAllowsMediaDocumentInlinePlayback): Set, and conditionally pass the new value to WebPage.
+        * UIProcess/WebPageProxy.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::setAllowsMediaDocumentInlinePlayback): Set, and conditionally notify WebCore page of the change.
+        * WebProcess/WebPage/WebPage.h:
+        (WebKit::WebPage::allowsMediaDocumentInlinePlayback): Simple getter.
+        * WebProcess/WebPage/WebPage.messages.in: Add new messages.
+
</ins><span class="cx"> 2015-07-23  Beth Dakin  &lt;bdakin@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Should not allow previews of 1x1 images
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (187250 => 187251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2015-07-23 20:53:47 UTC (rev 187250)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2015-07-23 21:15:28 UTC (rev 187251)
</span><span class="lines">@@ -2583,6 +2583,24 @@
</span><span class="cx">     return nil;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#pragma mark media playback restrictions
+
+- (BOOL)_allowsMediaDocumentInlinePlayback
+{
+#if PLATFORM(IOS)
+    return _page-&gt;allowsMediaDocumentInlinePlayback();
+#else
+    return NO;
+#endif
+}
+
+- (void)_setAllowsMediaDocumentInlinePlayback:(BOOL)flag
+{
+#if PLATFORM(IOS)
+    _page-&gt;setAllowsMediaDocumentInlinePlayback(flag);
+#endif
+}
+
</ins><span class="cx"> #pragma mark iOS-specific methods
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h (187250 => 187251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h        2015-07-23 20:53:47 UTC (rev 187250)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h        2015-07-23 21:15:28 UTC (rev 187251)
</span><span class="lines">@@ -208,6 +208,9 @@
</span><span class="cx"> @property (nonatomic, readonly) NSArray *_scrollPerformanceData WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
</span><span class="cx"> 
</span><span class="cx"> - (void)_saveBackForwardSnapshotForItem:(WKBackForwardListItem *)item WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
</span><ins>+
+@property (nonatomic, getter=_allowsMediaDocumentInlinePlayback, setter=_setAllowsMediaDocumentInlinePlayback:) BOOL _allowsMediaDocumentInlinePlayback;
+
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (187250 => 187251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2015-07-23 20:53:47 UTC (rev 187250)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2015-07-23 21:15:28 UTC (rev 187251)
</span><span class="lines">@@ -3983,6 +3983,20 @@
</span><span class="cx"> {
</span><span class="cx">     return m_videoFullscreenManager;
</span><span class="cx"> }
</span><ins>+
+bool WebPageProxy::allowsMediaDocumentInlinePlayback() const
+{
+    return m_allowsMediaDocumentInlinePlayback;
+}
+
+void WebPageProxy::setAllowsMediaDocumentInlinePlayback(bool allows)
+{
+    if (m_allowsMediaDocumentInlinePlayback == allows)
+        return;
+    m_allowsMediaDocumentInlinePlayback = allows;
+
+    m_process-&gt;send(Messages::WebPage::SetAllowsMediaDocumentInlinePlayback(flag), m_pageID);
+}
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> // BackForwardList
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (187250 => 187251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2015-07-23 20:53:47 UTC (rev 187250)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2015-07-23 21:15:28 UTC (rev 187251)
</span><span class="lines">@@ -333,6 +333,9 @@
</span><span class="cx"> #endif
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     RefPtr&lt;WebVideoFullscreenManagerProxy&gt; videoFullscreenManager();
</span><ins>+
+    bool allowsMediaDocumentInlinePlayback() const;
+    void setAllowsMediaDocumentInlinePlayback(bool);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(CONTEXT_MENUS)
</span><span class="lines">@@ -1574,6 +1577,7 @@
</span><span class="cx">     WebCore::ViewState::Flags m_viewState;
</span><span class="cx">     bool m_viewWasEverInWindow;
</span><span class="cx"> #if PLATFORM(IOS)
</span><ins>+    bool m_allowsMediaDocumentInlinePlayback { false };
</ins><span class="cx">     bool m_alwaysRunsAtForegroundPriority;
</span><span class="cx">     ProcessThrottler::ForegroundActivityToken m_activityToken;
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (187250 => 187251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2015-07-23 20:53:47 UTC (rev 187250)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2015-07-23 21:15:28 UTC (rev 187251)
</span><span class="lines">@@ -3009,6 +3009,11 @@
</span><span class="cx">         m_videoFullscreenManager = WebVideoFullscreenManager::create(this);
</span><span class="cx">     return m_videoFullscreenManager.get();
</span><span class="cx"> }
</span><ins>+
+void WebPage::setAllowsMediaDocumentInlinePlayback(bool allows)
+{
+    m_page-&gt;setAllowsMediaDocumentInlinePlayback(allows);
+}
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(FULLSCREEN_API)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (187250 => 187251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2015-07-23 20:53:47 UTC (rev 187250)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2015-07-23 21:15:28 UTC (rev 187251)
</span><span class="lines">@@ -236,6 +236,8 @@
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     WebVideoFullscreenManager* videoFullscreenManager();
</span><ins>+    void setAllowsMediaDocumentInlinePlayback(bool);
+    bool allowsMediaDocumentInlinePlayback() const { return m_allowsMediaDocumentInlinePlayback; }
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(FULLSCREEN_API)
</span><span class="lines">@@ -1258,6 +1260,7 @@
</span><span class="cx">     RefPtr&lt;WebInspectorUI&gt; m_inspectorUI;
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     RefPtr&lt;WebVideoFullscreenManager&gt; m_videoFullscreenManager;
</span><ins>+    bool m_allowsMediaDocumentInlinePlayback { false };
</ins><span class="cx"> #endif
</span><span class="cx"> #if ENABLE(FULLSCREEN_API)
</span><span class="cx">     RefPtr&lt;WebFullScreenManager&gt; m_fullScreenManager;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagemessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (187250 => 187251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in        2015-07-23 20:53:47 UTC (rev 187250)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in        2015-07-23 21:15:28 UTC (rev 187251)
</span><span class="lines">@@ -95,6 +95,7 @@
</span><span class="cx">     ContentSizeCategoryDidChange(String contentSizeCategory)
</span><span class="cx">     ExecuteEditCommandWithCallback(String name, uint64_t callbackID)
</span><span class="cx">     GetLookupContextAtPoint(WebCore::IntPoint point, uint64_t callbackID)
</span><ins>+    SetAllowsMediaDocumentInlinePlayback(bool allows)
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(REMOTE_INSPECTOR)
</span></span></pre>
</div>
</div>

</body>
</html>