⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 176280 in webkit


Ignore:
Timestamp:
Nov 18, 2014, 1:01:15 PM (12 years ago)
Author:
dburkart@apple.com
Message:

Merge r176108. rdar://problem/19005904

Location:
branches/safari-600.3-branch/Source
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-600.3-branch/Source/WebCore/ChangeLog

    r176270 r176280  
     12014-11-18  Dana Burkart  <dburkart@apple.com>
     2
     3        Merge r176108. rdar://problem/19005904
     4
     5    2014-11-13  Eric Carlson  <eric.carlson@apple.com>
     6
     7            Context menus should not offer the "Download video" option for videos that cannot
     8            be downloaded
     9            https://bugs.webkit.org/show_bug.cgi?id=138530
     10            -and corresponding-
     11            rdar://problem/18919130
     12
     13            Reviewed by Tim Horton.
     14
     15            * html/HTMLMediaElement.cpp:
     16            (WebCore::HTMLMediaElement::parseAttribute):
     17            * html/HTMLMediaElement.h:
     18            * page/ContextMenuController.cpp:
     19            (WebCore::ContextMenuController::populate):
     20            * platform/graphics/MediaPlayer.cpp:
     21            (WebCore::MediaPlayer::canSaveMediaData):
     22            (WebCore::MediaPlayer::supportsSave): Deleted.
     23            * platform/graphics/MediaPlayer.h:
     24            * platform/graphics/MediaPlayerPrivate.h:
     25            (WebCore::MediaPlayerPrivateInterface::supportsFullscreen):
     26            (WebCore::MediaPlayerPrivateInterface::canSaveMediaData):
     27            (WebCore::MediaPlayerPrivateInterface::supportsSave): Deleted.
     28            * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
     29            (WebCore::MediaPlayerPrivateAVFoundation::resolvedURL):
     30            (WebCore::MediaPlayerPrivateAVFoundation::canSaveMediaData):
     31            * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
     32            * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
     33            * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
     34            (WebCore::MediaPlayerPrivateAVFoundationObjC::resolvedURL):
     35            * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
     36            (WebCore::MediaPlayerPrivateGStreamer::canSaveMediaData):
     37            * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
     38            * platform/graphics/mac/MediaPlayerPrivateQTKit.h:
     39            * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
     40            (WebCore::MediaPlayerPrivateQTKit::canSaveMediaData):
     41            * rendering/HitTestResult.cpp:
     42            (WebCore::HitTestResult::isDownloadableMedia):
     43
    1442014-11-18  Dana Burkart  <dburkart@apple.com>
    245
  • branches/safari-600.3-branch/Source/WebCore/html/HTMLMediaElement.cpp

    r172778 r176280  
    22962296
    22972297
    2298 bool HTMLMediaElement::supportsSave() const
    2299 {
    2300     return m_player ? m_player->supportsSave() : false;
    2301 }
    2302 
    23032298bool HTMLMediaElement::supportsScanning() const
    23042299{
     
    60616056{
    60626057    if (m_player)
    6063         return m_player->setShouldBufferData(shouldBuffer);
    6064 }
    6065    
    6066 }
    6067 
    6068 #endif
     6058        m_player->setShouldBufferData(shouldBuffer);
     6059}
     6060
     6061bool HTMLMediaElement::canSaveMediaData() const
     6062{
     6063    if (m_player)
     6064        return m_player->canSaveMediaData();
     6065
     6066    return false;
     6067}
     6068
     6069}
     6070
     6071#endif
  • branches/safari-600.3-branch/Source/WebCore/html/HTMLMediaElement.h

    r172778 r176280  
    115115    virtual bool supportsFullscreen() const override { return false; };
    116116
    117     virtual bool supportsSave() const;
    118117    virtual bool supportsScanning() const override;
    119    
     118
     119    bool canSaveMediaData() const;
     120
    120121    virtual bool doesHaveAttribute(const AtomicString&, AtomicString* value = nullptr) const override;
    121122
  • branches/safari-600.3-branch/Source/WebCore/page/ContextMenuController.cpp

    r172787 r176280  
    893893            appendItem(CopyMediaLinkItem, m_contextMenu.get());
    894894            appendItem(OpenMediaInNewWindowItem, m_contextMenu.get());
    895             if (loader.client().canHandleRequest(ResourceRequest(mediaURL)))
     895            if (m_context.hitTestResult().isDownloadableMedia() && loader.client().canHandleRequest(ResourceRequest(mediaURL)))
    896896                appendItem(DownloadMediaItem, m_contextMenu.get());
    897897        }
  • branches/safari-600.3-branch/Source/WebCore/platform/graphics/MediaPlayer.cpp

    r172465 r176280  
    558558}
    559559
    560 bool MediaPlayer::supportsSave() const
    561 {
    562     return m_private->supportsSave();
     560bool MediaPlayer::canSaveMediaData() const
     561{
     562    return m_private->canSaveMediaData();
    563563}
    564564
  • branches/safari-600.3-branch/Source/WebCore/platform/graphics/MediaPlayer.h

    r172465 r176280  
    304304
    305305    bool supportsFullscreen() const;
    306     bool supportsSave() const;
    307306    bool supportsScanning() const;
     307    bool canSaveMediaData() const;
    308308    bool requiresImmediateCompositing() const;
    309309    bool doesHaveAttribute(const AtomicString&, AtomicString* value = nullptr) const;
  • branches/safari-600.3-branch/Source/WebCore/platform/graphics/MediaPlayerPrivate.h

    r171433 r176280  
    7070
    7171    virtual bool supportsFullscreen() const { return false; }
    72     virtual bool supportsSave() const { return false; }
    7372    virtual bool supportsScanning() const { return false; }
    7473    virtual bool requiresImmediateCompositing() const { return false; }
     74
     75    virtual bool canSaveMediaData() const { return false; }
    7576
    7677    virtual IntSize naturalSize() const = 0;
  • branches/safari-600.3-branch/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp

    r172468 r176280  
    10701070#endif
    10711071
     1072URL MediaPlayerPrivateAVFoundation::resolvedURL() const
     1073{
     1074    if (!m_assetURL.length())
     1075        return URL();
     1076
     1077    return URL(ParsedURLString, m_assetURL);
     1078}
     1079
     1080bool MediaPlayerPrivateAVFoundation::canSaveMediaData() const
     1081{
     1082    URL url = resolvedURL();
     1083
     1084    if (url.isLocalFile())
     1085        return true;
     1086
     1087    if (!url.protocolIsInHTTPFamily())
     1088        return false;
     1089
     1090    if (isLiveStream())
     1091        return false;
     1092
     1093    return true;
     1094}
     1095
    10721096} // namespace WebCore
    10731097
  • branches/safari-600.3-branch/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h

    r172468 r176280  
    197197    virtual bool shouldMaintainAspectRatio() const override { return m_shouldMaintainAspectRatio; }
    198198    virtual void setShouldMaintainAspectRatio(bool) override;
     199    virtual bool canSaveMediaData() const override;
    199200
    200201    virtual MediaPlayer::MovieLoadType movieLoadType() const;
     
    309310    void clearTextTracks();
    310311    Vector<RefPtr<InbandTextTrackPrivateAVF>> m_textTracks;
     312
     313virtual URL resolvedURL() const;
    311314
    312315private:
  • branches/safari-600.3-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h

    r172468 r176280  
    271271    virtual double minFastReverseRate() const override { return m_cachedCanPlayFastReverse ? -std::numeric_limits<double>::infinity() : 0.0; }
    272272
     273    virtual URL resolvedURL() const override;
     274
    273275    WeakPtrFactory<MediaPlayerPrivateAVFoundationObjC> m_weakPtrFactory;
    274276
  • branches/safari-600.3-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm

    r173677 r176280  
    26442644}
    26452645
     2646URL MediaPlayerPrivateAVFoundationObjC::resolvedURL() const
     2647{
     2648    if (!m_avAsset)
     2649        return MediaPlayerPrivateAVFoundation::resolvedURL();
     2650
     2651    return URL([m_avAsset resolvedURL]);
     2652}
     2653
    26462654NSArray* assetMetadataKeyNames()
    26472655{
  • branches/safari-600.3-branch/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp

    r170526 r176280  
    19211921}
    19221922
     1923bool MediaPlayerPrivateGStreamer::canSaveMediaData() const
     1924{
     1925    if (isLiveStream())
     1926        return false;
     1927
     1928    if (m_url.isLocalFile())
     1929        return true;
     1930
     1931    if (m_url.protocolIsInHTTPFamily())
     1932        return true;
     1933   
     1934    return false;
     1935}
     1936
    19231937}
    19241938
  • branches/safari-600.3-branch/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h

    r170709 r176280  
    165165    virtual bool isLiveStream() const { return m_isStreaming; }
    166166    virtual bool didPassCORSAccessCheck() const;
     167    virtual bool canSaveMediaData() const override;
    167168
    168169private:
  • branches/safari-600.3-branch/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h

    r165676 r176280  
    140140    bool hasSingleSecurityOrigin() const;
    141141    MediaPlayer::MovieLoadType movieLoadType() const;
     142
     143    virtual bool canSaveMediaData() const override;
    142144
    143145    void createQTMovie(const String& url);
  • branches/safari-600.3-branch/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm

    r169568 r176280  
    16651665}
    16661666
     1667bool MediaPlayerPrivateQTKit::canSaveMediaData() const
     1668{
     1669    URL url;
     1670
     1671    if (duration() >= std::numeric_limits<float>::infinity())
     1672        return false;
     1673
     1674    if (m_qtMovie)
     1675        url = URL(wkQTMovieResolvedURL(m_qtMovie.get()));
     1676    else
     1677        url = URL(ParsedURLString, m_movieURL);
     1678
     1679    if (url.isLocalFile())
     1680        return true;
     1681
     1682    if (url.protocolIsInHTTPFamily())
     1683        return true;
     1684   
     1685    return false;
     1686}
     1687
    16671688} // namespace WebCore
    16681689
  • branches/safari-600.3-branch/Source/WebCore/rendering/HitTestResult.cpp

    r175864 r176280  
    508508bool HitTestResult::isDownloadableMedia() const
    509509{
    510     // FIXME: We should actually answer instead of always returning true for media elements.
    511     // https://bugs.webkit.org/show_bug.cgi?id=138530
    512     return mediaElement() ? true : false;
     510#if ENABLE(VIDEO)
     511    if (HTMLMediaElement* mediaElt = mediaElement())
     512        return mediaElt->canSaveMediaData();
     513#endif
     514
     515    return false;
    513516}
    514517
  • branches/safari-600.3-branch/Source/WebKit2/ChangeLog

    r176249 r176280  
     12014-11-18  Dana Burkart  <dburkart@apple.com>
     2
     3        Merge r176108. rdar://problem/19005904
     4
     5    2014-11-13  Eric Carlson  <eric.carlson@apple.com>
     6
     7            Context menus should not offer the "Download video" option for videos that cannot
     8            be downloaded
     9            https://bugs.webkit.org/show_bug.cgi?id=138530
     10            -and corresponding-
     11            rdar://problem/18919130
     12
     13            Reviewed by Tim Horton.
     14
     15            Expose isDownloadableMedia() to the InjectedBundleHitTestResult.
     16            * WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp:
     17            (WKBundleHitTestResultIsDownloadableMedia):
     18            * WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.h:
     19            * WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp:
     20            (WebKit::InjectedBundleHitTestResult::isDownloadableMedia):
     21            * WebProcess/InjectedBundle/InjectedBundleHitTestResult.h:
     22           
    1232014-11-17  Dana Burkart  <dburkart@apple.com>
    224
  • branches/safari-600.3-branch/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp

    r151929 r176280  
    8585}
    8686
     87bool WKBundleHitTestResultIsDownloadableMedia(WKBundleHitTestResultRef hitTestResultRef)
     88{
     89    return toImpl(hitTestResultRef)->isDownloadableMedia();
     90}
     91
    8792WKBundleHitTestResultMediaType WKBundleHitTestResultGetMediaType(WKBundleHitTestResultRef hitTestResultRef)
    8893{
  • branches/safari-600.3-branch/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.h

    r168541 r176280  
    5454WK_EXPORT bool WKBundleHitTestResultMediaIsInFullscreen(WKBundleHitTestResultRef hitTestResult);
    5555WK_EXPORT bool WKBundleHitTestResultMediaHasAudio(WKBundleHitTestResultRef hitTestResult);
     56WK_EXPORT bool WKBundleHitTestResultIsDownloadableMedia(WKBundleHitTestResultRef hitTestResultRef);
    5657WK_EXPORT WKBundleHitTestResultMediaType WKBundleHitTestResultGetMediaType(WKBundleHitTestResultRef hitTestResult);
    5758
  • branches/safari-600.3-branch/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp

    r166262 r176280  
    104104}
    105105
     106bool InjectedBundleHitTestResult::isDownloadableMedia() const
     107{
     108    return m_hitTestResult.isDownloadableMedia();
     109}
     110
    106111BundleHitTestResultMediaType InjectedBundleHitTestResult::mediaType() const
    107112{
  • branches/safari-600.3-branch/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.h

    r160384 r176280  
    5555    bool mediaIsInFullscreen() const;
    5656    bool mediaHasAudio() const;
     57    bool isDownloadableMedia() const;
    5758    BundleHitTestResultMediaType mediaType() const;
    5859
Note: See TracChangeset for help on using the changeset viewer.