Title: [187390] branches/safari-601.1-branch/Source
Revision
187390
Author
[email protected]
Date
2015-07-25 10:51:21 -0700 (Sat, 25 Jul 2015)

Log Message

Merge r187251, r187252, r187262, r187263, r187272, r187289. rdar://problem/20689512

Source/WebCore:

    2015-07-21  Jer Noble  <[email protected]>

    Notify the UI delegate when a MediaDocument's natural size changes
    https://bugs.webkit.org/show_bug.cgi?id=147182

    Reviewed by Simon Fraser.

    Notify the MediaDocument that it's underlying media element has changed its natural size, either when
    the media engine notifies us that the size changed, or when the ready state progresses to HAVE_METADATA.

    * html/HTMLMediaElement.cpp:
    (WebCore::HTMLMediaElement::setReadyState): Notify the media document.
    (WebCore::HTMLMediaElement::mediaPlayerSizeChanged): Ditto.
    * html/MediaDocument.cpp:
    (WebCore::MediaDocument::mediaElementNaturalSizeChanged): Pass to the chrome client.
    * html/MediaDocument.h:
    * page/ChromeClient.h:

    2015-07-23  Jer Noble  <[email protected]>

    Relax media playback restrictions if the allowsMediaDocumentInlinePlayback property is set.
    https://bugs.webkit.org/show_bug.cgi?id=147234

    Reviewed by Darin Adler.

    * html/HTMLMediaElement.cpp:
    (WebCore::HTMLMediaElement::prepareForLoad): Moved restriction check into MediaElementSession.
    * html/MediaElementSession.cpp:
    (WebCore::MediaElementSession::playbackPermitted): Check if is a top-level media document and if
        allowsMediaDocumentInilnePlayback is set, and return early.
    (WebCore::MediaElementSession::effectivePreloadForElement): Ditto.
    (WebCore::MediaElementSession::allowsAutomaticMediaDataLoading): Ditto.
    * html/MediaElementSession.h:

    2015-07-21  Jer Noble  <[email protected]>

    [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.

Source/WebKit2:

    2015-07-23  Alex Christensen  <[email protected]>

    Fix 32-bit build after r187272.

    * UIProcess/mac/PageClientImpl.mm:
    (WebKit::PageClientImpl::mediaDocumentNaturalSizeChanged):
    Added some WK_API_ENABLED.

    2015-07-23  Alex Christensen  <[email protected]>

    [iOS] Unreviewed build fix after r187251.

    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::setAllowsMediaDocumentInlinePlayback):
    Use the correct name for the boolean to pass along to SetAllowsMediaDocumentInlinePlayback.

    2015-07-21  Jer Noble  <[email protected]>

    Notify the UI delegate when a MediaDocument's natural size changes
    https://bugs.webkit.org/show_bug.cgi?id=147182

    Reviewed by Simon Fraser.

    Pipe notifications of media document natural size changes up from the chrome client, through
    to the UIProcess,  through the page client, through the WKWebView, to the UIDelegate.

    * UIProcess/API/APIUIClient.h:
    (API::UIClient::mediaDocumentNaturalSizeChanged):
    * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
    * UIProcess/API/Cocoa/WKWebView.mm:
    (-[WKWebView _mediaDocumentNaturalSizeChanged:]):
    * UIProcess/API/Cocoa/WKWebViewInternal.h:
    * UIProcess/Cocoa/UIDelegate.h:
    * UIProcess/Cocoa/UIDelegate.mm:
    (WebKit::UIDelegate::setDelegate):
    (WebKit::UIDelegate::UIClient::mediaDocumentNaturalSizeChanged):
    * UIProcess/PageClient.h:
    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::mediaDocumentNaturalSizeChanged):
    * UIProcess/WebPageProxy.h:
    * UIProcess/WebPageProxy.messages.in:
    * UIProcess/ios/PageClientImplIOS.h:
    * UIProcess/ios/PageClientImplIOS.mm:
    (WebKit::PageClientImpl::mediaDocumentNaturalSizeChanged):
    * UIProcess/mac/PageClientImpl.h:
    * UIProcess/mac/PageClientImpl.mm:
    (WebKit::PageClientImpl::mediaDocumentNaturalSizeChanged):
    * WebProcess/WebCoreSupport/WebChromeClient.h:
    * WebProcess/WebCoreSupport/WebChromeClient.cpp:
    (WebKit::WebChromeClient::mediaDocumentNaturalSizeChanged):
    * WebProcess/WebPage/WebPage.cpp:
    (WebKit::WebPage::mediaDocumentNaturalSizeChanged):
    * WebProcess/WebPage/WebPage.h:
    * UIProcess/API/gtk/PageClientImpl.h: Add default, empty implementation of new pure-virtual method.
    * UIProcess/efl/WebViewEfl.h: Ditto.

    2015-07-23  Jer Noble  <[email protected]>

    Unreviewed build fix after r187251; rename flag -> allows.

    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::setAllowsMediaDocumentInlinePlayback):

    2015-07-23  Jer Noble  <[email protected]>

    [WK2] Add a WKWebView property for whether the view is displaying a media document
    https://bugs.webkit.org/show_bug.cgi?id=147233

    Reviewed by Beth Dakin.

    Add a _isDisplayingStandaloneMediaDocument property, which queries the frame for whether
    the current MIME type is one which our media engines support.

    * UIProcess/API/Cocoa/WKWebView.mm:
    (-[WKWebView _isDisplayingStandaloneMediaDocument]):
    * UIProcess/API/Cocoa/WKWebViewPrivate.h:
    * UIProcess/WebFrameProxy.cpp:
    (WebKit::WebFrameProxy::isDisplayingStandaloneMediaDocument):
    * UIProcess/WebFrameProxy.h:

    2015-07-21  Jer Noble  <[email protected]>

    [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.

Modified Paths

Diff

Modified: branches/safari-601.1-branch/Source/WebCore/ChangeLog (187389 => 187390)


--- branches/safari-601.1-branch/Source/WebCore/ChangeLog	2015-07-25 14:46:20 UTC (rev 187389)
+++ branches/safari-601.1-branch/Source/WebCore/ChangeLog	2015-07-25 17:51:21 UTC (rev 187390)
@@ -1,3 +1,69 @@
+2015-07-24  Jer Noble  <[email protected]>
+
+        Merge r187251, r187252, r187262, r187263, r187272, r187289. rdar://problem/20689512
+
+    2015-07-21  Jer Noble  <[email protected]>
+
+            Notify the UI delegate when a MediaDocument's natural size changes
+            https://bugs.webkit.org/show_bug.cgi?id=147182
+
+            Reviewed by Simon Fraser.
+
+            Notify the MediaDocument that it's underlying media element has changed its natural size, either when
+            the media engine notifies us that the size changed, or when the ready state progresses to HAVE_METADATA.
+
+            * html/HTMLMediaElement.cpp:
+            (WebCore::HTMLMediaElement::setReadyState): Notify the media document.
+            (WebCore::HTMLMediaElement::mediaPlayerSizeChanged): Ditto.
+            * html/MediaDocument.cpp:
+            (WebCore::MediaDocument::mediaElementNaturalSizeChanged): Pass to the chrome client.
+            * html/MediaDocument.h:
+            * page/ChromeClient.h:
+
+    2015-07-23  Jer Noble  <[email protected]>
+
+            Relax media playback restrictions if the allowsMediaDocumentInlinePlayback property is set.
+            https://bugs.webkit.org/show_bug.cgi?id=147234
+
+            Reviewed by Darin Adler.
+
+            * html/HTMLMediaElement.cpp:
+            (WebCore::HTMLMediaElement::prepareForLoad): Moved restriction check into MediaElementSession.
+            * html/MediaElementSession.cpp:
+            (WebCore::MediaElementSession::playbackPermitted): Check if is a top-level media document and if
+                allowsMediaDocumentInilnePlayback is set, and return early.
+            (WebCore::MediaElementSession::effectivePreloadForElement): Ditto.
+            (WebCore::MediaElementSession::allowsAutomaticMediaDataLoading): Ditto.
+            * html/MediaElementSession.h:
+
+    2015-07-21  Jer Noble  <[email protected]>
+
+            [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.
+
 2015-07-24  Lucas Forschler  <[email protected]>
 
         Merge r187149

Modified: branches/safari-601.1-branch/Source/WebCore/dom/Document.cpp (187389 => 187390)


--- branches/safari-601.1-branch/Source/WebCore/dom/Document.cpp	2015-07-25 14:46:20 UTC (rev 187389)
+++ branches/safari-601.1-branch/Source/WebCore/dom/Document.cpp	2015-07-25 17:51:21 UTC (rev 187390)
@@ -1612,6 +1612,25 @@
     return pageVisibilityState() != PageVisibilityStateVisible;
 }
 
+
+#if ENABLE(VIDEO)
+void Document::registerForAllowsMediaDocumentInlinePlaybackChangedCallbacks(HTMLMediaElement& element)
+{
+    m_allowsMediaDocumentInlinePlaybackElements.add(&element);
+}
+
+void Document::unregisterForAllowsMediaDocumentInlinePlaybackChangedCallbacks(HTMLMediaElement& element)
+{
+    m_allowsMediaDocumentInlinePlaybackElements.remove(&element);
+}
+
+void Document::allowsMediaDocumentInlinePlaybackChanged()
+{
+    for (auto* element : m_allowsMediaDocumentInlinePlaybackElements)
+        element->allowsMediaDocumentInlinePlaybackChanged();
+}
+#endif
+
 #if ENABLE(CSP_NEXT)
 DOMSecurityPolicy& Document::securityPolicy()
 {

Modified: branches/safari-601.1-branch/Source/WebCore/dom/Document.h (187389 => 187390)


--- branches/safari-601.1-branch/Source/WebCore/dom/Document.h	2015-07-25 14:46:20 UTC (rev 187389)
+++ branches/safari-601.1-branch/Source/WebCore/dom/Document.h	2015-07-25 17:51:21 UTC (rev 187390)
@@ -1014,6 +1014,12 @@
     void registerForVisibilityStateChangedCallbacks(Element*);
     void unregisterForVisibilityStateChangedCallbacks(Element*);
 
+#if ENABLE(VIDEO)
+    void registerForAllowsMediaDocumentInlinePlaybackChangedCallbacks(HTMLMediaElement&);
+    void unregisterForAllowsMediaDocumentInlinePlaybackChangedCallbacks(HTMLMediaElement&);
+    void allowsMediaDocumentInlinePlaybackChanged();
+#endif
+
     WEBCORE_EXPORT void setShouldCreateRenderers(bool);
     bool shouldCreateRenderers();
 
@@ -1550,6 +1556,9 @@
 #endif
 
     HashSet<Element*> m_visibilityStateCallbackElements;
+#if ENABLE(VIDEO)
+    HashSet<HTMLMediaElement*> m_allowsMediaDocumentInlinePlaybackElements;
+#endif
 
     HashMap<StringImpl*, Element*, CaseFoldingHash> m_elementsByAccessKey;
     bool m_accessKeyMapValid;

Modified: branches/safari-601.1-branch/Source/WebCore/html/HTMLMediaElement.cpp (187389 => 187390)


--- branches/safari-601.1-branch/Source/WebCore/html/HTMLMediaElement.cpp	2015-07-25 14:46:20 UTC (rev 187389)
+++ branches/safari-601.1-branch/Source/WebCore/html/HTMLMediaElement.cpp	2015-07-25 17:51:21 UTC (rev 187390)
@@ -518,6 +518,8 @@
     document.registerForPageCacheSuspensionCallbacks(this);
 #endif
 
+    document.registerForAllowsMediaDocumentInlinePlaybackChangedCallbacks(*this);
+
     document.addAudioProducer(this);
     addElementToDocumentMap(*this, document);
 }
@@ -550,6 +552,8 @@
     document.unregisterForPageCacheSuspensionCallbacks(this);
 #endif
 
+    document.unregisterForAllowsMediaDocumentInlinePlaybackChangedCallbacks(*this);
+
     document.removeAudioProducer(this);
     removeElementFromDocumentMap(*this, document);
 }
