Title: [176280] branches/safari-600.3-branch/Source
Revision
176280
Author
[email protected]
Date
2014-11-18 13:01:15 -0800 (Tue, 18 Nov 2014)

Log Message

Merge r176108. rdar://problem/19005904

Modified Paths

Diff

Modified: branches/safari-600.3-branch/Source/WebCore/ChangeLog (176279 => 176280)


--- branches/safari-600.3-branch/Source/WebCore/ChangeLog	2014-11-18 20:59:40 UTC (rev 176279)
+++ branches/safari-600.3-branch/Source/WebCore/ChangeLog	2014-11-18 21:01:15 UTC (rev 176280)
@@ -1,5 +1,48 @@
 2014-11-18  Dana Burkart  <[email protected]>
 
+        Merge r176108. rdar://problem/19005904
+
+    2014-11-13  Eric Carlson  <[email protected]>
+
+            Context menus should not offer the "Download video" option for videos that cannot 
+            be downloaded
+            https://bugs.webkit.org/show_bug.cgi?id=138530
+            -and corresponding-
+            rdar://problem/18919130
+
+            Reviewed by Tim Horton.
+
+            * html/HTMLMediaElement.cpp:
+            (WebCore::HTMLMediaElement::parseAttribute):
+            * html/HTMLMediaElement.h:
+            * page/ContextMenuController.cpp:
+            (WebCore::ContextMenuController::populate):
+            * platform/graphics/MediaPlayer.cpp:
+            (WebCore::MediaPlayer::canSaveMediaData):
+            (WebCore::MediaPlayer::supportsSave): Deleted.
+            * platform/graphics/MediaPlayer.h:
+            * platform/graphics/MediaPlayerPrivate.h:
+            (WebCore::MediaPlayerPrivateInterface::supportsFullscreen):
+            (WebCore::MediaPlayerPrivateInterface::canSaveMediaData):
+            (WebCore::MediaPlayerPrivateInterface::supportsSave): Deleted.
+            * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
+            (WebCore::MediaPlayerPrivateAVFoundation::resolvedURL):
+            (WebCore::MediaPlayerPrivateAVFoundation::canSaveMediaData):
+            * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
+            * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
+            * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+            (WebCore::MediaPlayerPrivateAVFoundationObjC::resolvedURL):
+            * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+            (WebCore::MediaPlayerPrivateGStreamer::canSaveMediaData):
+            * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
+            * platform/graphics/mac/MediaPlayerPrivateQTKit.h:
+            * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
+            (WebCore::MediaPlayerPrivateQTKit::canSaveMediaData):
+            * rendering/HitTestResult.cpp:
+            (WebCore::HitTestResult::isDownloadableMedia):
+
+2014-11-18  Dana Burkart  <[email protected]>
+
         Merge r175765. rdar://problem/19005917
 
     2014-11-07  Andreas Kling  <[email protected]>

Modified: branches/safari-600.3-branch/Source/WebCore/html/HTMLMediaElement.cpp (176279 => 176280)


--- branches/safari-600.3-branch/Source/WebCore/html/HTMLMediaElement.cpp	2014-11-18 20:59:40 UTC (rev 176279)
+++ branches/safari-600.3-branch/Source/WebCore/html/HTMLMediaElement.cpp	2014-11-18 21:01:15 UTC (rev 176280)
@@ -2295,11 +2295,6 @@
     m_playedTimeRanges->add(start, end);
 }  
 
-bool HTMLMediaElement::supportsSave() const
-{
-    return m_player ? m_player->supportsSave() : false;
-}
-
 bool HTMLMediaElement::supportsScanning() const
 {
     return m_player ? m_player->supportsScanning() : false;
@@ -6060,9 +6055,17 @@
 void HTMLMediaElement::setShouldBufferData(bool shouldBuffer)
 {
     if (m_player)
-        return m_player->setShouldBufferData(shouldBuffer);
+        m_player->setShouldBufferData(shouldBuffer);
 }
-    
+
+bool HTMLMediaElement::canSaveMediaData() const
+{
+    if (m_player)
+        return m_player->canSaveMediaData();
+
+    return false;
 }
 
+}
+
 #endif

