Changeset 229472 in webkit


Ignore:
Timestamp:
Mar 9, 2018, 10:59:33 AM (7 years ago)
Author:
jer.noble@apple.com
Message:

Add isPictureInPictureActive messaging across WebKit process boundary
https://bugs.webkit.org/show_bug.cgi?id=183499

Reviewed by Eric Carlson.

Source/WebCore:

  • platform/cocoa/PlaybackSessionModel.h:

(WebCore::PlaybackSessionModelClient::pictureInPictureActiveChanged):

  • platform/cocoa/PlaybackSessionModelMediaElement.h:
  • platform/cocoa/PlaybackSessionModelMediaElement.mm:

(WebCore::PlaybackSessionModelMediaElement::updateForEventName):
(WebCore::PlaybackSessionModelMediaElement::isPictureInPictureActive const):

  • platform/ios/WebVideoFullscreenControllerAVKit.mm:

(VideoFullscreenControllerContext::isPictureInPictureActive const):

Source/WebKit:

  • UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
  • UIProcess/Cocoa/PlaybackSessionManagerProxy.messages.in:
  • UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:

(WebKit::PlaybackSessionModelContext::pictureInPictureActiveChanged):
(WebKit::PlaybackSessionManagerProxy::pictureInPictureActiveChanged):

