Diff
Modified: trunk/Source/WebCore/ChangeLog (176107 => 176108)
--- trunk/Source/WebCore/ChangeLog 2014-11-14 00:37:53 UTC (rev 176107)
+++ trunk/Source/WebCore/ChangeLog 2014-11-14 00:46:53 UTC (rev 176108)
@@ -1,3 +1,42 @@
+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-02 Tim Horton <[email protected]>
[mac] Keep around more decoded image data, since it's purgeable
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (176107 => 176108)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2014-11-14 00:37:53 UTC (rev 176107)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2014-11-14 00:46:53 UTC (rev 176108)
@@ -2269,11 +2269,6 @@
m_playedTimeRanges->ranges().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;
@@ -6117,9 +6112,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: trunk/Source/WebCore/html/HTMLMediaElement.h (176107 => 176108)
--- trunk/Source/WebCore/html/HTMLMediaElement.h 2014-11-14 00:37:53 UTC (rev 176107)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h 2014-11-14 00:46:53 UTC (rev 176108)
@@ -118,9 +118,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;
WEBCORE_EXPORT PlatformMedia platformMedia() const;
Modified: trunk/Source/WebCore/page/ContextMenuController.cpp (176107 => 176108)
--- trunk/Source/WebCore/page/ContextMenuController.cpp 2014-11-14 00:37:53 UTC (rev 176107)
+++ trunk/Source/WebCore/page/ContextMenuController.cpp 2014-11-14 00:46:53 UTC (rev 176108)
@@ -890,7 +890,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: trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp (176107 => 176108)
--- trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp 2014-11-14 00:37:53 UTC (rev 176107)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp 2014-11-14 00:46:53 UTC (rev 176108)
@@ -552,9 +552,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: trunk/Source/WebCore/platform/graphics/MediaPlayer.h (176107 => 176108)
--- trunk/Source/WebCore/platform/graphics/MediaPlayer.h 2014-11-14 00:37:53 UTC (rev 176107)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.h 2014-11-14 00:46:53 UTC (rev 176108)
@@ -293,8 +293,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: trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h (176107 => 176108)
--- trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h 2014-11-14 00:37:53 UTC (rev 176107)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h 2014-11-14 00:46:53 UTC (rev 176108)
@@ -70,10 +70,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: trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp (176107 => 176108)
--- trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp 2014-11-14 00:37:53 UTC (rev 176107)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp 2014-11-14 00:46:53 UTC (rev 176108)
@@ -1047,6 +1047,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: trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h (176107 => 176108)
--- trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h 2014-11-14 00:37:53 UTC (rev 176107)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h 2014-11-14 00:46:53 UTC (rev 176108)
@@ -191,6 +191,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();
@@ -303,6 +304,8 @@
void clearTextTracks();
Vector<RefPtr<InbandTextTrackPrivateAVF>> m_textTracks;
+virtual URL resolvedURL() const;
+
private:
MediaPlayer* m_player;
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h (176107 => 176108)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h 2014-11-14 00:37:53 UTC (rev 176107)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h 2014-11-14 00:46:53 UTC (rev 176108)
@@ -281,6 +281,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: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (176107 => 176108)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2014-11-14 00:37:53 UTC (rev 176107)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2014-11-14 00:46:53 UTC (rev 176108)
@@ -2845,6 +2845,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: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (176107 => 176108)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp 2014-11-14 00:37:53 UTC (rev 176107)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp 2014-11-14 00:46:53 UTC (rev 176108)
@@ -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: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h (176107 => 176108)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h 2014-11-14 00:37:53 UTC (rev 176107)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h 2014-11-14 00:46:53 UTC (rev 176108)
@@ -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: trunk/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h (176107 => 176108)
--- trunk/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h 2014-11-14 00:37:53 UTC (rev 176107)
+++ trunk/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h 2014-11-14 00:46:53 UTC (rev 176108)
@@ -135,6 +135,8 @@
bool hasSingleSecurityOrigin() const;
MediaPlayer::MovieLoadType movieLoadType() const;
+ virtual bool canSaveMediaData() const override;
+
void createQTMovie(const String& url);
void createQTMovie(NSURL *, NSDictionary *movieAttributes);
Modified: trunk/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm (176107 => 176108)
--- trunk/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm 2014-11-14 00:37:53 UTC (rev 176107)
+++ trunk/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm 2014-11-14 00:46:53 UTC (rev 176108)
@@ -1517,6 +1517,27 @@
[m_qtMovie.get() setAttribute:[NSNumber numberWithBool:!privateBrowsing] forKey:@"QTMovieAllowPersistentCacheAttribute"];
}
+bool MediaPlayerPrivateQTKit::canSaveMediaData() const
+{
+ URL url;
+
+ if (durationMediaTime().isPositiveInfinite())
+ 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: trunk/Source/WebCore/rendering/HitTestResult.cpp (176107 => 176108)
--- trunk/Source/WebCore/rendering/HitTestResult.cpp 2014-11-14 00:37:53 UTC (rev 176107)
+++ trunk/Source/WebCore/rendering/HitTestResult.cpp 2014-11-14 00:46:53 UTC (rev 176108)
@@ -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: trunk/Source/WebKit2/ChangeLog (176107 => 176108)
--- trunk/Source/WebKit2/ChangeLog 2014-11-14 00:37:53 UTC (rev 176107)
+++ trunk/Source/WebKit2/ChangeLog 2014-11-14 00:46:53 UTC (rev 176108)
@@ -1,3 +1,21 @@
+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-13 Daniel Bates <[email protected]>
[iOS] NSGeometry data types are not available in the public SDK
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp (176107 => 176108)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp 2014-11-14 00:37:53 UTC (rev 176107)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp 2014-11-14 00:46:53 UTC (rev 176108)
@@ -90,6 +90,11 @@
return toImpl(hitTestResultRef)->mediaHasAudio();
}
+bool WKBundleHitTestResultIsDownloadableMedia(WKBundleHitTestResultRef hitTestResultRef)
+{
+ return toImpl(hitTestResultRef)->isDownloadableMedia();
+}
+
WKBundleHitTestResultMediaType WKBundleHitTestResultGetMediaType(WKBundleHitTestResultRef hitTestResultRef)
{
return toAPI(toImpl(hitTestResultRef)->mediaType());
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.h (176107 => 176108)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.h 2014-11-14 00:37:53 UTC (rev 176107)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.h 2014-11-14 00:46:53 UTC (rev 176108)
@@ -54,6 +54,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: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp (176107 => 176108)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp 2014-11-14 00:37:53 UTC (rev 176107)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp 2014-11-14 00:46:53 UTC (rev 176108)
@@ -108,6 +108,11 @@
return m_hitTestResult.mediaHasAudio();
}
+bool InjectedBundleHitTestResult::isDownloadableMedia() const
+{
+ return m_hitTestResult.isDownloadableMedia();
+}
+
BundleHitTestResultMediaType InjectedBundleHitTestResult::mediaType() const
{
#if !ENABLE(VIDEO)
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.h (176107 => 176108)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.h 2014-11-14 00:37:53 UTC (rev 176107)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.h 2014-11-14 00:46:53 UTC (rev 176108)
@@ -55,6 +55,7 @@
String absoluteMediaURL() const;
bool mediaIsInFullscreen() const;
bool mediaHasAudio() const;
+ bool isDownloadableMedia() const;
BundleHitTestResultMediaType mediaType() const;
String linkLabel() const;