@@ -1038,8 +1042,7 @@
         setShouldDelayLoadEvent(true);
 
 #if PLATFORM(IOS)
-    Settings* settings = document().settings();
-    if (effectivePreload != MediaPlayer::None && settings && settings->mediaDataLoadsAutomatically())
+    if (effectivePreload != MediaPlayer::None && m_mediaSession->allowsAutomaticMediaDataLoading(*this))
         prepareToPlay();
 #endif
 
@@ -2112,6 +2115,9 @@
         if (renderer())
             renderer()->updateFromElement();
 
+        if (is<MediaDocument>(document()))
+            downcast<MediaDocument>(document()).mediaElementNaturalSizeChanged(expandedIntSize(m_player->naturalSize()));
+
         logMediaLoadRequest(document().page(), m_player->engineDescription(), String(), true);
     }
 
@@ -3882,7 +3888,7 @@
     m_resizeTaskQueue.enqueueTask(task);
 #endif
 }
-    
+
 void HTMLMediaElement::setSelectedTextTrack(TextTrack* trackToSelect)
 {
     TextTrackList* trackList = textTracks();
@@ -4383,6 +4389,9 @@
 {
     LOG(Media, "HTMLMediaElement::mediaPlayerSizeChanged(%p)", this);
 
+    if (is<MediaDocument>(document()) && m_player)
+        downcast<MediaDocument>(document()).mediaElementNaturalSizeChanged(expandedIntSize(m_player->naturalSize()));
+
     beginProcessingMediaPlayerCallback();
     if (renderer())
         renderer()->updateFromElement();
@@ -6528,6 +6537,12 @@
 
 #endif
 
+void HTMLMediaElement::allowsMediaDocumentInlinePlaybackChanged()
+{
+    if (potentiallyPlaying() && m_mediaSession->requiresFullscreenForVideoPlayback(*this) && !isFullscreen())
+        enterFullscreen();
 }
 
+}
+
 #endif

Modified: branches/safari-601.1-branch/Source/WebCore/html/HTMLMediaElement.h (187389 => 187390)


--- branches/safari-601.1-branch/Source/WebCore/html/HTMLMediaElement.h	2015-07-25 14:46:20 UTC (rev 187389)
+++ branches/safari-601.1-branch/Source/WebCore/html/HTMLMediaElement.h	2015-07-25 17:51:21 UTC (rev 187390)
@@ -448,6 +448,8 @@
 
     void layoutSizeChanged();
 
+    void allowsMediaDocumentInlinePlaybackChanged();
+
 protected:
     HTMLMediaElement(const QualifiedName&, Document&, bool);
     virtual ~HTMLMediaElement();

Modified: branches/safari-601.1-branch/Source/WebCore/html/MediaDocument.cpp (187389 => 187390)


--- branches/safari-601.1-branch/Source/WebCore/html/MediaDocument.cpp	2015-07-25 14:46:20 UTC (rev 187389)
+++ branches/safari-601.1-branch/Source/WebCore/html/MediaDocument.cpp	2015-07-25 17:51:21 UTC (rev 187390)
@@ -28,6 +28,8 @@
 #if ENABLE(VIDEO)
 #include "MediaDocument.h"
 
+#include "Chrome.h"
+#include "ChromeClient.h"
 #include "DocumentLoader.h"
 #include "EventNames.h"
 #include "ExceptionCodePlaceholder.h"
@@ -259,5 +261,17 @@
     }
 }
 
