Modified: trunk/Source/WebCore/ChangeLog (199192 => 199193)
--- trunk/Source/WebCore/ChangeLog 2016-04-07 22:25:51 UTC (rev 199192)
+++ trunk/Source/WebCore/ChangeLog 2016-04-07 22:26:27 UTC (rev 199193)
@@ -1,3 +1,19 @@
+2016-04-07 Jeremy Jones <[email protected]>
+
+ In WK1 WebVideoFullscreen interface may be accessed from WK1 main thread instead of UI thread.
+ https://bugs.webkit.org/show_bug.cgi?id=154252
+ rdar://problem/22460539
+
+ Reviewed by Eric Carlson.
+
+ In WebKit1, _javascript_ can cause enter fullscreen to happen on the main thead, which is not
+ necessarily the UI thread. This can cause autolayout errors. Move this code to the UI thread.
+
+ * platform/ios/WebVideoFullscreenControllerAVKit.mm:
+ (WebVideoFullscreenControllerContext::setUpFullscreen): Move setup to the UI thread.
+ * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
+ (-[WebAVPlayerLayer layoutSublayers]): Move call to resolveBounds to the UI thread.
+
2016-04-07 Beth Dakin <[email protected]>
Build fix.
Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm (199192 => 199193)
--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm 2016-04-07 22:25:51 UTC (rev 199192)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm 2016-04-07 22:26:27 UTC (rev 199193)
@@ -550,25 +550,30 @@
RetainPtr<UIView> viewRef = view;
m_videoElement = &videoElement;
- m_interface = WebVideoFullscreenInterfaceAVKit::create();
- m_interface->setWebVideoFullscreenChangeObserver(this);
- m_interface->setWebVideoFullscreenModel(this);
- m_videoFullscreenView = adoptNS([[getUIViewClass() alloc] init]);
-
RefPtr<WebVideoFullscreenControllerContext> strongThis(this);
- WebThreadRun([strongThis, this, viewRef, mode] {
- m_model = WebVideoFullscreenModelVideoElement::create();
- m_model->setWebVideoFullscreenInterface(this);
- m_model->setVideoElement(m_videoElement.get());
+ dispatch_async(dispatch_get_main_queue(), [strongThis, this, viewRef, mode] {
+ ASSERT(isUIThread());
+
+ m_interface = WebVideoFullscreenInterfaceAVKit::create();
+ m_interface->setWebVideoFullscreenChangeObserver(this);
+ m_interface->setWebVideoFullscreenModel(this);
+ m_videoFullscreenView = adoptNS([[getUIViewClass() alloc] init]);
- bool allowsPictureInPicture = m_videoElement->mediaSession().allowsPictureInPicture(*m_videoElement.get());
+ RefPtr<WebVideoFullscreenControllerContext> strongThis(this);
+ WebThreadRun([strongThis, this, viewRef, mode] {
+ m_model = WebVideoFullscreenModelVideoElement::create();
+ m_model->setWebVideoFullscreenInterface(this);
+ m_model->setVideoElement(m_videoElement.get());
+
+ bool allowsPictureInPicture = m_videoElement->mediaSession().allowsPictureInPicture(*m_videoElement.get());
- IntRect videoElementClientRect = elementRectInWindow(m_videoElement.get());
- FloatRect videoLayerFrame = FloatRect(FloatPoint(), videoElementClientRect.size());
- m_model->setVideoLayerFrame(videoLayerFrame);
-
- dispatch_async(dispatch_get_main_queue(), [strongThis, this, videoElementClientRect, viewRef, mode, allowsPictureInPicture] {
- m_interface->setupFullscreen(*m_videoFullscreenView.get(), videoElementClientRect, viewRef.get(), mode, allowsPictureInPicture);
+ IntRect videoElementClientRect = elementRectInWindow(m_videoElement.get());
+ FloatRect videoLayerFrame = FloatRect(FloatPoint(), videoElementClientRect.size());
+ m_model->setVideoLayerFrame(videoLayerFrame);
+
+ dispatch_async(dispatch_get_main_queue(), [strongThis, this, videoElementClientRect, viewRef, mode, allowsPictureInPicture] {
+ m_interface->setupFullscreen(*m_videoFullscreenView.get(), videoElementClientRect, viewRef.get(), mode, allowsPictureInPicture);
+ });
});
});
}
Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm (199192 => 199193)
--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm 2016-04-07 22:25:51 UTC (rev 199192)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm 2016-04-07 22:26:27 UTC (rev 199193)
@@ -742,10 +742,13 @@
CGAffineTransform transform = CGAffineTransformMakeScale(targetVideoFrame.width() / sourceVideoFrame.width(), targetVideoFrame.height() / sourceVideoFrame.height());
[view setTransform:transform];
- [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(resolveBounds) object:nil];
-
- if (!CGAffineTransformIsIdentity(transform))
- [self performSelector:@selector(resolveBounds) withObject:nil afterDelay:[CATransaction animationDuration] + 0.1];
+ NSTimeInterval animationDuration = [CATransaction animationDuration];
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(resolveBounds) object:nil];
+
+ if (!CGAffineTransformIsIdentity(transform))
+ [self performSelector:@selector(resolveBounds) withObject:nil afterDelay:animationDuration + 0.1];
+ });
}
- (void)resolveBounds