Location:
trunk/Source
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r229471 r229472  
     12018-03-09  Jer Noble  <jer.noble@apple.com>
     2
     3        Add isPictureInPictureActive messaging across WebKit process boundary
     4        https://bugs.webkit.org/show_bug.cgi?id=183499
     5
     6        Reviewed by Eric Carlson.
     7
     8        * platform/cocoa/PlaybackSessionModel.h:
     9        (WebCore::PlaybackSessionModelClient::pictureInPictureActiveChanged):
     10        * platform/cocoa/PlaybackSessionModelMediaElement.h:
     11        * platform/cocoa/PlaybackSessionModelMediaElement.mm:
     12        (WebCore::PlaybackSessionModelMediaElement::updateForEventName):
     13        (WebCore::PlaybackSessionModelMediaElement::isPictureInPictureActive const):
     14        * platform/ios/WebVideoFullscreenControllerAVKit.mm:
     15        (VideoFullscreenControllerContext::isPictureInPictureActive const):
     16
    1172018-03-09  Basuke Suzuki  <Basuke.Suzuki@sony.com>
    218
  • trunk/Source/WebCore/platform/cocoa/PlaybackSessionModel.h

    r224085 r229472  
    8282    virtual bool wirelessVideoPlaybackDisabled() const = 0;
    8383    virtual bool isMuted() const = 0;
     84    virtual bool isPictureInPictureActive() const = 0;
    8485};
    8586
     
    101102    virtual void wirelessVideoPlaybackDisabledChanged(bool) { }
    102103    virtual void mutedChanged(bool) { }
     104    virtual void pictureInPictureActiveChanged(bool) { }
    103105};
    104106
  • trunk/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.h

    r224085 r229472  
    9393    bool wirelessVideoPlaybackDisabled() const final;
    9494    bool isMuted() const final;
     95    bool isPictureInPictureActive() const final;
    9596
    9697protected:
  • trunk/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.mm

    r224085 r229472  
    166166    }
    167167
     168    if (all
     169        || eventName == eventNames().webkitpresentationmodechangedEvent) {
     170        bool isPictureInPictureActive = this->isPictureInPictureActive();
     171
     172        for (auto client : m_clients)
     173            client->pictureInPictureActiveChanged(isPictureInPictureActive);
     174    }
     175
     176
    168177    // We don't call updateMediaSelectionIndices() in the all case, since
    169178    // updateMediaSelectionOptions() will also update the selection indices.
     
    530539}
    531540
     541bool PlaybackSessionModelMediaElement::isPictureInPictureActive() const
     542{
     543    if (!m_mediaElement)
     544        return false;
     545
     546    return (m_mediaElement->fullscreenMode() & HTMLMediaElementEnums::VideoFullscreenModePictureInPicture) == HTMLMediaElementEnums::VideoFullscreenModePictureInPicture;
     547}
     548
    532549}
    533550
  • trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm

    r226217 r229472  
    198198    FloatSize videoDimensions() const override;
    199199    bool isMuted() const override;
     200    bool isPictureInPictureActive() const override;
    200201
    201202    HashSet<PlaybackSessionModelClient*> m_playbackClients;
     
    589590}
    590591
     592bool VideoFullscreenControllerContext::isPictureInPictureActive() const
     593{
     594    ASSERT(isUIThread());
     595    return m_playbackModel ? m_playbackModel->isPictureInPictureActive() : false;
     596}
     597
    591598FloatSize VideoFullscreenControllerContext::videoDimensions() const
    592599{
  • trunk/Source/WebKit/ChangeLog

    r229467 r229472  
     12018-03-09  Jer Noble  <jer.noble@apple.com>
     2
     3        Add isPictureInPictureActive messaging across WebKit process boundary
     4        https://bugs.webkit.org/show_bug.cgi?id=183499
     5
     6        Reviewed by Eric Carlson.
     7
     8        * UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
     9        * UIProcess/Cocoa/PlaybackSessionManagerProxy.messages.in:
     10        * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
     11        (WebKit::PlaybackSessionModelContext::pictureInPictureActiveChanged):
     12        (WebKit::PlaybackSessionManagerProxy::pictureInPictureActiveChanged):
     13
    1142018-03-09  Stephan Szabo  <stephan.szabo@sony.com>
    215
  • trunk/Source/WebKit/UIProcess/Cocoa/PlaybackSessionManagerProxy.h

    r224085 r229472  
    8585    void wirelessVideoPlaybackDisabledChanged(bool);
    8686    void mutedChanged(bool);
     87    void pictureInPictureActiveChanged(bool);
    8788
    8889private:
     
    132133    bool wirelessVideoPlaybackDisabled() const final { return m_wirelessVideoPlaybackDisabled; }
    133134    bool isMuted() const final { return m_muted; }
     135    bool isPictureInPictureActive() const final { return m_pictureInPictureActive; }
    134136
    135137    PlaybackSessionManagerProxy* m_manager;
     
    157159    bool m_wirelessVideoPlaybackDisabled { false };
    158160    bool m_muted { false };
     161    bool m_pictureInPictureActive { false };
    159162};
    160163
     
    203206    void handleControlledElementIDResponse(uint64_t, String) const;
    204207    void mutedChanged(uint64_t contextId, bool muted);
     208    void pictureInPictureActiveChanged(uint64_t contextId, bool pictureInPictureActive);
    205209
    206210    // Messages to PlaybackSessionManager
  • trunk/Source/WebKit/UIProcess/Cocoa/PlaybackSessionManagerProxy.messages.in

    r219996 r229472  
    3838    RateChanged(uint64_t contextId, bool isPlaying, double rate)
    3939    MutedChanged(uint64_t contextId, bool muted);
     40    PictureInPictureActiveChanged(uint64_t contextId, bool pictureInPictureActive)
    4041    SetUpPlaybackControlsManagerWithID(uint64_t contextId)
    4142    ClearPlaybackControlsManager()
  • trunk/Source/WebKit/UIProcess/Cocoa/PlaybackSessionManagerProxy.mm

    r224085 r229472  
    259259}
    260260
     261void PlaybackSessionModelContext::pictureInPictureActiveChanged(bool active)
     262{
     263    m_pictureInPictureActive = active;
     264    for (auto* client : m_clients)
     265        client->pictureInPictureActiveChanged(active);
     266}
     267
    261268#pragma mark - PlaybackSessionManagerProxy
    262269
     
    455462}
    456463
     464void PlaybackSessionManagerProxy::pictureInPictureActiveChanged(uint64_t contextId, bool active)
     465{
     466    ensureModel(contextId).pictureInPictureActiveChanged(active);
     467}
    457468
    458469void PlaybackSessionManagerProxy::handleControlledElementIDResponse(uint64_t contextId, String identifier) const
Note: See TracChangeset for help on using the changeset viewer.