+void MediaDocument::mediaElementNaturalSizeChanged(const IntSize& newSize)
+{
+    if (ownerElement())
+        return;
+
+    if (newSize.isZero())
+        return;
+
+    if (page())
+        page()->chrome().client().mediaDocumentNaturalSizeChanged(newSize);
 }
+
+}
 #endif

Modified: branches/safari-601.1-branch/Source/WebCore/html/MediaDocument.h (187389 => 187390)


--- branches/safari-601.1-branch/Source/WebCore/html/MediaDocument.h	2015-07-25 14:46:20 UTC (rev 187389)
+++ branches/safari-601.1-branch/Source/WebCore/html/MediaDocument.h	2015-07-25 17:51:21 UTC (rev 187390)
@@ -41,6 +41,7 @@
     virtual ~MediaDocument();
 
     void mediaElementSawUnsupportedTracks();
+    void mediaElementNaturalSizeChanged(const IntSize&);
     String outgoingReferrer() const { return m_outgoingReferrer; }
 
 private:

Modified: branches/safari-601.1-branch/Source/WebCore/html/MediaElementSession.cpp (187389 => 187390)


--- branches/safari-601.1-branch/Source/WebCore/html/MediaElementSession.cpp	2015-07-25 14:46:20 UTC (rev 187389)
+++ branches/safari-601.1-branch/Source/WebCore/html/MediaElementSession.cpp	2015-07-25 17:51:21 UTC (rev 187390)
@@ -78,6 +78,13 @@
 }
 #endif
 
+static bool pageExplicitlyAllowsElementToAutoplayInline(const HTMLMediaElement& element)
+{
+    Document& document = element.document();
+    Page* page = document.page();
+    return document.isMediaDocument() && !document.ownerElement() && page && page->allowsMediaDocumentInlinePlayback();
+}
+
 MediaElementSession::MediaElementSession(PlatformMediaSessionClient& client)
     : PlatformMediaSession(client)
     , m_restrictions(NoRestrictions)