Modified: branches/safari-600.3-branch/Source/WebCore/html/HTMLMediaElement.h (176279 => 176280)


--- branches/safari-600.3-branch/Source/WebCore/html/HTMLMediaElement.h	2014-11-18 20:59:40 UTC (rev 176279)
+++ branches/safari-600.3-branch/Source/WebCore/html/HTMLMediaElement.h	2014-11-18 21:01:15 UTC (rev 176280)
@@ -114,9 +114,10 @@
     // Eventually overloaded in HTMLVideoElement
     virtual bool supportsFullscreen() const override { return false; };
 
-    virtual bool supportsSave() const;
     virtual bool supportsScanning() const override;
-    
+
+    bool canSaveMediaData() const;
+
     virtual bool doesHaveAttribute(const AtomicString&, AtomicString* value = nullptr) const override;
 
     PlatformMedia platformMedia() const;

Modified: branches/safari-600.3-branch/Source/WebCore/page/ContextMenuController.cpp (176279 => 176280)


--- branches/safari-600.3-branch/Source/WebCore/page/ContextMenuController.cpp	2014-11-18 20:59:40 UTC (rev 176279)
+++ branches/safari-600.3-branch/Source/WebCore/page/ContextMenuController.cpp	2014-11-18 21:01:15 UTC (rev 176280)
@@ -892,7 +892,7 @@
             appendItem(*separatorItem(), m_contextMenu.get());
             appendItem(CopyMediaLinkItem, m_contextMenu.get());
             appendItem(OpenMediaInNewWindowItem, m_contextMenu.get());
-            if (loader.client().canHandleRequest(ResourceRequest(mediaURL)))
+            if (m_context.hitTestResult().isDownloadableMedia() && loader.client().canHandleRequest(ResourceRequest(mediaURL)))
                 appendItem(DownloadMediaItem, m_contextMenu.get());
         }
 

Modified: branches/safari-600.3-branch/Source/WebCore/platform/graphics/MediaPlayer.cpp (176279 => 176280)


--- branches/safari-600.3-branch/Source/WebCore/platform/graphics/MediaPlayer.cpp	2014-11-18 20:59:40 UTC (rev 176279)
+++ branches/safari-600.3-branch/Source/WebCore/platform/graphics/MediaPlayer.cpp	2014-11-18 21:01:15 UTC (rev 176280)
@@ -557,9 +557,9 @@
     return m_private->supportsFullscreen();
 }
 
-bool MediaPlayer::supportsSave() const
+bool MediaPlayer::canSaveMediaData() const
 {
-    return m_private->supportsSave();
+    return m_private->canSaveMediaData();
 }
 
 bool MediaPlayer::supportsScanning() const

Modified: branches/safari-600.3-branch/Source/WebCore/platform/graphics/MediaPlayer.h (176279 => 176280)


--- branches/safari-600.3-branch/Source/WebCore/platform/graphics/MediaPlayer.h	2014-11-18 20:59:40 UTC (rev 176279)
+++ branches/safari-600.3-branch/Source/WebCore/platform/graphics/MediaPlayer.h	2014-11-18 21:01:15 UTC (rev 176280)
@@ -303,8 +303,8 @@
     static bool supportsKeySystem(const String& keySystem, const String& mimeType);
 
     bool supportsFullscreen() const;
-    bool supportsSave() const;
     bool supportsScanning() const;
+    bool canSaveMediaData() const;
     bool requiresImmediateCompositing() const;
     bool doesHaveAttribute(const AtomicString&, AtomicString* value = nullptr) const;
     PlatformMedia platformMedia() const;

Modified: branches/safari-600.3-branch/Source/WebCore/platform/graphics/MediaPlayerPrivate.h (176279 => 176280)


--- branches/safari-600.3-branch/Source/WebCore/platform/graphics/MediaPlayerPrivate.h	2014-11-18 20:59:40 UTC (rev 176279)
+++ branches/safari-600.3-branch/Source/WebCore/platform/graphics/MediaPlayerPrivate.h	2014-11-18 21:01:15 UTC (rev 176280)
@@ -69,10 +69,11 @@
     virtual void setShouldBufferData(bool) { }
 
     virtual bool supportsFullscreen() const { return false; }
