Changeset 268816 in webkit


Ignore:
Timestamp:
Oct 21, 2020 12:21:55 PM (21 months ago)
Author:
Peng Liu
Message:

A video element may fail to enter picture-in-picture from fullscreen
https://bugs.webkit.org/show_bug.cgi?id=217999

Reviewed by Eric Carlson.

When a video element is entering picture-in-picture from fullscreen,
WebKit should only fire the webkitendfullscreenEvent event, but should not
request the player in the UI process to exit fullscreen(picture-in-picture).
So the condition to decide sending the exit fullscreen request is wrong because
HTMLMediaElement::didBecomeFullscreenElement(), which sets m_waitingToEnterFullscreen
to false, might be called before dispatching the webkitendfullscreenEvent event.

  • html/HTMLMediaElement.cpp:

(WebCore::HTMLMediaElement::dispatchEvent): Fix the condition.
(WebCore::HTMLMediaElement::exitFullscreen): Set fullscreen mode to VideoFullscreenModeNone.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r268815 r268816  
     12020-10-21  Peng Liu  <peng.liu6@apple.com>
     2
     3        A video element may fail to enter picture-in-picture from fullscreen
     4        https://bugs.webkit.org/show_bug.cgi?id=217999
     5
     6        Reviewed by Eric Carlson.
     7
     8        When a video element is entering picture-in-picture from fullscreen,
     9        WebKit should only fire the `webkitendfullscreenEvent` event, but should not
     10        request the player in the UI process to exit fullscreen(picture-in-picture).
     11        So the condition to decide sending the exit fullscreen request is wrong because
     12        HTMLMediaElement::didBecomeFullscreenElement(), which sets `m_waitingToEnterFullscreen`
     13        to false, might be called before dispatching the `webkitendfullscreenEvent` event.
     14
     15        * html/HTMLMediaElement.cpp:
     16        (WebCore::HTMLMediaElement::dispatchEvent): Fix the condition.
     17        (WebCore::HTMLMediaElement::exitFullscreen): Set fullscreen mode to VideoFullscreenModeNone.
     18
    1192020-10-21  Zalan Bujtas  <zalan@apple.com>
    220
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r268607 r268816  
    57415741    // to change the position/size back *before* exiting fullscreen.
    57425742    // Otherwise, the exit fullscreen animation will be incorrect.
    5743     if (!m_videoFullscreenStandby && !m_waitingToEnterFullscreen && event.type() == eventNames().webkitendfullscreenEvent) {
    5744         setFullscreenMode(VideoFullscreenModeNone);
     5743    if (!m_videoFullscreenStandby && m_videoFullscreenMode == VideoFullscreenModeNone && event.type() == eventNames().webkitendfullscreenEvent)
    57455744        document().page()->chrome().client().exitVideoFullscreenForVideoElement(downcast<HTMLVideoElement>(*this));
    5746     }
    57475745}
    57485746
     
    60036001
    60046002        if (oldVideoFullscreenMode == VideoFullscreenModeStandard) {
     6003            setFullscreenMode(VideoFullscreenModeNone);
    60056004            // The exit fullscreen request will be sent in dispatchEvent().
    60066005            scheduleEvent(eventNames().webkitendfullscreenEvent);
Note: See TracChangeset for help on using the changeset viewer.