@@ -119,6 +126,9 @@
 
 bool MediaElementSession::playbackPermitted(const HTMLMediaElement& element) const
 {
+    if (pageExplicitlyAllowsElementToAutoplayInline(element))
+        return true;
+
     if (m_restrictions & RequireUserGestureForRateChange && !ScriptController::processingUserGesture()) {
         LOG(Media, "MediaElementSession::playbackPermitted - returning FALSE");
         return false;
@@ -331,6 +341,9 @@
     PlatformMediaSessionManager::SessionRestrictions restrictions = PlatformMediaSessionManager::sharedManager().restrictions(mediaType());
     MediaPlayer::Preload preload = element.preloadValue();
 
+    if (pageExplicitlyAllowsElementToAutoplayInline(element))
+        return preload;
+
     if ((restrictions & PlatformMediaSessionManager::MetadataPreloadingNotPermitted) == PlatformMediaSessionManager::MetadataPreloadingNotPermitted)
         return MediaPlayer::None;
 
@@ -344,6 +357,9 @@
 
 bool MediaElementSession::requiresFullscreenForVideoPlayback(const HTMLMediaElement& element) const
 {
+    if (pageExplicitlyAllowsElementToAutoplayInline(element))
+        return false;
+
     if (!PlatformMediaSessionManager::sharedManager().sessionRestrictsInlineVideoPlayback(*this))
         return false;
 
@@ -362,6 +378,18 @@
     return true;
 }
 
+bool MediaElementSession::allowsAutomaticMediaDataLoading(const HTMLMediaElement& element) const
+{
+    if (pageExplicitlyAllowsElementToAutoplayInline(element))
+        return true;
+
+    Settings* settings = element.document().settings();
+    if (settings && settings->mediaDataLoadsAutomatically())
+        return true;
+
+    return false;
+}
+
 void MediaElementSession::mediaEngineUpdated(const HTMLMediaElement& element)
 {
     LOG(Media, "MediaElementSession::mediaEngineUpdated");

Modified: branches/safari-601.1-branch/Source/WebCore/html/MediaElementSession.h (187389 => 187390)


--- branches/safari-601.1-branch/Source/WebCore/html/MediaElementSession.h	2015-07-25 14:46:20 UTC (rev 187389)
+++ branches/safari-601.1-branch/Source/WebCore/html/MediaElementSession.h	2015-07-25 17:51:21 UTC (rev 187390)
@@ -71,6 +71,7 @@
     bool requiresFullscreenForVideoPlayback(const HTMLMediaElement&) const;
     WEBCORE_EXPORT bool allowsPictureInPicture(const HTMLMediaElement&) const;
     MediaPlayer::Preload effectivePreloadForElement(const HTMLMediaElement&) const;
+    bool allowsAutomaticMediaDataLoading(const HTMLMediaElement&) const;
 
     void mediaEngineUpdated(const HTMLMediaElement&);
 

Modified: branches/safari-601.1-branch/Source/WebCore/page/ChromeClient.h (187389 => 187390)


--- branches/safari-601.1-branch/Source/WebCore/page/ChromeClient.h	2015-07-25 14:46:20 UTC (rev 187389)
+++ branches/safari-601.1-branch/Source/WebCore/page/ChromeClient.h	2015-07-25 17:51:21 UTC (rev 187390)
@@ -449,6 +449,10 @@
     virtual void playbackTargetPickerClientStateDidChange(uint64_t /*contextId*/, MediaProducer::MediaStateFlags) { }
 #endif
 
+#if ENABLE(VIDEO)
+    virtual void mediaDocumentNaturalSizeChanged(const WebCore::IntSize&) { }
+#endif
+
 protected:
     virtual ~ChromeClient() { }
 };

Modified: branches/safari-601.1-branch/Source/WebCore/page/Page.cpp (187389 => 187390)


--- branches/safari-601.1-branch/Source/WebCore/page/Page.cpp	2015-07-25 14:46:20 UTC (rev 187389)
+++ branches/safari-601.1-branch/Source/WebCore/page/Page.cpp	2015-07-25 17:51:21 UTC (rev 187390)
@@ -1736,4 +1736,20 @@
     return *m_testTrigger;
 }
 
+#if ENABLE(VIDEO)
+void Page::setAllowsMediaDocumentInlinePlayback(bool flag)
+{
+    if (m_allowsMediaDocumentInlinePlayback == flag)
+        return;
+    m_allowsMediaDocumentInlinePlayback = flag;
+
+    Vector<Ref<Document>> documents;
+    for (Frame* frame = m_mainFrame.get(); frame; frame = frame->tree().traverseNext())
+        documents.append(*frame->document());
+
+    for (auto& document : documents)
+        document->allowsMediaDocumentInlinePlaybackChanged();
+}
+#endif
+
 } // namespace WebCore

Modified: branches/safari-601.1-branch/Source/WebCore/page/Page.h (187389 => 187390)


--- branches/safari-601.1-branch/Source/WebCore/page/Page.h	2015-07-25 14:46:20 UTC (rev 187389)
+++ branches/safari-601.1-branch/Source/WebCore/page/Page.h	2015-07-25 17:51:21 UTC (rev 187390)
@@ -460,6 +460,11 @@
     void clearTrigger() { m_testTrigger = nullptr; }
     bool expectsWheelEventTriggers() const { return !!m_testTrigger; }
 
+#if ENABLE(VIDEO)
+    WEBCORE_EXPORT bool allowsMediaDocumentInlinePlayback() const { return m_allowsMediaDocumentInlinePlayback; }
+    WEBCORE_EXPORT void setAllowsMediaDocumentInlinePlayback(bool);
+#endif
+
 private:
     WEBCORE_EXPORT void initGroup();
 
@@ -619,6 +624,7 @@
     MediaProducer::MediaStateFlags m_mediaState { MediaProducer::IsNotPlaying };
     
     bool m_userContentExtensionsEnabled { true };
+    bool m_allowsMediaDocumentInlinePlayback { false };
 };
 
 inline PageGroup& Page::group()

Modified: branches/safari-601.1-branch/Source/WebKit2/ChangeLog (187389 => 187390)