-    virtual bool supportsSave() const { return false; }
     virtual bool supportsScanning() const { return false; }
     virtual bool requiresImmediateCompositing() const { return false; }
 
+    virtual bool canSaveMediaData() const { return false; }
+
     virtual IntSize naturalSize() const = 0;
 
     virtual bool hasVideo() const = 0;

Modified: branches/safari-600.3-branch/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp (176279 => 176280)


--- branches/safari-600.3-branch/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp	2014-11-18 20:59:40 UTC (rev 176279)
+++ branches/safari-600.3-branch/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp	2014-11-18 21:01:15 UTC (rev 176280)
@@ -1069,6 +1069,30 @@
 }
 #endif
 
+URL MediaPlayerPrivateAVFoundation::resolvedURL() const
+{
+    if (!m_assetURL.length())
+        return URL();
+
+    return URL(ParsedURLString, m_assetURL);
+}
+
+bool MediaPlayerPrivateAVFoundation::canSaveMediaData() const
+{
+    URL url = ""
+
+    if (url.isLocalFile())
+        return true;
+
+    if (!url.protocolIsInHTTPFamily())
+        return false;
+
+    if (isLiveStream())
+        return false;
+
+    return true;
+}
+
 } // namespace WebCore
 
 #endif

Modified: branches/safari-600.3-branch/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h (176279 => 176280)


--- branches/safari-600.3-branch/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h	2014-11-18 20:59:40 UTC (rev 176279)
+++ branches/safari-600.3-branch/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h	2014-11-18 21:01:15 UTC (rev 176280)
@@ -196,6 +196,7 @@
     virtual void acceleratedRenderingStateChanged() override;
     virtual bool shouldMaintainAspectRatio() const override { return m_shouldMaintainAspectRatio; }
     virtual void setShouldMaintainAspectRatio(bool) override;
+    virtual bool canSaveMediaData() const override;
 
     virtual MediaPlayer::MovieLoadType movieLoadType() const;
     virtual void prepareForRendering();
@@ -309,6 +310,8 @@
     void clearTextTracks();
     Vector<RefPtr<InbandTextTrackPrivateAVF>> m_textTracks;
 
+virtual URL resolvedURL() const;
+
 private:
     MediaPlayer* m_player;
 

Modified: branches/safari-600.3-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h (176279 => 176280)


--- branches/safari-600.3-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h	2014-11-18 20:59:40 UTC (rev 176279)
+++ branches/safari-600.3-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h	2014-11-18 21:01:15 UTC (rev 176280)
@@ -270,6 +270,8 @@
     virtual double maxFastForwardRate() const override { return m_cachedCanPlayFastForward ? std::numeric_limits<double>::infinity() : 2.0; }
     virtual double minFastReverseRate() const override { return m_cachedCanPlayFastReverse ? -std::numeric_limits<double>::infinity() : 0.0; }
 
+    virtual URL resolvedURL() const override;
+
     WeakPtrFactory<MediaPlayerPrivateAVFoundationObjC> m_weakPtrFactory;
 
     RetainPtr<AVURLAsset> m_avAsset;

Modified: branches/safari-600.3-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (176279 => 176280)


--- branches/safari-600.3-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2014-11-18 20:59:40 UTC (rev 176279)
+++ branches/safari-600.3-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2014-11-18 21:01:15 UTC (rev 176280)
@@ -2643,6 +2643,14 @@
     m_cachedCanPlayFastReverse = newValue;
 }
 
+URL MediaPlayerPrivateAVFoundationObjC::resolvedURL() const
+{
+    if (!m_avAsset)
+        return MediaPlayerPrivateAVFoundation::resolvedURL();
+
+    return URL([m_avAsset resolvedURL]);
+}
+
 NSArray* assetMetadataKeyNames()
 {
     static NSArray* keys;

Modified: branches/safari-600.3-branch/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (176279 => 176280)


--- branches/safari-600.3-branch/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2014-11-18 20:59:40 UTC (rev 176279)
+++ branches/safari-600.3-branch/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2014-11-18 21:01:15 UTC (rev 176280)
@@ -1920,6 +1920,20 @@
     return false;
 }
 
