Changeset 209156 in webkit


Ignore:
Timestamp:
Nov 30, 2016 2:45:38 PM (7 years ago)
Author:
commit-queue@webkit.org
Message:

[Modern Media Controls] Controls are not visible when returning from picture-in-picture playback
https://bugs.webkit.org/show_bug.cgi?id=165183

Patch by Antoine Quint <Antoine Quint> on 2016-11-30
Reviewed by Dean Jackson.

We need to call MediaControlsHost::setPreparedToReturnVideoLayerToInline() when we return from
picture-in-picture playback such that the video layer is correctly stacked under the media controls.
We call that function in a rAF call to ensure it's performed in sync with the next scheduled layout
or the media controls would not appear in sync with the video layer.

We also fix an error from a previous commit in ControlsVisibilitySupport.

  • Modules/modern-media-controls/media/controls-visibility-support.js:

(ControlsVisibilitySupport.prototype.syncControl):
(ControlsVisibilitySupport):

  • Modules/modern-media-controls/media/media-controller.js:

(MediaController):
(MediaController.prototype.handleEvent):
(MediaController.prototype._returnMediaLayerToInlineIfNeeded):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r209155 r209156  
     12016-11-30  Antoine Quint  <graouts@apple.com>
     2
     3        [Modern Media Controls] Controls are not visible when returning from picture-in-picture playback
     4        https://bugs.webkit.org/show_bug.cgi?id=165183
     5
     6        Reviewed by Dean Jackson.
     7
     8        We need to call MediaControlsHost::setPreparedToReturnVideoLayerToInline() when we return from
     9        picture-in-picture playback such that the video layer is correctly stacked under the media controls.
     10        We call that function in a rAF call to ensure it's performed in sync with the next scheduled layout
     11        or the media controls would not appear in sync with the video layer.
     12
     13        We also fix an error from a previous commit in ControlsVisibilitySupport.
     14
     15        * Modules/modern-media-controls/media/controls-visibility-support.js:
     16        (ControlsVisibilitySupport.prototype.syncControl):
     17        (ControlsVisibilitySupport):
     18        * Modules/modern-media-controls/media/media-controller.js:
     19        (MediaController):
     20        (MediaController.prototype.handleEvent):
     21        (MediaController.prototype._returnMediaLayerToInlineIfNeeded):
     22
    1232016-11-30  Jiewen Tan  <jiewen_tan@apple.com>
    224
  • trunk/Source/WebCore/Modules/modern-media-controls/media/controls-visibility-support.js

    r209108 r209156  
    5050    {
    5151        let shouldShowControls = this.mediaController.media.controls;
    52         if (media instanceof HTMLVideoElement)
     52        if (this.mediaController.media instanceof HTMLVideoElement)
    5353            shouldShowControls = shouldShowControls && this.mediaController.media.readyState > HTMLMediaElement.HAVE_NOTHING;
    5454
  • trunk/Source/WebCore/Modules/modern-media-controls/media/media-controller.js

    r209108 r209156  
    3333        this.host = host;
    3434
     35        if (host)
     36            media.addEventListener("webkitpresentationmodechanged", this);
     37
    3538        this._updateControlsIfNeeded();
    3639
     
    6265    handleEvent(event)
    6366    {
    64         if (event.type === "resize" && event.currentTarget === this.media)
     67        if (event.currentTarget !== this.media)
     68            return;
     69
     70        switch (event.type) {
     71        case "resize":
    6572            this._updateControlsSize();
    66         else if (event.type === "webkitfullscreenchange" && event.currentTarget === this.media)
     73            break;
     74        case "webkitfullscreenchange":
    6775            this._updateControlsIfNeeded();
     76            break;
     77        case "webkitpresentationmodechanged":
     78            this._returnMediaLayerToInlineIfNeeded();
     79            break;
     80        }
    6881    }
    6982
     
    104117    }
    105118
     119    _returnMediaLayerToInlineIfNeeded()
     120    {
     121        window.requestAnimationFrame(() => this.host.setPreparedToReturnVideoLayerToInline(this.media.webkitPresentationMode !== PiPMode));
     122    }
     123
    106124    _controlsClass()
    107125    {
Note: See TracChangeset for help on using the changeset viewer.