--- branches/safari-601.1-branch/Source/WebKit2/ChangeLog	2015-07-25 14:46:20 UTC (rev 187389)
+++ branches/safari-601.1-branch/Source/WebKit2/ChangeLog	2015-07-25 17:51:21 UTC (rev 187390)
@@ -1,3 +1,111 @@
+2015-07-24  Jer Noble  <[email protected]>
+
+        Merge r187251, r187252, r187262, r187263, r187272, r187289. rdar://problem/20689512
+
+    2015-07-23  Alex Christensen  <[email protected]>
+
+            Fix 32-bit build after r187272.
+
+            * UIProcess/mac/PageClientImpl.mm:
+            (WebKit::PageClientImpl::mediaDocumentNaturalSizeChanged):
+            Added some WK_API_ENABLED.
+
+    2015-07-23  Alex Christensen  <[email protected]>
+
+            [iOS] Unreviewed build fix after r187251.
+
+            * UIProcess/WebPageProxy.cpp:
+            (WebKit::WebPageProxy::setAllowsMediaDocumentInlinePlayback):
+            Use the correct name for the boolean to pass along to SetAllowsMediaDocumentInlinePlayback.
+
+    2015-07-21  Jer Noble  <[email protected]>
+
+            Notify the UI delegate when a MediaDocument's natural size changes
+            https://bugs.webkit.org/show_bug.cgi?id=147182
+
+            Reviewed by Simon Fraser.
+
+            Pipe notifications of media document natural size changes up from the chrome client, through
+            to the UIProcess,  through the page client, through the WKWebView, to the UIDelegate.
+
+            * UIProcess/API/APIUIClient.h:
+            (API::UIClient::mediaDocumentNaturalSizeChanged):
+            * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
+            * UIProcess/API/Cocoa/WKWebView.mm:
+            (-[WKWebView _mediaDocumentNaturalSizeChanged:]):
+            * UIProcess/API/Cocoa/WKWebViewInternal.h:
+            * UIProcess/Cocoa/UIDelegate.h:
+            * UIProcess/Cocoa/UIDelegate.mm:
+            (WebKit::UIDelegate::setDelegate):
+            (WebKit::UIDelegate::UIClient::mediaDocumentNaturalSizeChanged):
+            * UIProcess/PageClient.h:
+            * UIProcess/WebPageProxy.cpp:
+            (WebKit::WebPageProxy::mediaDocumentNaturalSizeChanged):
+            * UIProcess/WebPageProxy.h:
+            * UIProcess/WebPageProxy.messages.in:
+            * UIProcess/ios/PageClientImplIOS.h:
+            * UIProcess/ios/PageClientImplIOS.mm:
+            (WebKit::PageClientImpl::mediaDocumentNaturalSizeChanged):
+            * UIProcess/mac/PageClientImpl.h:
+            * UIProcess/mac/PageClientImpl.mm:
+            (WebKit::PageClientImpl::mediaDocumentNaturalSizeChanged):
+            * WebProcess/WebCoreSupport/WebChromeClient.h:
+            * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+            (WebKit::WebChromeClient::mediaDocumentNaturalSizeChanged):
+            * WebProcess/WebPage/WebPage.cpp:
+            (WebKit::WebPage::mediaDocumentNaturalSizeChanged):
+            * WebProcess/WebPage/WebPage.h:
+            * UIProcess/API/gtk/PageClientImpl.h: Add default, empty implementation of new pure-virtual method.
+            * UIProcess/efl/WebViewEfl.h: Ditto.
+
+    2015-07-23  Jer Noble  <[email protected]>
+
+            Unreviewed build fix after r187251; rename flag -> allows.
+
+            * UIProcess/WebPageProxy.cpp:
+            (WebKit::WebPageProxy::setAllowsMediaDocumentInlinePlayback):
+
+    2015-07-23  Jer Noble  <[email protected]>
+
+            [WK2] Add a WKWebView property for whether the view is displaying a media document
+            https://bugs.webkit.org/show_bug.cgi?id=147233
+
+            Reviewed by Beth Dakin.
+
+            Add a _isDisplayingStandaloneMediaDocument property, which queries the frame for whether
+            the current MIME type is one which our media engines support.
+
+            * UIProcess/API/Cocoa/WKWebView.mm:
+            (-[WKWebView _isDisplayingStandaloneMediaDocument]):
+            * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+            * UIProcess/WebFrameProxy.cpp:
+            (WebKit::WebFrameProxy::isDisplayingStandaloneMediaDocument):
+            * UIProcess/WebFrameProxy.h:
+
+    2015-07-21  Jer Noble  <[email protected]>
+
+            [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.
+
 2015-07-24  Matthew Hanson  <[email protected]>
 
         Merge r187268. rdar://problem/21664211

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/APIUIClient.h (187389 => 187390)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/APIUIClient.h	2015-07-25 14:46:20 UTC (rev 187389)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/APIUIClient.h	2015-07-25 17:51:21 UTC (rev 187390)
@@ -167,6 +167,10 @@
 #endif
 
     virtual void didClickAutoFillButton(WebKit::WebPageProxy&, API::Object*) { }
+
+#if ENABLE(VIDEO)
+    virtual void mediaDocumentNaturalSizeChanged(const WebCore::IntSize&) { }
+#endif
 };
 
 } // namespace API

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h (187389 => 187390)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h	2015-07-25 14:46:20 UTC (rev 187389)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h	2015-07-25 17:51:21 UTC (rev 187390)
@@ -54,6 +54,7 @@
 - (void)_webViewFullscreenMayReturnToInline:(WKWebView *)webView;
 - (void)_webViewDidEnterFullscreen:(WKWebView *)webView WK_AVAILABLE(WK_MAC_TBA, 8_3);
 - (void)_webViewDidExitFullscreen:(WKWebView *)webView WK_AVAILABLE(WK_MAC_TBA, 8_3);
+- (void)_webView:(WKWebView *)webView mediaDocumentNaturalSizeChanged:(CGSize)size;
 
 #if TARGET_OS_IPHONE
 - (BOOL)_webView:(WKWebView *)webView shouldIncludeAppLinkActionsForElement:(_WKActivatedElementInfo *)element WK_AVAILABLE(NA, WK_IOS_TBA);

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (187389 => 187390)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2015-07-25 14:46:20 UTC (rev 187389)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2015-07-25 17:51:21 UTC (rev 187390)
@@ -1882,6 +1882,15 @@
 }
 #endif // PLATFORM(MAC)
 
+#if ENABLE(VIDEO)
+- (void)_mediaDocumentNaturalSizeChanged:(NSSize)newSize
+{
+    id <WKUIDelegatePrivate> uiDelegate = static_cast<id <WKUIDelegatePrivate>>([self UIDelegate]);
+    if ([uiDelegate respondsToSelector:@selector(_webView:mediaDocumentNaturalSizeChanged:)])
+        [uiDelegate _webView:self mediaDocumentNaturalSizeChanged:newSize];
+}
+#endif
+
 @end
 
 @implementation WKWebView (WKPrivate)
@@ -2471,6 +2480,13 @@
     return NO;
 }
 
+- (BOOL)_isDisplayingStandaloneMediaDocument
+{
+    if (auto* mainFrame = _page->mainFrame())
+        return mainFrame->isDisplayingStandaloneMediaDocument();
+    return NO;
+}
+
 - (BOOL)_isShowingNavigationGestureSnapshot
 {
     return _page->isShowingNavigationGestureSnapshot();
@@ -2589,6 +2605,24 @@
     return nil;
 }
 