+bool MediaPlayerPrivateGStreamer::canSaveMediaData() const
+{
+    if (isLiveStream())
+        return false;
+
+    if (m_url.isLocalFile())
+        return true;
+
+    if (m_url.protocolIsInHTTPFamily())
+        return true;
+    
+    return false;
 }
 
+}
+
 #endif // USE(GSTREAMER)

Modified: branches/safari-600.3-branch/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h (176279 => 176280)


--- branches/safari-600.3-branch/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h	2014-11-18 20:59:40 UTC (rev 176279)
+++ branches/safari-600.3-branch/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h	2014-11-18 21:01:15 UTC (rev 176280)
@@ -164,6 +164,7 @@
     virtual String engineDescription() const { return "GStreamer"; }
     virtual bool isLiveStream() const { return m_isStreaming; }
     virtual bool didPassCORSAccessCheck() const;
+    virtual bool canSaveMediaData() const override;
 
 private:
     GRefPtr<GstElement> m_playBin;

Modified: branches/safari-600.3-branch/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h (176279 => 176280)


--- branches/safari-600.3-branch/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h	2014-11-18 20:59:40 UTC (rev 176279)
+++ branches/safari-600.3-branch/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h	2014-11-18 21:01:15 UTC (rev 176280)
@@ -140,6 +140,8 @@
     bool hasSingleSecurityOrigin() const;
     MediaPlayer::MovieLoadType movieLoadType() const;
 
+    virtual bool canSaveMediaData() const override;
+
     void createQTMovie(const String& url);
     void createQTMovie(NSURL *, NSDictionary *movieAttributes);
 

Modified: branches/safari-600.3-branch/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm (176279 => 176280)


--- branches/safari-600.3-branch/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm	2014-11-18 20:59:40 UTC (rev 176279)
+++ branches/safari-600.3-branch/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm	2014-11-18 21:01:15 UTC (rev 176280)
@@ -1664,6 +1664,27 @@
     [m_qtMovie.get() setAttribute:[NSNumber numberWithBool:!privateBrowsing] forKey:@"QTMovieAllowPersistentCacheAttribute"];
 }
 
+bool MediaPlayerPrivateQTKit::canSaveMediaData() const
+{
+    URL url;
+
+    if (duration() >= std::numeric_limits<float>::infinity())
+        return false;
+
+    if (m_qtMovie)
+        url = ""
+    else
+        url = "" m_movieURL);
+
+    if (url.isLocalFile())
+        return true;
+
+    if (url.protocolIsInHTTPFamily())
+        return true;
+    
+    return false;
+}
+
 } // namespace WebCore
 
 @implementation WebCoreMovieObserver

Modified: branches/safari-600.3-branch/Source/WebCore/rendering/HitTestResult.cpp (176279 => 176280)


--- branches/safari-600.3-branch/Source/WebCore/rendering/HitTestResult.cpp	2014-11-18 20:59:40 UTC (rev 176279)
+++ branches/safari-600.3-branch/Source/WebCore/rendering/HitTestResult.cpp	2014-11-18 21:01:15 UTC (rev 176280)
@@ -507,9 +507,12 @@
 
 bool HitTestResult::isDownloadableMedia() const
 {
-    // FIXME: We should actually answer instead of always returning true for media elements.
-    // https://bugs.webkit.org/show_bug.cgi?id=138530
-    return mediaElement() ? true : false;
+#if ENABLE(VIDEO)
+    if (HTMLMediaElement* mediaElt = mediaElement())
+        return mediaElt->canSaveMediaData();
+#endif
+
+    return false;
 }
 
 URL HitTestResult::absoluteLinkURL() const

Modified: branches/safari-600.3-branch/Source/WebKit2/ChangeLog (176279 => 176280)


