Title: [274551] trunk/Source/WebCore
Revision
274551
Author
peng.l...@apple.com
Date
2021-03-16 21:22:06 -0700 (Tue, 16 Mar 2021)

Log Message

document pictureInPictureElement is null if you Enter Picture in Picture from contextual menu
https://bugs.webkit.org/show_bug.cgi?id=223125

Reviewed by Darin Adler.

Use HTMLVideoElement's functions to change video presentation mode to ensure that
document.pictureInPictureElement is updated properly and correct events are fired.

Covered by manual tests.

* html/HTMLVideoElement.cpp:
* rendering/HitTestResult.cpp:
(WebCore::HitTestResult::enterFullscreenForVideo const):
(WebCore::HitTestResult::toggleEnhancedFullscreenForVideo const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (274550 => 274551)


--- trunk/Source/WebCore/ChangeLog	2021-03-17 04:15:52 UTC (rev 274550)
+++ trunk/Source/WebCore/ChangeLog	2021-03-17 04:22:06 UTC (rev 274551)
@@ -1,3 +1,20 @@
+2021-03-16  Peng Liu  <peng.l...@apple.com>
+
+        document pictureInPictureElement is null if you Enter Picture in Picture from contextual menu
+        https://bugs.webkit.org/show_bug.cgi?id=223125
+
+        Reviewed by Darin Adler.
+
+        Use HTMLVideoElement's functions to change video presentation mode to ensure that
+        document.pictureInPictureElement is updated properly and correct events are fired.
+
+        Covered by manual tests.
+
+        * html/HTMLVideoElement.cpp:
+        * rendering/HitTestResult.cpp:
+        (WebCore::HitTestResult::enterFullscreenForVideo const):
+        (WebCore::HitTestResult::toggleEnhancedFullscreenForVideo const):
+
 2021-03-16  Tyler Wilcock  <twilc...@protonmail.com>
 
         Add CSSValuePair.h in preparation for Pair.h refactor

Modified: trunk/Source/WebCore/html/HTMLVideoElement.cpp (274550 => 274551)


--- trunk/Source/WebCore/html/HTMLVideoElement.cpp	2021-03-17 04:15:52 UTC (rev 274550)
+++ trunk/Source/WebCore/html/HTMLVideoElement.cpp	2021-03-17 04:22:06 UTC (rev 274551)
@@ -203,7 +203,6 @@
 #endif // PLATFORM(IOS_FAMILY)
 }
 
-
 #if ENABLE(FULLSCREEN_API) && PLATFORM(IOS_FAMILY)
 void HTMLVideoElement::webkitRequestFullscreen()
 {

Modified: trunk/Source/WebCore/rendering/HitTestResult.cpp (274550 => 274551)


--- trunk/Source/WebCore/rendering/HitTestResult.cpp	2021-03-17 04:15:52 UTC (rev 274550)
+++ trunk/Source/WebCore/rendering/HitTestResult.cpp	2021-03-17 04:22:06 UTC (rev 274551)
@@ -473,7 +473,7 @@
         HTMLVideoElement& videoElement = downcast<HTMLVideoElement>(*mediaElement);
         if (!videoElement.isFullscreen() && mediaElement->supportsFullscreen(HTMLMediaElementEnums::VideoFullscreenModeStandard)) {
             UserGestureIndicator indicator(ProcessingUserGesture, &mediaElement->document());
-            videoElement.enterFullscreen();
+            videoElement.webkitEnterFullscreen();
         }
     }
 #endif
@@ -783,10 +783,10 @@
 
     HTMLVideoElement& videoElement = downcast<HTMLVideoElement>(*mediaElement);
     UserGestureIndicator indicator(ProcessingUserGesture, &mediaElement->document());
-    if (videoElement.fullscreenMode() == HTMLMediaElementEnums::VideoFullscreenModePictureInPicture)
-        videoElement.exitFullscreen();
+    if (videoElement.webkitPresentationMode() == HTMLVideoElement::VideoPresentationMode::PictureInPicture)
+        videoElement.webkitSetPresentationMode(HTMLVideoElement::VideoPresentationMode::Inline);
     else
-        videoElement.enterFullscreen(HTMLMediaElementEnums::VideoFullscreenModePictureInPicture);
+        videoElement.webkitSetPresentationMode(HTMLVideoElement::VideoPresentationMode::PictureInPicture);
 #endif
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to