+#pragma mark media playback restrictions
+
+- (BOOL)_allowsMediaDocumentInlinePlayback
+{
+#if PLATFORM(IOS)
+    return _page->allowsMediaDocumentInlinePlayback();
+#else
+    return NO;
+#endif
+}
+
+- (void)_setAllowsMediaDocumentInlinePlayback:(BOOL)flag
+{
+#if PLATFORM(IOS)
+    _page->setAllowsMediaDocumentInlinePlayback(flag);
+#endif
+}
+
 #pragma mark iOS-specific methods
 
 #if PLATFORM(IOS)

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h (187389 => 187390)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h	2015-07-25 14:46:20 UTC (rev 187389)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h	2015-07-25 17:51:21 UTC (rev 187390)
@@ -116,6 +116,10 @@
 
 - (WKPageRef)_pageForTesting;
 
+#if ENABLE(VIDEO)
+- (void)_mediaDocumentNaturalSizeChanged:(CGSize)newSize;
+#endif
+
 @end
 
 WKWebView* fromWebPageProxy(WebKit::WebPageProxy&);

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h (187389 => 187390)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h	2015-07-25 14:46:20 UTC (rev 187389)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h	2015-07-25 17:51:21 UTC (rev 187390)
@@ -203,6 +203,7 @@
 @property (nonatomic, weak, setter=_setFormDelegate:) id <_WKFormDelegate> _formDelegate;
 
 @property (nonatomic, readonly, getter=_isDisplayingStandaloneImageDocument) BOOL _displayingStandaloneImageDocument;
+@property (nonatomic, readonly, getter=_isDisplayingStandaloneMediaDocument) BOOL _displayingStandaloneMediaDocument;
 
 @property (nonatomic, setter=_setScrollPerformanceDataCollectionEnabled:) BOOL _scrollPerformanceDataCollectionEnabled WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
 @property (nonatomic, readonly) NSArray *_scrollPerformanceData WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
@@ -210,6 +211,9 @@
 - (WKNavigation *)_loadRequest:(NSURLRequest *)request withOptions:(WK_DICTIONARY(NSString *, id) *)loadOptions WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
 
 - (void)_saveBackForwardSnapshotForItem:(WKBackForwardListItem *)item WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
+
+@property (nonatomic, getter=_allowsMediaDocumentInlinePlayback, setter=_setAllowsMediaDocumentInlinePlayback:) BOOL _allowsMediaDocumentInlinePlayback;
+
 @end
 
 #endif

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h (187389 => 187390)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h	2015-07-25 14:46:20 UTC (rev 187389)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h	2015-07-25 17:51:21 UTC (rev 187390)
@@ -135,9 +135,13 @@
 
     virtual void didChangeBackgroundColor() override;
 
-    virtual void refView() override { };
-    virtual void derefView() override { };
+#if ENABLE(VIDEO)
+    virtual void mediaDocumentNaturalSizeChanged(const WebCore::IntSize&) override { }
+#endif
 
+    virtual void refView() override;
+    virtual void derefView() override;
+
     // Members of PageClientImpl class
     GtkWidget* m_viewWidget;
     DefaultUndoController m_undoController;

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h (187389 => 187390)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h	2015-07-25 14:46:20 UTC (rev 187389)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h	2015-07-25 17:51:21 UTC (rev 187390)
@@ -76,6 +76,9 @@
         virtual RetainPtr<NSArray> actionsForElement(_WKActivatedElementInfo *, RetainPtr<NSArray> defaultActions) override;
         virtual void didNotHandleTapAsClick(const WebCore::IntPoint&) override;
 #endif
+#if ENABLE(VIDEO)
+        virtual void mediaDocumentNaturalSizeChanged(const WebCore::IntSize&) override;
+#endif
 
         UIDelegate& m_uiDelegate;
     };
@@ -103,6 +106,9 @@
         bool webViewActionsForElementDefaultActions : 1;
         bool webViewDidNotHandleTapAsClickAtPoint : 1;
 #endif
+#if ENABLE(VIDEO)
+        bool webViewMediaDocumentNaturalSizeChanged : 1;
+#endif
     } m_delegateMethods;
 };
 

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm (187389 => 187390)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm	2015-07-25 14:46:20 UTC (rev 187389)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm	2015-07-25 17:51:21 UTC (rev 187390)
@@ -85,6 +85,9 @@
     m_delegateMethods.webViewActionsForElementDefaultActions = [delegate respondsToSelector:@selector(_webView:actionsForElement:defaultActions:)];
     m_delegateMethods.webViewDidNotHandleTapAsClickAtPoint = [delegate respondsToSelector:@selector(_webView:didNotHandleTapAsClickAtPoint:)];
 #endif
+#if ENABLE(VIDEO)
+    m_delegateMethods.webViewMediaDocumentNaturalSizeChanged = [delegate respondsToSelector:@selector(_webView:mediaDocumentNaturalSizeChanged:)];
+#endif
 }
 
 UIDelegate::UIClient::UIClient(UIDelegate& uiDelegate)
@@ -338,6 +341,20 @@
 }
 #endif
 
+#if ENABLE(VIDEO)
+void UIDelegate::UIClient::mediaDocumentNaturalSizeChanged(const WebCore::IntSize& newSize)
+{
+    if (!m_uiDelegate.m_delegateMethods.webViewMediaDocumentNaturalSizeChanged)
+        return;
+
+    auto delegate = m_uiDelegate.m_delegate.get();
+    if (!delegate)
+        return;
+
+    [static_cast<id <WKUIDelegatePrivate>>(delegate) _webView:m_uiDelegate.m_webView mediaDocumentNaturalSizeChanged:newSize];
+}
+#endif
+
 } // namespace WebKit
 
 #endif // WK_API_ENABLED

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/PageClient.h (187389 => 187390)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/PageClient.h	2015-07-25 14:46:20 UTC (rev 187389)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/PageClient.h	2015-07-25 17:51:21 UTC (rev 187390)
@@ -326,6 +326,10 @@
     virtual WebCore::WebMediaSessionManager& mediaSessionManager() = 0;
 #endif
 