--- branches/safari-600.3-branch/Source/WebKit2/ChangeLog	2014-11-18 20:59:40 UTC (rev 176279)
+++ branches/safari-600.3-branch/Source/WebKit2/ChangeLog	2014-11-18 21:01:15 UTC (rev 176280)
@@ -1,3 +1,25 @@
+2014-11-18  Dana Burkart  <[email protected]>
+
+        Merge r176108. rdar://problem/19005904
+
+    2014-11-13  Eric Carlson  <[email protected]>
+
+            Context menus should not offer the "Download video" option for videos that cannot 
+            be downloaded
+            https://bugs.webkit.org/show_bug.cgi?id=138530
+            -and corresponding-
+            rdar://problem/18919130
+
+            Reviewed by Tim Horton.
+
+            Expose isDownloadableMedia() to the InjectedBundleHitTestResult.
+            * WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp:
+            (WKBundleHitTestResultIsDownloadableMedia):
+            * WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.h:
+            * WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp:
+            (WebKit::InjectedBundleHitTestResult::isDownloadableMedia):
+            * WebProcess/InjectedBundle/InjectedBundleHitTestResult.h:
+            
 2014-11-17  Dana Burkart  <[email protected]>
 
         Merge r176150. <rdar://problem/18982046>

Modified: branches/safari-600.3-branch/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp (176279 => 176280)


--- branches/safari-600.3-branch/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp	2014-11-18 20:59:40 UTC (rev 176279)
+++ branches/safari-600.3-branch/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp	2014-11-18 21:01:15 UTC (rev 176280)
@@ -84,6 +84,11 @@
     return toImpl(hitTestResultRef)->mediaHasAudio();
 }
 
+bool WKBundleHitTestResultIsDownloadableMedia(WKBundleHitTestResultRef hitTestResultRef)
+{
+    return toImpl(hitTestResultRef)->isDownloadableMedia();
+}
+
 WKBundleHitTestResultMediaType WKBundleHitTestResultGetMediaType(WKBundleHitTestResultRef hitTestResultRef)
 {
     return toAPI(toImpl(hitTestResultRef)->mediaType());

Modified: branches/safari-600.3-branch/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.h (176279 => 176280)


--- branches/safari-600.3-branch/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.h	2014-11-18 20:59:40 UTC (rev 176279)
+++ branches/safari-600.3-branch/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.h	2014-11-18 21:01:15 UTC (rev 176280)
@@ -53,6 +53,7 @@
 WK_EXPORT WKURLRef WKBundleHitTestResultCopyAbsoluteMediaURL(WKBundleHitTestResultRef hitTestResult);
 WK_EXPORT bool WKBundleHitTestResultMediaIsInFullscreen(WKBundleHitTestResultRef hitTestResult);
 WK_EXPORT bool WKBundleHitTestResultMediaHasAudio(WKBundleHitTestResultRef hitTestResult);
+WK_EXPORT bool WKBundleHitTestResultIsDownloadableMedia(WKBundleHitTestResultRef hitTestResultRef);
 WK_EXPORT WKBundleHitTestResultMediaType WKBundleHitTestResultGetMediaType(WKBundleHitTestResultRef hitTestResult);
 
 WK_EXPORT WKRect WKBundleHitTestResultGetImageRect(WKBundleHitTestResultRef hitTestResult);

Modified: branches/safari-600.3-branch/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp (176279 => 176280)


--- branches/safari-600.3-branch/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp	2014-11-18 20:59:40 UTC (rev 176279)
+++ branches/safari-600.3-branch/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp	2014-11-18 21:01:15 UTC (rev 176280)
@@ -103,6 +103,11 @@
     return m_hitTestResult.mediaHasAudio();
 }
 
+bool InjectedBundleHitTestResult::isDownloadableMedia() const
+{
+    return m_hitTestResult.isDownloadableMedia();
+}
+
 BundleHitTestResultMediaType InjectedBundleHitTestResult::mediaType() const
 {
 #if !ENABLE(VIDEO)

Modified: branches/safari-600.3-branch/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.h (176279 => 176280)


--- branches/safari-600.3-branch/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.h	2014-11-18 20:59:40 UTC (rev 176279)
+++ branches/safari-600.3-branch/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.h	2014-11-18 21:01:15 UTC (rev 176280)
@@ -54,6 +54,7 @@
     String absoluteMediaURL() const;
     bool mediaIsInFullscreen() const;
     bool mediaHasAudio() const;
+    bool isDownloadableMedia() const;
     BundleHitTestResultMediaType mediaType() const;
 
     String linkLabel() const;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to