Diff
Modified: trunk/Source/WebCore/ChangeLog (197477 => 197478)
--- trunk/Source/WebCore/ChangeLog 2016-03-03 00:29:01 UTC (rev 197477)
+++ trunk/Source/WebCore/ChangeLog 2016-03-03 00:34:19 UTC (rev 197478)
@@ -1,3 +1,39 @@
+2016-03-01 Ada Chan <[email protected]>
+
+ Update the media element's presentation mode properly after going in and out of full screen via the Full Screen API
+ https://bugs.webkit.org/show_bug.cgi?id=154834
+
+ Reviewed by Simon Fraser.
+
+ * dom/Document.cpp:
+ (WebCore::Document::webkitWillEnterFullScreenForElement):
+ * dom/Element.cpp:
+ (WebCore::Element::willBecomeFullscreenElement):
+ * dom/Element.h:
+ (WebCore::Element::ancestorWillEnterFullscreen):
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::enterFullscreen):
+ If the Full Screen API is enabled and this media element is entering a mode other than standard
+ full screen, see if it's currently contained in a full screen element. If so, exit full screen.
+ (WebCore::HTMLMediaElement::willBecomeFullscreenElement):
+ If this media element is going to standard full screen, update its presentation mode. If
+ this media element also supports presentation mode and it currently has a presentation mode
+ that's not standard full screen, exit that presentation mode directly without animation.
+ (WebCore::HTMLMediaElement::willStopBeingFullscreenElement):
+ Set the presentation mode back to inline unless it's already changed to a different
+ presentation mode.
+ * html/HTMLMediaElement.h:
+ * html/HTMLVideoElement.cpp:
+ (WebCore::HTMLVideoElement::ancestorWillEnterFullscreen):
+ Reset this video element's presentation state to inline if its ancestor is going to full screen.
+ (WebCore::HTMLVideoElement::exitToFullscreenModeWithoutAnimationIfPossible):
+ If the fullscreen mode the video element is exiting from is supported, exit that mode to the new mode.
+ * html/HTMLVideoElement.h:
+ * page/ChromeClient.h:
+ * platform/mac/WebVideoFullscreenInterfaceMac.h:
+ * platform/mac/WebVideoFullscreenInterfaceMac.mm:
+ (WebCore::WebVideoFullscreenInterfaceMac::exitFullscreenWithoutAnimationToMode):
+
2016-03-02 Brady Eidson <[email protected]>
Modern IDB: Close UniqueIDBDatabases once they become unused.
Modified: trunk/Source/WebCore/dom/Document.cpp (197477 => 197478)
--- trunk/Source/WebCore/dom/Document.cpp 2016-03-03 00:29:01 UTC (rev 197477)
+++ trunk/Source/WebCore/dom/Document.cpp 2016-03-03 00:34:19 UTC (rev 197478)
@@ -5802,6 +5802,9 @@
unwrapFullScreenRenderer(m_fullScreenRenderer, m_fullScreenElement.get());
+ if (element)
+ element->willBecomeFullscreenElement();
+
m_fullScreenElement = element;
#if USE(NATIVE_FULLSCREEN_VIDEO)
Modified: trunk/Source/WebCore/dom/Element.cpp (197477 => 197478)
--- trunk/Source/WebCore/dom/Element.cpp 2016-03-03 00:29:01 UTC (rev 197477)
+++ trunk/Source/WebCore/dom/Element.cpp 2016-03-03 00:34:19 UTC (rev 197478)
@@ -2419,6 +2419,12 @@
ensureElementRareData().setMinimumSizeForResizing(size);
}
+void Element::willBecomeFullscreenElement()
+{
+ for (auto& child : descendantsOfType<Element>(*this))
+ child.ancestorWillEnterFullscreen();
+}
+
static PseudoElement* beforeOrAfterPseudoElement(Element& host, PseudoId pseudoElementSpecifier)
{
switch (pseudoElementSpecifier) {
Modified: trunk/Source/WebCore/dom/Element.h (197477 => 197478)
--- trunk/Source/WebCore/dom/Element.h 2016-03-03 00:29:01 UTC (rev 197477)
+++ trunk/Source/WebCore/dom/Element.h 2016-03-03 00:34:19 UTC (rev 197478)
@@ -358,6 +358,8 @@
// Use Document::registerForPrivateBrowsingStateChangedCallbacks() to subscribe to this.
virtual void privateBrowsingStateDidChange() { }
+ virtual void willBecomeFullscreenElement();
+ virtual void ancestorWillEnterFullscreen() { }
virtual void didBecomeFullscreenElement() { }
virtual void willStopBeingFullscreenElement() { }
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (197477 => 197478)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2016-03-03 00:29:01 UTC (rev 197477)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2016-03-03 00:34:19 UTC (rev 197478)
@@ -5277,9 +5277,19 @@
return;
#if ENABLE(FULLSCREEN_API)
- if (mode == VideoFullscreenModeStandard && document().settings() && document().settings()->fullScreenEnabled()) {
- document().requestFullScreenForElement(this, 0, Document::ExemptIFrameAllowFullScreenRequirement);
- return;
+ if (document().settings()->fullScreenEnabled()) {
+ if (mode == VideoFullscreenModeStandard) {
+ document().requestFullScreenForElement(this, 0, Document::ExemptIFrameAllowFullScreenRequirement);
+ return;
+ }
+
+ // If this media element is not going to standard fullscreen mode but there's
+ // an element that's currently in full screen in the document, exit full screen
+ // if it contains this media element.
+ if (Element* fullscreenElement = document().webkitCurrentFullScreenElement()) {
+ if (fullscreenElement->contains(this))
+ document().webkitCancelFullScreen();
+ }
}
#endif
@@ -5328,6 +5338,31 @@
}
}
+void HTMLMediaElement::willBecomeFullscreenElement()
+{
+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+ HTMLMediaElementEnums::VideoFullscreenMode oldVideoFullscreenMode = m_videoFullscreenMode;
+#endif
+
+ fullscreenModeChanged(VideoFullscreenModeStandard);
+
+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+ switch (oldVideoFullscreenMode) {
+ case VideoFullscreenModeNone:
+ case VideoFullscreenModeStandard:
+ // Don't need to do anything if we are not in any special fullscreen mode or it's already
+ // in standard fullscreen mode.
+ break;
+ case VideoFullscreenModePictureInPicture:
+ if (is<HTMLVideoElement>(*this))
+ downcast<HTMLVideoElement>(this)->exitToFullscreenModeWithoutAnimationIfPossible(oldVideoFullscreenMode, VideoFullscreenModeStandard);
+ break;
+ }
+#endif
+
+ Element::willBecomeFullscreenElement();
+}
+
void HTMLMediaElement::didBecomeFullscreenElement()
{
if (hasMediaControls())
@@ -5338,6 +5373,9 @@
{
if (hasMediaControls())
mediaControls()->exitedFullscreen();
+
+ if (fullscreenMode() == VideoFullscreenModeStandard)
+ fullscreenModeChanged(VideoFullscreenModeNone);
}
PlatformMedia HTMLMediaElement::platformMedia() const
Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (197477 => 197478)
--- trunk/Source/WebCore/html/HTMLMediaElement.h 2016-03-03 00:29:01 UTC (rev 197477)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h 2016-03-03 00:34:19 UTC (rev 197478)
@@ -505,6 +505,7 @@
virtual void removedFrom(ContainerNode&) override;
virtual void didRecalcStyle(Style::Change) override;
+ virtual void willBecomeFullscreenElement() override;
virtual void didBecomeFullscreenElement() override;
virtual void willStopBeingFullscreenElement() override;
Modified: trunk/Source/WebCore/html/HTMLVideoElement.cpp (197477 => 197478)
--- trunk/Source/WebCore/html/HTMLVideoElement.cpp 2016-03-03 00:29:01 UTC (rev 197477)
+++ trunk/Source/WebCore/html/HTMLVideoElement.cpp 2016-03-03 00:34:19 UTC (rev 197478)
@@ -318,6 +318,18 @@
return isFullscreen();
}
+void HTMLVideoElement::ancestorWillEnterFullscreen()
+{
+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+ if (fullscreenMode() == VideoFullscreenModeNone)
+ return;
+
+ // If this video element's presentation mode is not inline, but its ancestor
+ // is entering fullscreen, exit its current fullscreen mode.
+ exitToFullscreenModeWithoutAnimationIfPossible(fullscreenMode(), VideoFullscreenModeNone);
+#endif
+}
+
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
bool HTMLVideoElement::webkitWirelessVideoPlaybackDisabled() const
{
@@ -477,6 +489,14 @@
#endif
+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+void HTMLVideoElement::exitToFullscreenModeWithoutAnimationIfPossible(HTMLMediaElementEnums::VideoFullscreenMode fromMode, HTMLMediaElementEnums::VideoFullscreenMode toMode)
+{
+ if (document().page()->chrome().client().supportsVideoFullscreen(fromMode))
+ document().page()->chrome().client().exitVideoFullscreenToModeWithoutAnimation(*this, toMode);
}
+#endif
+}
+
#endif
Modified: trunk/Source/WebCore/html/HTMLVideoElement.h (197477 => 197478)
--- trunk/Source/WebCore/html/HTMLVideoElement.h 2016-03-03 00:29:01 UTC (rev 197477)
+++ trunk/Source/WebCore/html/HTMLVideoElement.h 2016-03-03 00:34:19 UTC (rev 197478)
@@ -48,6 +48,8 @@
bool webkitSupportsFullscreen();
bool webkitDisplayingFullscreen();
+ virtual void ancestorWillEnterFullscreen() override;
+
// FIXME: Maintain "FullScreen" capitalization scheme for backwards compatibility.
// https://bugs.webkit.org/show_bug.cgi?id=36081
void webkitEnterFullScreen(ExceptionCode& ec) { webkitEnterFullscreen(ec); }
@@ -86,6 +88,10 @@
virtual void fullscreenModeChanged(VideoFullscreenMode) override;
#endif
+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+ void exitToFullscreenModeWithoutAnimationIfPossible(HTMLMediaElementEnums::VideoFullscreenMode fromMode, HTMLMediaElementEnums::VideoFullscreenMode toMode);
+#endif
+
private:
HTMLVideoElement(const QualifiedName&, Document&, bool);
Modified: trunk/Source/WebCore/page/ChromeClient.h (197477 => 197478)
--- trunk/Source/WebCore/page/ChromeClient.h 2016-03-03 00:29:01 UTC (rev 197477)
+++ trunk/Source/WebCore/page/ChromeClient.h 2016-03-03 00:34:19 UTC (rev 197478)
@@ -344,6 +344,7 @@
virtual void setUpVideoControlsManager(HTMLVideoElement&) { }
#endif
virtual void exitVideoFullscreenForVideoElement(WebCore::HTMLVideoElement&) { }
+ virtual void exitVideoFullscreenToModeWithoutAnimation(WebCore::HTMLVideoElement&, HTMLMediaElementEnums::VideoFullscreenMode /*targetMode*/) { }
virtual bool requiresFullscreenForVideoPlayback() { return false; }
#if ENABLE(FULLSCREEN_API)
Modified: trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.h (197477 => 197478)
--- trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.h 2016-03-03 00:29:01 UTC (rev 197477)
+++ trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.h 2016-03-03 00:34:19 UTC (rev 197478)
@@ -77,6 +77,7 @@
WEBCORE_EXPORT void setupFullscreen(NSView& layerHostedView, const IntRect& initialRect, NSWindow *parentWindow, HTMLMediaElementEnums::VideoFullscreenMode, bool allowsPictureInPicturePlayback);
WEBCORE_EXPORT void enterFullscreen();
WEBCORE_EXPORT void exitFullscreen(const IntRect& finalRect, NSWindow *parentWindow);
+ WEBCORE_EXPORT void exitFullscreenWithoutAnimationToMode(HTMLMediaElementEnums::VideoFullscreenMode);
WEBCORE_EXPORT void cleanupFullscreen();
WEBCORE_EXPORT void invalidate();
WEBCORE_EXPORT void requestHideAndExitFullscreen() { }
Modified: trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm (197477 => 197478)
--- trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm 2016-03-03 00:29:01 UTC (rev 197477)
+++ trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm 2016-03-03 00:34:19 UTC (rev 197478)
@@ -261,6 +261,10 @@
{
}
+void WebVideoFullscreenInterfaceMac::exitFullscreenWithoutAnimationToMode(HTMLMediaElementEnums::VideoFullscreenMode)
+{
+}
+
void WebVideoFullscreenInterfaceMac::cleanupFullscreen()
{
}
Modified: trunk/Source/WebKit2/ChangeLog (197477 => 197478)
--- trunk/Source/WebKit2/ChangeLog 2016-03-03 00:29:01 UTC (rev 197477)
+++ trunk/Source/WebKit2/ChangeLog 2016-03-03 00:34:19 UTC (rev 197478)
@@ -1,3 +1,22 @@
+2016-03-01 Ada Chan <[email protected]>
+
+ Update the media element's presentation mode properly after going in and out of full screen via the Full Screen API
+ https://bugs.webkit.org/show_bug.cgi?id=154834
+
+ Reviewed by Simon Fraser.
+
+ * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h:
+ * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in:
+ * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
+ (WebKit::WebVideoFullscreenManagerProxy::exitFullscreenWithoutAnimationToMode):
+ Call the new exitFullscreenWithoutAnimationToMode() method on WebVideoFullscreenInterfaceMac.
+ * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+ (WebKit::WebChromeClient::exitVideoFullscreenToModeWithoutAnimation):
+ * WebProcess/WebCoreSupport/WebChromeClient.h:
+ * WebProcess/cocoa/WebVideoFullscreenManager.h:
+ * WebProcess/cocoa/WebVideoFullscreenManager.mm:
+ (WebKit::WebVideoFullscreenManager::exitVideoFullscreenToModeWithoutAnimation):
+
2016-03-02 Beth Dakin <[email protected]>
Crashes in media tests after http://trac.webkit.org/changeset/197461
Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h (197477 => 197478)
--- trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h 2016-03-03 00:29:01 UTC (rev 197477)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h 2016-03-03 00:34:19 UTC (rev 197478)
@@ -152,6 +152,9 @@
void exitFullscreen(uint64_t contextId, WebCore::IntRect finalRect);
void cleanupFullscreen(uint64_t contextId);
void preparedToReturnToInline(uint64_t contextId, bool visible, WebCore::IntRect inlineRect);
+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+ void exitFullscreenWithoutAnimationToMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode);
+#endif
// Messages to WebVideoFullscreenManager
void play(uint64_t contextId);
Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in (197477 => 197478)
--- trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in 2016-03-03 00:29:01 UTC (rev 197477)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in 2016-03-03 00:34:19 UTC (rev 197478)
@@ -40,5 +40,8 @@
CleanupFullscreen(uint64_t contextId)
PreparedToReturnToInline(uint64_t contextId, bool visible, WebCore::IntRect inlineRect)
SetUpVideoControlsManagerWithID(uint64_t contextId)
+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+ ExitFullscreenWithoutAnimationToMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode videoFullscreenMode)
+#endif
}
#endif
Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm (197477 => 197478)
--- trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm 2016-03-03 00:29:01 UTC (rev 197477)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm 2016-03-03 00:34:19 UTC (rev 197478)
@@ -491,6 +491,13 @@
#endif
}
+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+void WebVideoFullscreenManagerProxy::exitFullscreenWithoutAnimationToMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode targetMode)
+{
+ ensureInterface(contextId).exitFullscreenWithoutAnimationToMode(targetMode);
+}
+#endif
+
void WebVideoFullscreenManagerProxy::cleanupFullscreen(uint64_t contextId)
{
ensureInterface(contextId).cleanupFullscreen();
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (197477 => 197478)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp 2016-03-03 00:29:01 UTC (rev 197477)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp 2016-03-03 00:34:19 UTC (rev 197478)
@@ -870,7 +870,15 @@
{
m_page->videoFullscreenManager()->exitVideoFullscreenForVideoElement(videoElement);
}
+
+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+void WebChromeClient::exitVideoFullscreenToModeWithoutAnimation(WebCore::HTMLVideoElement& videoElement, HTMLMediaElementEnums::VideoFullscreenMode targetMode)
+{
+ m_page->videoFullscreenManager()->exitVideoFullscreenToModeWithoutAnimation(videoElement, targetMode);
+}
#endif
+
+#endif
#if ENABLE(FULLSCREEN_API)
bool WebChromeClient::supportsFullScreenForElement(const WebCore::Element*, bool withKeyboard)
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h (197477 => 197478)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h 2016-03-03 00:29:01 UTC (rev 197477)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h 2016-03-03 00:34:19 UTC (rev 197478)
@@ -247,7 +247,10 @@
virtual void setUpVideoControlsManager(WebCore::HTMLVideoElement&) override;
virtual void enterVideoFullscreenForVideoElement(WebCore::HTMLVideoElement&, WebCore::HTMLMediaElementEnums::VideoFullscreenMode) override;
virtual void exitVideoFullscreenForVideoElement(WebCore::HTMLVideoElement&) override;
+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+ virtual void exitVideoFullscreenToModeWithoutAnimation(WebCore::HTMLVideoElement&, WebCore::HTMLMediaElementEnums::VideoFullscreenMode) override;
#endif
+#endif
#if ENABLE(FULLSCREEN_API)
virtual bool supportsFullScreenForElement(const WebCore::Element*, bool withKeyboard) override;
Modified: trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.h (197477 => 197478)
--- trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.h 2016-03-03 00:29:01 UTC (rev 197477)
+++ trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.h 2016-03-03 00:34:19 UTC (rev 197478)
@@ -116,6 +116,7 @@
bool supportsVideoFullscreen(WebCore::HTMLMediaElementEnums::VideoFullscreenMode) const;
void enterVideoFullscreenForVideoElement(WebCore::HTMLVideoElement&, WebCore::HTMLMediaElementEnums::VideoFullscreenMode);
void exitVideoFullscreenForVideoElement(WebCore::HTMLVideoElement&);
+ void exitVideoFullscreenToModeWithoutAnimation(WebCore::HTMLVideoElement&, WebCore::HTMLMediaElementEnums::VideoFullscreenMode);
void setUpVideoControlsManager(WebCore::HTMLVideoElement&);
protected:
Modified: trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm (197477 => 197478)
--- trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm 2016-03-03 00:29:01 UTC (rev 197477)
+++ trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm 2016-03-03 00:34:19 UTC (rev 197478)
@@ -307,6 +307,23 @@
m_page->send(Messages::WebVideoFullscreenManagerProxy::SetUpVideoControlsManagerWithID(contextId), m_page->pageID());
}
+void WebVideoFullscreenManager::exitVideoFullscreenToModeWithoutAnimation(WebCore::HTMLVideoElement& videoElement, WebCore::HTMLMediaElementEnums::VideoFullscreenMode targetMode)
+{
+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+ ASSERT(m_videoElements.contains(&videoElement));
+
+ uint64_t contextId = m_videoElements.get(&videoElement);
+ auto& interface = ensureInterface(contextId);
+
+ interface.setTargetIsFullscreen(false);
+
+ m_page->send(Messages::WebVideoFullscreenManagerProxy::ExitFullscreenWithoutAnimationToMode(contextId, targetMode), m_page->pageID());
+#else
+ UNUSED_PARAM(videoElement);
+ UNUSED_PARAM(targetMode);
+#endif
+}
+
#pragma mark Interface to WebVideoFullscreenInterfaceContext:
void WebVideoFullscreenManager::resetMediaState(uint64_t contextId)