+#if ENABLE(VIDEO)
+    virtual void mediaDocumentNaturalSizeChanged(const WebCore::IntSize&) = 0;
+#endif
+
     virtual void refView() = 0;
     virtual void derefView() = 0;
 };

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebFrameProxy.cpp (187389 => 187390)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebFrameProxy.cpp	2015-07-25 14:46:20 UTC (rev 187389)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebFrameProxy.cpp	2015-07-25 17:51:21 UTC (rev 187390)
@@ -110,6 +110,11 @@
     return Image::supportsType(m_MIMEType);
 }
 
+bool WebFrameProxy::isDisplayingStandaloneMediaDocument() const
+{
+    return MIMETypeRegistry::isSupportedMediaMIMEType(m_MIMEType);
+}
+
 bool WebFrameProxy::isDisplayingMarkupDocument() const
 {
     // FIXME: This check should be moved to somewhere in WebCore.

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebFrameProxy.h (187389 => 187390)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebFrameProxy.h	2015-07-25 14:46:20 UTC (rev 187389)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebFrameProxy.h	2015-07-25 17:51:21 UTC (rev 187390)
@@ -97,6 +97,7 @@
     bool canShowMIMEType(const String& mimeType) const;
 
     bool isDisplayingStandaloneImageDocument() const;
+    bool isDisplayingStandaloneMediaDocument() const;
     bool isDisplayingMarkupDocument() const;
     bool isDisplayingPDFDocument() const;
 

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp (187389 => 187390)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp	2015-07-25 14:46:20 UTC (rev 187389)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp	2015-07-25 17:51:21 UTC (rev 187390)
@@ -3983,6 +3983,20 @@
 {
     return m_videoFullscreenManager;
 }
+
+bool WebPageProxy::allowsMediaDocumentInlinePlayback() const
+{
+    return m_allowsMediaDocumentInlinePlayback;
+}
+
+void WebPageProxy::setAllowsMediaDocumentInlinePlayback(bool allows)
+{
+    if (m_allowsMediaDocumentInlinePlayback == allows)
+        return;
+    m_allowsMediaDocumentInlinePlayback = allows;
+
+    m_process->send(Messages::WebPage::SetAllowsMediaDocumentInlinePlayback(allows), m_pageID);
+}
 #endif
 
 // BackForwardList
@@ -5997,6 +6011,13 @@
 }
 #endif
 
+#if ENABLE(VIDEO)
+void WebPageProxy::mediaDocumentNaturalSizeChanged(const WebCore::IntSize& newSize)
+{
+    m_uiClient->mediaDocumentNaturalSizeChanged(newSize);
+}
+#endif
+
 void WebPageProxy::setShouldDispatchFakeMouseMoveEvents(bool shouldDispatchFakeMouseMoveEvents)
 {
     m_process->send(Messages::WebPage::SetShouldDispatchFakeMouseMoveEvents(shouldDispatchFakeMouseMoveEvents), m_pageID);

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebPageProxy.h (187389 => 187390)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebPageProxy.h	2015-07-25 14:46:20 UTC (rev 187389)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebPageProxy.h	2015-07-25 17:51:21 UTC (rev 187390)
@@ -333,6 +333,9 @@
 #endif
 #if PLATFORM(IOS)
     RefPtr<WebVideoFullscreenManagerProxy> videoFullscreenManager();
+
+    bool allowsMediaDocumentInlinePlayback() const;
+    void setAllowsMediaDocumentInlinePlayback(bool);
 #endif
 
 #if ENABLE(CONTEXT_MENUS)
@@ -1473,6 +1476,10 @@
     void useFixedLayoutDidChange(bool useFixedLayout) { m_useFixedLayout = useFixedLayout; }
     void fixedLayoutSizeDidChange(WebCore::IntSize fixedLayoutSize) { m_fixedLayoutSize = fixedLayoutSize; }
 
+#if ENABLE(VIDEO)
+    void mediaDocumentNaturalSizeChanged(const WebCore::IntSize&);
+#endif
+
     void handleAutoFillButtonClick(const UserData&);
 
     void handleMessage(IPC::Connection&, const String& messageName, const UserData& messageBody);
@@ -1573,6 +1580,7 @@
     WebCore::ViewState::Flags m_viewState;
     bool m_viewWasEverInWindow;
 #if PLATFORM(IOS)
+    bool m_allowsMediaDocumentInlinePlayback { false };
     bool m_alwaysRunsAtForegroundPriority;
     ProcessThrottler::ForegroundActivityToken m_activityToken;
 #endif

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in (187389 => 187390)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2015-07-25 14:46:20 UTC (rev 187389)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2015-07-25 17:51:21 UTC (rev 187390)
@@ -444,6 +444,10 @@
     PlaybackTargetPickerClientStateDidChange(uint64_t contextId, unsigned mediaState)
 #endif
 
+#if ENABLE(VIDEO)
+    MediaDocumentNaturalSizeChanged(WebCore::IntSize newSize)
+#endif
+
     UseFixedLayoutDidChange(bool useFixedLayout)
     FixedLayoutSizeDidChange(WebCore::IntSize fixedLayoutSize)
 }

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/efl/WebViewEfl.h (187389 => 187390)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/efl/WebViewEfl.h	2015-07-25 14:46:20 UTC (rev 187389)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/efl/WebViewEfl.h	2015-07-25 17:51:21 UTC (rev 187390)
@@ -90,6 +90,10 @@
     virtual void didFinishLoadForMainFrame() override final { }
     virtual void didSameDocumentNavigationForMainFrame(SameDocumentNavigationType) override final { }
 
+#if ENABLE(VIDEO)
+    virtual void mediaDocumentNaturalSizeChanged(const WebCore::IntSize&) override final { }
+#endif
+
     virtual void refView() override final { }
     virtual void derefView() override final { }
 

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h (187389 => 187390)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h	2015-07-25 14:46:20 UTC (rev 187389)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h	2015-07-25 17:51:21 UTC (rev 187390)
@@ -186,6 +186,10 @@
 
     virtual void didChangeBackgroundColor() override;
 
+#if ENABLE(VIDEO)
+    virtual void mediaDocumentNaturalSizeChanged(const WebCore::IntSize&) override;
+#endif
+
     virtual void refView() override;
     virtual void derefView() override;
 

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm (187389 => 187390)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm	2015-07-25 14:46:20 UTC (rev 187389)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm	2015-07-25 17:51:21 UTC (rev 187390)
@@ -739,6 +739,14 @@
     [m_webView _updateScrollViewBackground];
 }
 
