- Revision
- 204088
- Author
- adac...@apple.com
- Date
- 2016-08-03 11:11:50 -0700 (Wed, 03 Aug 2016)
Log Message
[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:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (204087 => 204088)
--- trunk/LayoutTests/ChangeLog 2016-08-03 18:05:50 UTC (rev 204087)
+++ trunk/LayoutTests/ChangeLog 2016-08-03 18:11:50 UTC (rev 204088)
@@ -1,3 +1,14 @@
+2016-08-02 Ada Chan <adac...@apple.com>
+
+ [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.
+
+ Re-enable media/pip-video-going-into-fullscreen.html on Sierra.
+
+ * platform/mac-wk2/TestExpectations:
+
2016-08-03 Youenn Fablet <you...@apple.com>
http/tests/fetch/fetch-in-worker-crash.html is sometimes crashing
Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (204087 => 204088)
--- trunk/LayoutTests/platform/mac-wk2/TestExpectations 2016-08-03 18:05:50 UTC (rev 204087)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations 2016-08-03 18:11:50 UTC (rev 204088)
@@ -473,6 +473,7 @@
[ Sierra+ ] media/fullscreen-api-enabled-media-with-presentation-mode.html [ Pass ]
[ Sierra+ ] media/fullscreen-video-going-into-pip.html [ Pass ]
[ Sierra+ ] media/navigate-with-pip-should-not-crash.html [ Pass ]
+[ Sierra+ ] media/pip-video-going-into-fullscreen.html [ Pass ]
[ Sierra+ ] media/video-contained-in-fullscreen-element-going-into-pip.html [ Pass ]
# rdar://problem/26885345
@@ -479,9 +480,6 @@
[ Release Sierra+ ] media/click-placeholder-not-pausing.html [ Pass ]
[ Debug Sierra+ ] media/click-placeholder-not-pausing.html [ Skip ]
-# rdar://problem/26901714
-[ Sierra+ ] media/pip-video-going-into-fullscreen.html [ Pass Failure ]
-
# RTL Scrollbars are enabled on Sierra WebKit2.
[ Sierra+ ] fast/scrolling/rtl-scrollbars.html [ Pass ]
[ Sierra+ ] fast/scrolling/rtl-scrollbars-simple.html [ Pass ]
Modified: trunk/Source/WebCore/ChangeLog (204087 => 204088)
--- trunk/Source/WebCore/ChangeLog 2016-08-03 18:05:50 UTC (rev 204087)
+++ trunk/Source/WebCore/ChangeLog 2016-08-03 18:11:50 UTC (rev 204088)
@@ -1,3 +1,61 @@
+2016-08-02 Ada Chan <adac...@apple.com>
+
+ [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.
+
+ 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.
+
2016-08-03 Youenn Fablet <you...@apple.com>
http/tests/fetch/fetch-in-worker-crash.html is sometimes crashing
Modified: trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp (204087 => 204088)
--- trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp 2016-08-03 18:05:50 UTC (rev 204087)
+++ trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp 2016-08-03 18:11:50 UTC (rev 204088)
@@ -215,9 +215,9 @@
return m_mediaElement->isVideoLayerInline();
}
-void MediaControlsHost::setPreparedForInline(bool value)
+void MediaControlsHost::setPreparedToReturnVideoLayerToInline(bool value)
{
- m_mediaElement->setPreparedForInline(value);
+ m_mediaElement->setPreparedToReturnVideoLayerToInline(value);
}
bool MediaControlsHost::userGestureRequired() const
Modified: trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.h (204087 => 204088)
--- trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.h 2016-08-03 18:05:50 UTC (rev 204087)
+++ trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.h 2016-08-03 18:11:50 UTC (rev 204088)
@@ -66,7 +66,7 @@
bool supportsFullscreen();
bool isVideoLayerInline();
bool userGestureRequired() const;
- void setPreparedForInline(bool);
+ void setPreparedToReturnVideoLayerToInline(bool);
void updateCaptionDisplaySizes();
void enteredFullscreen();
Modified: trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.idl (204087 => 204088)
--- trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.idl 2016-08-03 18:05:50 UTC (rev 204087)
+++ trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.idl 2016-08-03 18:11:50 UTC (rev 204088)
@@ -42,7 +42,7 @@
readonly attribute TextTrack captionMenuAutomaticItem;
readonly attribute DOMString captionDisplayMode;
void setSelectedTextTrack(TextTrack? track);
- void setPreparedForInline(boolean prepared);
+ void setPreparedToReturnVideoLayerToInline(boolean prepared);
readonly attribute HTMLElement textTrackContainer;
readonly attribute boolean allowsInlineMediaPlayback;
readonly attribute boolean supportsFullscreen;
Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js (204087 => 204088)
--- trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js 2016-08-03 18:05:50 UTC (rev 204087)
+++ trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js 2016-08-03 18:11:50 UTC (rev 204088)
@@ -909,6 +909,12 @@
setTimeout(this.showInlinePlaybackPlaceholderWhenSafe.bind(this), this.PlaceholderPollingDelay);
},
+ shouldReturnVideoLayerToInline: function()
+ {
+ var presentationMode = this.presentationMode();
+ return presentationMode === 'inline' || presentationMode === 'fullscreen';
+ },
+
handlePresentationModeChange: function(event)
{
var presentationMode = this.presentationMode();
@@ -951,7 +957,7 @@
this.resetHideControlsTimer();
if (presentationMode != 'fullscreen' && this.video.paused && this.controlsAreHidden())
this.showControls();
- this.host.setPreparedForInline(presentationMode === 'inline')
+ this.host.setPreparedToReturnVideoLayerToInline(this.shouldReturnVideoLayerToInline());
},
handleFullscreenChange: function(event)
Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js (204087 => 204088)
--- trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js 2016-08-03 18:05:50 UTC (rev 204087)
+++ trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js 2016-08-03 18:11:50 UTC (rev 204088)
@@ -536,6 +536,11 @@
Controller.prototype.setShouldListenForPlaybackTargetAvailabilityEvent.call(this, shouldListen);
},
+ shouldReturnVideoLayerToInline: function()
+ {
+ return this.presentationMode() === 'inline';
+ },
+
handlePresentationModeChange: function(event)
{
var presentationMode = this.presentationMode();
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (204087 => 204088)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2016-08-03 18:05:50 UTC (rev 204087)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2016-08-03 18:11:50 UTC (rev 204088)
@@ -5079,7 +5079,7 @@
if (m_videoFullscreenMode != VideoFullscreenModeNone)
exitFullscreen();
- setPreparedForInline(true);
+ setPreparedToReturnVideoLayerToInline(true);
updatePlaybackControlsManager();
m_inActiveDocument = false;
@@ -5529,7 +5529,7 @@
return m_player ? m_player->platformLayer() : nullptr;
}
-void HTMLMediaElement::setPreparedForInline(bool value)
+void HTMLMediaElement::setPreparedToReturnVideoLayerToInline(bool value)
{
m_preparedForInline = value;
if (m_preparedForInline && m_preparedForInlineCompletionHandler) {
Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (204087 => 204088)
--- trunk/Source/WebCore/html/HTMLMediaElement.h 2016-08-03 18:05:50 UTC (rev 204087)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h 2016-08-03 18:11:50 UTC (rev 204088)
@@ -130,7 +130,7 @@
WEBCORE_EXPORT PlatformMedia platformMedia() const;
PlatformLayer* platformLayer() const;
bool isVideoLayerInline();
- void setPreparedForInline(bool);
+ void setPreparedToReturnVideoLayerToInline(bool);
void waitForPreparedForInlineThen(std::function<void()> completionHandler = [] { });
#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
void setVideoFullscreenLayer(PlatformLayer*, std::function<void()> completionHandler = [] { });
Modified: trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm (204087 => 204088)
--- trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm 2016-08-03 18:05:50 UTC (rev 204087)
+++ trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm 2016-08-03 18:11:50 UTC (rev 204088)
@@ -467,8 +467,7 @@
if (m_fullscreenChangeObserver)
m_fullscreenChangeObserver->didEnterFullscreen();
- } else
- ASSERT_NOT_REACHED();
+ }
}
void WebVideoFullscreenInterfaceMac::exitFullscreen(const IntRect& finalRect, NSWindow *parentWindow)
@@ -491,7 +490,14 @@
if ([m_webVideoFullscreenInterfaceObjC didRequestExitingPIP])
return;
- [m_webVideoFullscreenInterfaceObjC setExitingToStandardFullscreen:mode == HTMLMediaElementEnums::VideoFullscreenModeStandard];
+ bool isExitingToStandardFullscreen = mode == HTMLMediaElementEnums::VideoFullscreenModeStandard;
+ // On Mac, standard fullscreen is handled by the Fullscreen API and not by WebVideoFullscreenManager.
+ // Just update m_mode directly to HTMLMediaElementEnums::VideoFullscreenModeStandard in that case to keep
+ // m_mode in sync with the fullscreen mode in HTMLMediaElement.
+ if (isExitingToStandardFullscreen)
+ m_mode = HTMLMediaElementEnums::VideoFullscreenModeStandard;
+
+ [m_webVideoFullscreenInterfaceObjC setExitingToStandardFullscreen:isExitingToStandardFullscreen];
[m_webVideoFullscreenInterfaceObjC exitPIP];
}