Diff
Modified: trunk/Source/WebCore/ChangeLog (261000 => 261001)
--- trunk/Source/WebCore/ChangeLog 2020-05-01 15:34:33 UTC (rev 261000)
+++ trunk/Source/WebCore/ChangeLog 2020-05-01 16:17:16 UTC (rev 261001)
@@ -1,3 +1,28 @@
+2020-05-01 Peng Liu <peng.l...@apple.com>
+
+ A PiP window doesn’t actually dismiss after the browser navigates to a different page within the same domain
+ https://bugs.webkit.org/show_bug.cgi?id=211257
+
+ Reviewed by Jer Noble.
+
+ When we suspend a video element (this will happen when the browser is navigating to another page
+ within the same domain), we need to request the corresponding video to exit fullscreen/PiP.
+ The operation should be done immediately because the video element won't response to events
+ after it is suspended.
+
+ In r259095, we hold the start of exiting video fullscreen/PiP in HTMLMediaElement::exitFullscreen()
+ until the "webkitendfullscreen" event is dispatched/handled. This behavior does not work if
+ the video element is going to be suspended because the exiting fullscreen operation will be held
+ until the video element is resumed. Therefore, we need to handle that case separately by exiting
+ video fullscreen/PiP immediately.
+
+ API test: PictureInPicture.ExitPiPOnSuspendVideoElement
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::exitFullscreen):
+ * platform/ios/VideoFullscreenInterfaceAVKit.mm:
+ (VideoFullscreenInterfaceAVKit::exitFullscreen):
+
2020-05-01 Zalan Bujtas <za...@apple.com>
[LFC][TFC] Introduce struct RowHeight in TableFormattingContext::computeAndDistributeExtraVerticalSpace
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (261000 => 261001)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2020-05-01 15:34:33 UTC (rev 261000)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2020-05-01 16:17:16 UTC (rev 261001)
@@ -6056,14 +6056,10 @@
}
}
-#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
if (document().activeDOMObjectsAreSuspended() || document().activeDOMObjectsAreStopped()) {
fullscreenModeChanged(VideoFullscreenModeNone);
document().page()->chrome().client().exitVideoFullscreenToModeWithoutAnimation(downcast<HTMLVideoElement>(*this), VideoFullscreenModeNone);
- }
- else
-#endif
- if (document().page()->chrome().client().supportsVideoFullscreen(oldVideoFullscreenMode)) {
+ } else if (document().page()->chrome().client().supportsVideoFullscreen(oldVideoFullscreenMode)) {
if (m_videoFullscreenStandby) {
fullscreenModeChanged(VideoFullscreenModeNone);
document().page()->chrome().client().enterVideoFullscreenForVideoElement(downcast<HTMLVideoElement>(*this), m_videoFullscreenMode, m_videoFullscreenStandby);
Modified: trunk/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm (261000 => 261001)
--- trunk/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm 2020-05-01 15:34:33 UTC (rev 261000)
+++ trunk/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm 2020-05-01 16:17:16 UTC (rev 261001)
@@ -911,7 +911,8 @@
void VideoFullscreenInterfaceAVKit::exitFullscreen(const IntRect& finalRect)
{
- m_watchdogTimer.stop();
+ if (m_watchdogTimer.isActive())
+ m_watchdogTimer.stop();
m_targetMode = HTMLMediaElementEnums::VideoFullscreenModeNone;
Modified: trunk/Source/WebKit/ChangeLog (261000 => 261001)
--- trunk/Source/WebKit/ChangeLog 2020-05-01 15:34:33 UTC (rev 261000)
+++ trunk/Source/WebKit/ChangeLog 2020-05-01 16:17:16 UTC (rev 261001)
@@ -1,3 +1,25 @@
+2020-05-01 Peng Liu <peng.l...@apple.com>
+
+ A PiP window doesn’t actually dismiss after the browser navigates to a different page within the same domain
+ https://bugs.webkit.org/show_bug.cgi?id=211257
+
+ Reviewed by Jer Noble.
+
+ Add the support of exitVideoFullscreenToModeWithoutAnimation() in iOS,
+ so that the Web process can request the UI process to close the PiP window
+ without exchanging IPC messages back and forth.
+
+ * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
+ * UIProcess/Cocoa/VideoFullscreenManagerProxy.messages.in:
+ * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
+ (WebKit::VideoFullscreenManagerProxy::exitFullscreenWithoutAnimationToMode):
+ * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+ * WebProcess/WebCoreSupport/WebChromeClient.h:
+
+ Only stop the watchdog timer if it is active.
+ * WebProcess/cocoa/VideoFullscreenManager.mm:
+ (WebKit::VideoFullscreenManager::exitVideoFullscreenToModeWithoutAnimation):
+
2020-05-01 Commit Queue <commit-qu...@webkit.org>
Unreviewed, reverting r260920.
Modified: trunk/Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.h (261000 => 261001)
--- trunk/Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.h 2020-05-01 15:34:33 UTC (rev 261000)
+++ trunk/Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.h 2020-05-01 16:17:16 UTC (rev 261001)
@@ -132,9 +132,7 @@
void requestRouteSharingPolicyAndContextUID(uint64_t contextId, CompletionHandler<void(WebCore::RouteSharingPolicy, String)>&&);
-#if ENABLE(VIDEO_PRESENTATION_MODE)
bool isPlayingVideoInEnhancedFullscreen() const;
-#endif
PlatformVideoFullscreenInterface* controlsManagerInterface();
@@ -165,9 +163,7 @@
void cleanupFullscreen(uint64_t contextId);
void preparedToReturnToInline(uint64_t contextId, bool visible, WebCore::IntRect inlineRect);
void preparedToExitFullscreen(uint64_t contextId);
-#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
void exitFullscreenWithoutAnimationToMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode);
-#endif
// Messages to VideoFullscreenManager
void requestFullscreenMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode, bool finishedWithMedia = false);
Modified: trunk/Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.messages.in (261000 => 261001)
--- trunk/Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.messages.in 2020-05-01 15:34:33 UTC (rev 261000)
+++ trunk/Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.messages.in 2020-05-01 16:17:16 UTC (rev 261001)
@@ -32,8 +32,6 @@
CleanupFullscreen(uint64_t contextId)
PreparedToReturnToInline(uint64_t contextId, bool visible, WebCore::IntRect inlineRect)
PreparedToExitFullscreen(uint64_t contextId)
-#if PLATFORM(MAC)
ExitFullscreenWithoutAnimationToMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode videoFullscreenMode)
-#endif
}
#endif
Modified: trunk/Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.mm (261000 => 261001)
--- trunk/Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.mm 2020-05-01 15:34:33 UTC (rev 261000)
+++ trunk/Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.mm 2020-05-01 16:17:16 UTC (rev 261001)
@@ -572,13 +572,20 @@
#endif
}
-#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
void VideoFullscreenManagerProxy::exitFullscreenWithoutAnimationToMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode targetMode)
{
MESSAGE_CHECK_CONTEXTID(contextId);
+#if PLATFORM(MAC)
ensureInterface(contextId).exitFullscreenWithoutAnimationToMode(targetMode);
+#else
+ auto& [model, interface] = ensureModelAndInterface(contextId);
+ interface->invalidate();
+ [model->layerHostView() removeFromSuperview];
+ model->setLayerHostView(nullptr);
+ removeClientForContext(contextId);
+ m_page->uiClient().hasVideoInPictureInPictureDidChange(m_page, targetMode & MediaPlayerEnums::VideoFullscreenModePictureInPicture);
+#endif
}
-#endif
#if PLATFORM(IOS_FAMILY)
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp (261000 => 261001)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp 2020-05-01 15:34:33 UTC (rev 261000)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp 2020-05-01 16:17:16 UTC (rev 261001)
@@ -1030,7 +1030,7 @@
}
#endif // ENABLE(MEDIA_USAGE)
-#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+#if ENABLE(VIDEO_PRESENTATION_MODE)
void WebChromeClient::exitVideoFullscreenToModeWithoutAnimation(HTMLVideoElement& videoElement, HTMLMediaElementEnums::VideoFullscreenMode targetMode)
{
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h (261000 => 261001)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h 2020-05-01 15:34:33 UTC (rev 261000)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h 2020-05-01 16:17:16 UTC (rev 261001)
@@ -276,7 +276,7 @@
void removeMediaUsageManagerSession(WebCore::MediaSessionIdentifier) final;
#endif
-#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+#if ENABLE(VIDEO_PRESENTATION_MODE)
void exitVideoFullscreenToModeWithoutAnimation(WebCore::HTMLVideoElement&, WebCore::HTMLMediaElementEnums::VideoFullscreenMode) final;
#endif
Modified: trunk/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.mm (261000 => 261001)
--- trunk/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.mm 2020-05-01 15:34:33 UTC (rev 261000)
+++ trunk/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.mm 2020-05-01 16:17:16 UTC (rev 261001)
@@ -308,7 +308,6 @@
{
LOG(Fullscreen, "VideoFullscreenManager::exitVideoFullscreenToModeWithoutAnimation(%p)", this);
-#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
ASSERT(m_page);
ASSERT(m_videoElements.contains(&videoElement));
@@ -318,10 +317,6 @@
interface.setTargetIsFullscreen(false);
m_page->send(Messages::VideoFullscreenManagerProxy::ExitFullscreenWithoutAnimationToMode(contextId, targetMode));
-#else
- UNUSED_PARAM(videoElement);
- UNUSED_PARAM(targetMode);
-#endif
}
#pragma mark Interface to VideoFullscreenInterfaceContext:
Modified: trunk/Tools/ChangeLog (261000 => 261001)
--- trunk/Tools/ChangeLog 2020-05-01 15:34:33 UTC (rev 261000)
+++ trunk/Tools/ChangeLog 2020-05-01 16:17:16 UTC (rev 261001)
@@ -1,3 +1,17 @@
+2020-05-01 Peng Liu <peng.l...@apple.com>
+
+ A PiP window doesn’t actually dismiss after the browser navigates to a different page within the same domain
+ https://bugs.webkit.org/show_bug.cgi?id=211257
+
+ Reviewed by Jer Noble.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit/AGXCompilerService.mm:
+ (TEST):
+ * TestWebKitAPI/Tests/WebKitCocoa/ExitPiPOnSuspendVideoElement.mm: Added.
+ (-[ExitPiPOnSuspendVideoElementUIDelegate _webView:hasVideoInPictureInPictureDidChange:]):
+ (TestWebKitAPI::TEST):
+
2020-05-01 Jonathan Bedard <jbed...@apple.com>
results.webkit.org: Dropped connections when uploading archives shouldn't be fatal
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (261000 => 261001)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2020-05-01 15:34:33 UTC (rev 261000)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2020-05-01 16:17:16 UTC (rev 261001)
@@ -113,6 +113,7 @@
1CF59AE221E68925006E37EC /* ForceLightAppearanceInBundle_Bundle.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1CF59AE021E68925006E37EC /* ForceLightAppearanceInBundle_Bundle.mm */; };
1CF59AE321E68932006E37EC /* ForceLightAppearanceInBundle.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1CF59ADF21E68925006E37EC /* ForceLightAppearanceInBundle.mm */; };
1CF59AE521E6977D006E37EC /* dark-mode.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 1CF59AE421E696FB006E37EC /* dark-mode.html */; };
+ 1D12BEC0245BEF85004C0B7A /* ExitPiPOnSuspendVideoElement.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1D12BEBF245BEF85004C0B7A /* ExitPiPOnSuspendVideoElement.mm */; };
1D67BFDC2433E0A7006B5047 /* PreemptVideoFullscreen.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1D67BFDB2433E0A7006B5047 /* PreemptVideoFullscreen.mm */; };
1D67BFDD2433EE66006B5047 /* two-videos.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 1D67BFD92433DFD8006B5047 /* two-videos.html */; };
1DAA52CC243BE805001A3159 /* one-video.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 1DAA52CB243BE621001A3159 /* one-video.html */; };
@@ -1681,6 +1682,7 @@
1CF59ADF21E68925006E37EC /* ForceLightAppearanceInBundle.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ForceLightAppearanceInBundle.mm; sourceTree = "<group>"; };
1CF59AE021E68925006E37EC /* ForceLightAppearanceInBundle_Bundle.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ForceLightAppearanceInBundle_Bundle.mm; sourceTree = "<group>"; };
1CF59AE421E696FB006E37EC /* dark-mode.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "dark-mode.html"; sourceTree = "<group>"; };
+ 1D12BEBF245BEF85004C0B7A /* ExitPiPOnSuspendVideoElement.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ExitPiPOnSuspendVideoElement.mm; sourceTree = "<group>"; };
1D67BFD92433DFD8006B5047 /* two-videos.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "two-videos.html"; sourceTree = "<group>"; };
1D67BFDB2433E0A7006B5047 /* PreemptVideoFullscreen.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = PreemptVideoFullscreen.mm; sourceTree = "<group>"; };
1DAA52CB243BE621001A3159 /* one-video.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "one-video.html"; sourceTree = "<group>"; };
@@ -3058,6 +3060,7 @@
A15502281E05020B00A24C57 /* DuplicateCompletionHandlerCalls.mm */,
F44D06461F395C4D001A0E29 /* EditorStateTests.mm */,
CDA29B2820FD2A9900F15CED /* ExitFullscreenOnEnterPiP.mm */,
+ 1D12BEBF245BEF85004C0B7A /* ExitPiPOnSuspendVideoElement.mm */,
2D8104CB1BEC13E70020DA46 /* FindInPage.mm */,
51242CD42374E61E00EED9C1 /* FindInPageAPI.mm */,
118153472208BADF00B2CCD2 /* FirstVisuallyNonEmptyMilestone.mm */,
@@ -4873,6 +4876,7 @@
7CCE7EF01A411AE600447C4C /* EvaluateJavaScript.cpp in Sources */,
5C7964101EB0278D0075D74C /* EventModifiers.cpp in Sources */,
CDA29B2920FD2A9900F15CED /* ExitFullscreenOnEnterPiP.mm in Sources */,
+ 1D12BEC0245BEF85004C0B7A /* ExitPiPOnSuspendVideoElement.mm in Sources */,
315118101DB1AE4000176304 /* ExtendedColor.cpp in Sources */,
7CCE7EF11A411AE600447C4C /* FailedLoad.cpp in Sources */,
579651E7216BFDED006EBFE5 /* FidoHidMessageTest.cpp in Sources */,
Added: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ExitPiPOnSuspendVideoElement.mm (0 => 261001)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ExitPiPOnSuspendVideoElement.mm (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ExitPiPOnSuspendVideoElement.mm 2020-05-01 16:17:16 UTC (rev 261001)
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(VIDEO_PRESENTATION_MODE)
+
+#import "PlatformUtilities.h"
+#import "Test.h"
+#import "TestWKWebView.h"
+#import <WebKit/WKPreferencesPrivate.h>
+#import <WebKit/WKUIDelegatePrivate.h>
+#import <wtf/RetainPtr.h>
+#import <wtf/Seconds.h>
+
+static bool didEnterPiP;
+static bool didExitPiP;
+
+@interface ExitPiPOnSuspendVideoElementUIDelegate : NSObject <WKUIDelegate>
+@end
+
+@implementation ExitPiPOnSuspendVideoElementUIDelegate
+
+- (void)_webView:(WKWebView *)webView hasVideoInPictureInPictureDidChange:(BOOL)value
+{
+ if (value)
+ didEnterPiP = true;
+ else
+ didExitPiP = true;
+}
+
+@end
+
+namespace TestWebKitAPI {
+
+TEST(PictureInPicture, ExitPiPOnSuspendVideoElement)
+{
+ RetainPtr<WKWebViewConfiguration> configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
+ [configuration preferences]._fullScreenEnabled = YES;
+ [configuration preferences]._allowsPictureInPictureMediaPlayback = YES;
+ RetainPtr<TestWKWebView> webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 300, 300) configuration:configuration.get() addToWindow:YES]);
+ RetainPtr<ExitPiPOnSuspendVideoElementUIDelegate> handler = adoptNS([[ExitPiPOnSuspendVideoElementUIDelegate alloc] init]);
+ [webView setUIDelegate:handler.get()];
+
+ [webView synchronouslyLoadTestPageNamed:@"ExitFullscreenOnEnterPiP"];
+
+ didEnterPiP = false;
+ [webView evaluateJavaScript:@"document.getElementById('enter-pip').click()" completionHandler: nil];
+ TestWebKitAPI::Util::run(&didEnterPiP);
+
+ sleep(1_s);
+
+ didExitPiP = false;
+ [webView synchronouslyLoadHTMLString:@"<body>Hello world</body>"];
+ TestWebKitAPI::Util::run(&didExitPiP);
+}
+
+} // namespace TestWebKitAPI
+
+#endif