+#if ENABLE(VIDEO)
+void PageClientImpl::mediaDocumentNaturalSizeChanged(const IntSize& newSize)
+{
+    [m_webView _mediaDocumentNaturalSizeChanged:newSize];
+}
+#endif
+
+
 void PageClientImpl::refView()
 {
     [m_contentView retain];

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.h (187389 => 187390)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.h	2015-07-25 14:46:20 UTC (rev 187389)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.h	2015-07-25 17:51:21 UTC (rev 187390)
@@ -203,6 +203,10 @@
 
     virtual void didChangeBackgroundColor() override;
 
+#if ENABLE(VIDEO)
+    virtual void mediaDocumentNaturalSizeChanged(const WebCore::IntSize&) override;
+#endif
+
     WKView *m_wkView;
     WKWebView *m_webView;
     RetainPtr<WKEditorUndoTargetObjC> m_undoTarget;

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.mm (187389 => 187390)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.mm	2015-07-25 14:46:20 UTC (rev 187389)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.mm	2015-07-25 17:51:21 UTC (rev 187390)
@@ -836,6 +836,15 @@
 }
 #endif
 
+#if ENABLE(VIDEO)
+void PageClientImpl::mediaDocumentNaturalSizeChanged(const IntSize& newSize)
+{
+#if WK_API_ENABLED
+    [m_webView _mediaDocumentNaturalSizeChanged:newSize];
+#endif
+}
+#endif
+
 void PageClientImpl::refView()
 {
     CFRetain(m_wkView);

Modified: branches/safari-601.1-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (187389 => 187390)


--- branches/safari-601.1-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2015-07-25 14:46:20 UTC (rev 187389)
+++ branches/safari-601.1-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2015-07-25 17:51:21 UTC (rev 187390)
@@ -1158,5 +1158,11 @@
 }
 #endif
 
+#if ENABLE(VIDEO)
+void WebChromeClient::mediaDocumentNaturalSizeChanged(const WebCore::IntSize& newSize)
+{
+    m_page->mediaDocumentNaturalSizeChanged(newSize);
+}
+#endif
 
 } // namespace WebKit

Modified: branches/safari-601.1-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h (187389 => 187390)


--- branches/safari-601.1-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h	2015-07-25 14:46:20 UTC (rev 187389)
+++ branches/safari-601.1-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h	2015-07-25 17:51:21 UTC (rev 187390)
@@ -323,6 +323,10 @@
     virtual void playbackTargetPickerClientStateDidChange(uint64_t, WebCore::MediaProducer::MediaStateFlags) override;
 #endif
 
+#if ENABLE(VIDEO)
+    virtual void mediaDocumentNaturalSizeChanged(const WebCore::IntSize&) override;
+#endif
+
     String m_cachedToolTip;
     mutable RefPtr<WebFrame> m_cachedFrameSetLargestFrame;
     mutable bool m_cachedMainFrameHasHorizontalScrollbar;

Modified: branches/safari-601.1-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (187389 => 187390)


--- branches/safari-601.1-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2015-07-25 14:46:20 UTC (rev 187389)
+++ branches/safari-601.1-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2015-07-25 17:51:21 UTC (rev 187390)
@@ -3009,6 +3009,11 @@
         m_videoFullscreenManager = WebVideoFullscreenManager::create(this);
     return m_videoFullscreenManager.get();
 }
+
+void WebPage::setAllowsMediaDocumentInlinePlayback(bool allows)
+{
+    m_page->setAllowsMediaDocumentInlinePlayback(allows);
+}
 #endif
 
 #if ENABLE(FULLSCREEN_API)
@@ -5026,4 +5031,11 @@
     m_page->setUserContentExtensionsEnabled(userContentExtensionsEnabled);
 }
 
+#if ENABLE(VIDEO)
+void WebPage::mediaDocumentNaturalSizeChanged(const IntSize& newSize)
+{
+    send(Messages::WebPageProxy::MediaDocumentNaturalSizeChanged(newSize));
+}
+#endif
+
 } // namespace WebKit

Modified: branches/safari-601.1-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h (187389 => 187390)


--- branches/safari-601.1-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h	2015-07-25 14:46:20 UTC (rev 187389)
+++ branches/safari-601.1-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h	2015-07-25 17:51:21 UTC (rev 187390)
@@ -236,6 +236,8 @@
 
 #if PLATFORM(IOS)
     WebVideoFullscreenManager* videoFullscreenManager();
+    void setAllowsMediaDocumentInlinePlayback(bool);
+    bool allowsMediaDocumentInlinePlayback() const { return m_allowsMediaDocumentInlinePlayback; }
 #endif
 
 #if ENABLE(FULLSCREEN_API)
@@ -895,6 +897,10 @@
     void postMessage(const String& messageName, API::Object* messageBody);
     void postSynchronousMessage(const String& messageName, API::Object* messageBody, RefPtr<API::Object>& returnData);
 
+#if ENABLE(VIDEO)
+    void mediaDocumentNaturalSizeChanged(const WebCore::IntSize&);
+#endif
+
 private:
     WebPage(uint64_t pageID, const WebPageCreationParameters&);
 
@@ -1252,6 +1258,7 @@
     RefPtr<WebInspectorUI> m_inspectorUI;
 #if PLATFORM(IOS)
     RefPtr<WebVideoFullscreenManager> m_videoFullscreenManager;
+    bool m_allowsMediaDocumentInlinePlayback { false };
 #endif
 #if ENABLE(FULLSCREEN_API)
     RefPtr<WebFullScreenManager> m_fullScreenManager;

Modified: branches/safari-601.1-branch/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (187389 => 187390)


--- branches/safari-601.1-branch/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in	2015-07-25 14:46:20 UTC (rev 187389)
+++ branches/safari-601.1-branch/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in	2015-07-25 17:51:21 UTC (rev 187390)
@@ -94,6 +94,7 @@
     ContentSizeCategoryDidChange(String contentSizeCategory)
     ExecuteEditCommandWithCallback(String name, uint64_t callbackID)
     GetLookupContextAtPoint(WebCore::IntPoint point, uint64_t callbackID)
+    SetAllowsMediaDocumentInlinePlayback(bool allows)
 #endif
 
 #if ENABLE(REMOTE_INSPECTOR)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to