[Mac] media/pip-video-going-into-fullscreen.html is a flaky failure
authoradachan@apple.com <adachan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 Aug 2016 18:11:50 +0000 (18:11 +0000)
committeradachan@apple.com <adachan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 Aug 2016 18:11:50 +0000 (18:11 +0000)
commitbb3022ea644272c01686e6a9ca39dd1ff6ce8fb0
treea669db368bac0bff4665cd7bb001b1b694efeb38
parent1a84bb4951c89f53ccaacac3320520f8d39f1856
[Mac] media/pip-video-going-into-fullscreen.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=160469

Reviewed by Eric Carlson.

Source/WebCore:

When going from picture-in-picture directly to fullscreen, fix the issue where the
presentation mode unexpectedly changes back to inline after changing to fullscreen.

On Mac, standard fullscreen is not handled by WebVideoFullscreenManager.
When going from picture-in-picture directly to fullscreen, we call
WebVideoFullscreenInterfaceMac::exitFullscreenWithoutAnimationToMode().
We should update m_mode to VideoFullscreenModeStandard there to keep it in sync
with the fullscreen mode in HTMLMediaElement. Otherwise, we'll inadvertently
update the mode to inline when we clear the VideoFullscreenModePictureInPicture mode
in -[WebVideoFullscreenInterfaceMacObjC pipDidClose:].

Since standard fullscreen on Mac doesn't make use of the video fullscreen layer,
we need to make sure we return the video layer back to inline when the presentation
mode changes to "fullscreen". We only do this on Mac because iOS does use
the video fullscreen layer for standard fullscreen.

* Modules/mediacontrols/MediaControlsHost.cpp:
(WebCore::MediaControlsHost::setPreparedToReturnVideoLayerToInline):
Renamed from MediaControlsHost::setPreparedForInline to make it clear this is about
whether the video layer should be inline.
(WebCore::MediaControlsHost::setPreparedForInline): Deleted.
* Modules/mediacontrols/MediaControlsHost.h:
* Modules/mediacontrols/MediaControlsHost.idl:

* Modules/mediacontrols/mediaControlsApple.js:
(Controller.prototype.shouldReturnVideoLayerToInline):
On Mac, the video layer is inline when the presentation mode is "inline" or "fullscreen".
(Controller.prototype.handlePresentationModeChange):
Call shouldReturnVideoLayerToInline() to determine whether the video layer should be inline.

* Modules/mediacontrols/mediaControlsiOS.js:
(ControllerIOS.prototype.shouldReturnVideoLayerToInline):
Override this method since on iOS, the video layer is only inline when the presentation
mode is "inline".

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer):
(WebCore::HTMLMediaElement::setPreparedToReturnVideoLayerToInline):
(WebCore::HTMLMediaElement::setPreparedForInline): Deleted.
* html/HTMLMediaElement.h:

* platform/mac/WebVideoFullscreenInterfaceMac.mm:
(WebCore::WebVideoFullscreenInterfaceMac::enterFullscreen):
Remove the assertion that the mode must be "picture-in-picture". I've run into this
assertion in layout tests. Since the EnterFullscreen message is sent in a dispatch_async
block in WebVideoFullscreenManager::didSetupFullscreen(), there's a chance that the
fullscreen mode tracked in WebVideoFullscreenInterfaceMac has already changed to
something else when WebVideoFullscreenInterfaceMac::enterFullscreen() is called.
(WebCore::WebVideoFullscreenInterfaceMac::exitFullscreenWithoutAnimationToMode):
If exiting to standard fullscreen, update m_mode to VideoFullscreenModeStandard.

LayoutTests:

Re-enable media/pip-video-going-into-fullscreen.html on Sierra.

* platform/mac-wk2/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204088 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/platform/mac-wk2/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp
Source/WebCore/Modules/mediacontrols/MediaControlsHost.h
Source/WebCore/Modules/mediacontrols/MediaControlsHost.idl
Source/WebCore/Modules/mediacontrols/mediaControlsApple.js
Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLMediaElement.h
Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm