Title: [294835] trunk/Source/WebKit/WebProcess/FullScreen/WebFullScreenManager.cpp
- Revision
- 294835
- Author
- [email protected]
- Date
- 2022-05-25 16:42:36 -0700 (Wed, 25 May 2022)
Log Message
Avoid extracting the main video in element fullscreen when fullscreen mode isn't active
https://bugs.webkit.org/show_bug.cgi?id=240910
rdar://93906888
Reviewed by Eric Carlson.
Add a check that we're actually still in element fullscreen before extracting the main video. Since
`WebFullScreenManager` and its `m_element` both persist after exiting fullscreen mode, there's
currently nothing preventing us from re-triggering video extraction when a video is paused once
again outside of fullscreen mode.
Covered by a new API test (more details in the bug).
* Source/WebKit/WebProcess/FullScreen/WebFullScreenManager.cpp:
(WebKit::WebFullScreenManager::handleEvent):
(WebKit::WebFullScreenManager::mainVideoElementExtractionTimerFired):
Deal with another corner case, wherein the main video element we previously detected may no longer
be in the fullscreen element's subtree by the time that the extraction timer fires. To avoid this,
always update the main video element again when the extraction timer is fired (as long as we're
still in fullscreen mode), before proceeding with extraction.
Canonical link: https://commits.webkit.org/250985@main
Modified Paths
Diff
Modified: trunk/Source/WebKit/WebProcess/FullScreen/WebFullScreenManager.cpp (294834 => 294835)
--- trunk/Source/WebKit/WebProcess/FullScreen/WebFullScreenManager.cpp 2022-05-25 23:27:02 UTC (rev 294834)
+++ trunk/Source/WebKit/WebProcess/FullScreen/WebFullScreenManager.cpp 2022-05-25 23:42:36 UTC (rev 294835)
@@ -374,9 +374,13 @@
{
#if ENABLE(VIDEO)
RefPtr targetElement = dynamicDowncast<WebCore::Element>(event.currentTarget());
- if (!m_element || &context != &m_element->document() || !targetElement)
+ if (!m_element || !targetElement)
return;
+ Ref document = m_element->document();
+ if (&context != document.ptr() || !document->fullscreenManager().isFullscreen())
+ return;
+
if (targetElement == m_element) {
updateMainVideoElement();
return;
@@ -398,6 +402,11 @@
void WebFullScreenManager::mainVideoElementExtractionTimerFired()
{
+ if (!m_element || !m_element->document().fullscreenManager().isFullscreen())
+ return;
+
+ updateMainVideoElement();
+
if (!m_mainVideoElement)
return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes